当前位置: 首页>>代码示例>>Python>>正文


Python node.hex函数代码示例

本文整理汇总了Python中mercurial.node.hex函数的典型用法代码示例。如果您正苦于以下问题:Python hex函数的具体用法?Python hex怎么用?Python hex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了hex函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: save

 def save(cls, repo, name, stripnodes):
     fp = repo.opener(cls._filename, 'wb')
     fp.write('%i\n' % cls._version)
     fp.write('%s\n' % name)
     fp.write('%s\n' % ' '.join([hex(p) for p in repo.dirstate.parents()]))
     fp.write('%s\n' % ' '.join([hex(n) for n in stripnodes]))
     fp.close()
开发者ID:jordigh,项目名称:mercurial-crew,代码行数:7,代码来源:shelve.py

示例2: export_hg_tags

 def export_hg_tags(self):
     for tag, sha in self.repo.tags().iteritems():
         # git doesn't like spaces in tag names
         tag = tag.replace(" ", "_")
         if self.repo.tagtype(tag) in ('global', 'git'):
             self.git.refs['refs/tags/' + tag] = self.map_git_get(hex(sha))
             self.tags[tag] = hex(sha)
开发者ID:lloyd,项目名称:hg-git,代码行数:7,代码来源:git_handler.py

示例3: pathcopies

 def pathcopies(orig, x, y, match=None):
     func = lambda: orig(x, y, match=match)
     if x._node is not None and y._node is not None and not match:
         key = 'pathcopies:%s:%s' % (
                 node.hex(x._node), node.hex(y._node))
         return memoize(func, key, pathcopiesserializer, ui)
     return func()
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:7,代码来源:simplecache.py

示例4: test_push_to_default

 def test_push_to_default(self, commit=True):
     repo = self.repo
     old_tip = repo['tip'].node()
     expected_parent = repo['default'].node()
     def file_callback(repo, memctx, path):
         if path == 'adding_file':
             return context.memfilectx(path=path,
                                       data='foo',
                                       islink=False,
                                       isexec=False,
                                       copied=False)
         raise IOError(errno.EINVAL, 'Invalid operation: ' + path)
     ctx = context.memctx(repo,
                          (repo['default'].node(), node.nullid),
                          'automated test',
                          ['adding_file'],
                          file_callback,
                          'an_author',
                          '2008-10-07 20:59:48 -0500',
                          {'branch': 'default',})
     new_hash = repo.commitctx(ctx)
     if not commit:
         return # some tests use this test as an extended setup.
     hg.update(repo, repo['tip'].node())
     self.pushrevisions()
     tip = self.repo['tip']
     self.assertNotEqual(tip.node(), old_tip)
     self.assertEqual(node.hex(tip.parents()[0].node()),
                      node.hex(expected_parent))
     self.assertEqual(tip['adding_file'].data(), 'foo')
     self.assertEqual(tip.branch(), 'default')
开发者ID:bulwinkel,项目名称:dot-files,代码行数:31,代码来源:test_push_command.py

示例5: puttags

    def puttags(self, tags):
        try:
            parentctx = self.repo[self.tagsbranch]
            tagparent = parentctx.node()
        except error.RepoError:
            parentctx = None
            tagparent = nullid

        try:
            oldlines = sorted(parentctx['.hgtags'].data().splitlines(True))
        except:
            oldlines = []

        newlines = sorted([("%s %s\n" % (tags[tag], tag)) for tag in tags])
        if newlines == oldlines:
            return None, None
        data = "".join(newlines)
        def getfilectx(repo, memctx, f):
            return context.memfilectx(f, data, False, False, None)

        self.ui.status(_("updating tags\n"))
        date = "%s 0" % int(time.mktime(time.gmtime()))
        extra = {'branch': self.tagsbranch}
        ctx = context.memctx(self.repo, (tagparent, None), "update tags",
                             [".hgtags"], getfilectx, "convert-repo", date,
                             extra)
        self.repo.commitctx(ctx)
        return hex(self.repo.changelog.tip()), hex(tagparent)
开发者ID:MezzLabs,项目名称:mercurial,代码行数:28,代码来源:hg.py

示例6: writefirefoxtrees

def writefirefoxtrees(repo):
    """Write the firefoxtrees node mapping to the filesystem."""
    lines = []
    trees = {}
    for tree, node in sorted(repo.firefoxtrees.items()):
        assert len(node) == 20
        lines.append('%s %s' % (tree, hex(node)))
        trees[tree] = hex(node)

    _firefoxtreesrepo(repo).vfs.write('firefoxtrees', '\n'.join(lines))

    # Old versions of firefoxtrees stored labels in the localtags file. Since
    # this file is read by Mercurial and has no relevance to us any more, we
    # prune relevant entries from this file so the data isn't redundant with
    # what we now write.
    localtags = repo.opener.tryread('localtags')
    havedata = len(localtags) > 0
    taglines  = []
    for line in localtags.splitlines():
        line = line.strip()
        node, tag = line.split()
        tree, uri = resolve_trees_to_uris([tag])[0]
        if not uri:
            taglines.append(line)

    if havedata:
        repo.vfs.write('localtags', '\n'.join(taglines))
开发者ID:armenzg,项目名称:version-control-tools,代码行数:27,代码来源:__init__.py

示例7: computenonoverlap

    def computenonoverlap(orig, repo, c1, c2, *args, **kwargs):
        u1, u2 = orig(repo, c1, c2, *args, **kwargs)
        if shallowrepo.requirement in repo.requirements:
            m1 = c1.manifest()
            m2 = c2.manifest()
            files = []

            sparsematch1 = repo.maybesparsematch(c1.rev())
            if sparsematch1:
                sparseu1 = []
                for f in u1:
                    if sparsematch1(f):
                        files.append((f, hex(m1[f])))
                        sparseu1.append(f)
                u1 = sparseu1

            sparsematch2 = repo.maybesparsematch(c2.rev())
            if sparsematch2:
                sparseu2 = []
                for f in u2:
                    if sparsematch2(f):
                        files.append((f, hex(m2[f])))
                        sparseu2.append(f)
                u2 = sparseu2

            # batch fetch the needed files from the server
            repo.fileservice.prefetch(files)
        return u1, u2
开发者ID:davidshepherd7,项目名称:dotfiles,代码行数:28,代码来源:__init__.py

示例8: add

        def add(entry, f, isdest):
            seen.add(f)
            h = entry[3]
            p = (entry[1] == "100755")
            s = (entry[1] == "120000")
            renamesource = (not isdest and entry[4][0] == 'R')

            if f == '.gitmodules':
                if skipsubmodules:
                    return

                subexists[0] = True
                if entry[4] == 'D' or renamesource:
                    subdeleted[0] = True
                    changes.append(('.hgsub', hex(nullid)))
                else:
                    changes.append(('.hgsub', ''))
            elif entry[1] == '160000' or entry[0] == ':160000':
                if not skipsubmodules:
                    subexists[0] = True
            else:
                if renamesource:
                    h = hex(nullid)
                self.modecache[(f, h)] = (p and "x") or (s and "l") or ""
                changes.append((f, h))
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:25,代码来源:git.py

示例9: fix_hgtags

def fix_hgtags(ui, repo, head_hgtags, tagsmap):
    for tf in iter(tagsmap):
        ui.debug('fix_hgtags: tagsmap %s -> %s\n' % (tf, tagsmap[tf]))
    for old in iter(head_hgtags):
        new = map_recursive(tagsmap, old)
        ui.debug('fix_hgtags: head %s -> %s\n' % (old, new))
        merge.update(repo, repo[new].node(), False, False, False)
        tfile = open('.hgtags', 'wb')
        lines = StringIO.StringIO(head_hgtags[old])
        for line in lines:
            if not line:
                continue
            (nodehex, name) = line.split(" ", 1)
            name = name.strip()
            nhm = map_recursive(tagsmap, nodehex)
            ui.debug('fix_hgtags: hgtags write: %s %s\n' % (nhm, name))
            tfile.write('%s %s\n' % (nhm, name))
        lines.close()    
        tfile.close()
        wctx = repo[None]
        if '.hgtags' not in wctx:
            wctx.add(['.hgtags'])
        nrev = repo.commit(text="collapse tag fix")
        if nrev:
            nctx = repo[nrev]
            ui.debug(_('fix_hgtags: nctx rev %d node %r files %r\n') % 
                     (nctx.rev(), hex(nctx.node()), nctx.files()))
            ui.debug(_('fix_hgtags: nctx parents %r\n') % 
                      ([hex(p.node()) for p in nctx.parents()]))
        else:
            ui.debug(_('fix_hgtags: nctx: None\n'))
开发者ID:ellipsis-index,项目名称:zeekay-dot-files,代码行数:31,代码来源:collapse.py

示例10: test_fresh_fetch_two_revs

 def test_fresh_fetch_two_revs(self):
     repo = self._load_fixture_and_fetch('two_revs.svndump')
     self.assertEqual(node.hex(repo[0].node()),
                      '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
     self.assertEqual(node.hex(repo['tip'].node()),
                      'c95251e0dd04697deee99b79cc407d7db76e6a5f')
     self.assertEqual(repo['tip'], repo[1])
开发者ID:avuori,项目名称:dotfiles,代码行数:7,代码来源:test_fetch_command.py

示例11: changeset

    def changeset(self, tmpl, ctx):
        n = ctx.node()
        showtags = self.showtag(tmpl, 'changesettag', n)
        parents = ctx.parents()
        p1 = parents[0].node()

        files = []
        parity = paritygen(self.stripecount)
        for f in ctx.files():
            files.append(tmpl("filenodelink",
                              node=hex(n), file=f,
                              parity=parity.next()))

        def diff(**map):
            yield self.diff(tmpl, p1, n, None)

        return tmpl('changeset',
                    diff=diff,
                    rev=ctx.rev(),
                    node=hex(n),
                    parent=self.siblings(parents),
                    child=self.siblings(ctx.children()),
                    changesettag=showtags,
                    author=ctx.user(),
                    desc=ctx.description(),
                    date=ctx.date(),
                    files=files,
                    archives=self.archivelist(hex(n)),
                    tags=self.nodetagsdict(n),
                    branch=self.nodebranchnodefault(ctx),
                    inbranch=self.nodeinbranch(ctx),
                    branches=self.nodebranchdict(ctx))
开发者ID:c0ns0le,项目名称:cygwin,代码行数:32,代码来源:hgweb_mod.py

示例12: committags

    def committags(self, rev, endbranches):
        if not self.addedtags and not self.deletedtags:
            return
        date = self.fixdate(rev.date)
        # determine additions/deletions per branch
        branches = {}
        for tags in (self.addedtags, self.deletedtags):
            for tag, (branch, srcrev) in tags.iteritems():
                op = srcrev is None and 'rm' or 'add'
                branches.setdefault(branch, []).append((op, tag, srcrev))

        for b, tags in branches.iteritems():
            fromtag = self.get_path_tag(self.remotename(b))
            # modify parent's .hgtags source
            parent = self.repo[self.get_parent_revision(rev.revnum, b)]
            if '.hgtags' not in parent:
                src = ''
            else:
                src = parent['.hgtags'].data()
            for op, tag, r in sorted(tags, reverse=True):
                if op == 'add':
                    if fromtag:
                        if fromtag in self.tags:
                            tagged = node.hex(self.tags[fromtag])
                    else:
                        tagged = node.hex(self.revmap[
                            self.get_parent_svn_branch_and_rev(r, b)])
                else:
                    tagged = node.hex(node.nullid)
                src += '%s %s\n' % (tagged, tag)
                self.tags[tag] = node.bin(tagged), rev.revnum

            # add new changeset containing updated .hgtags
            def fctxfun(repo, memctx, path):
                return context.memfilectx(path='.hgtags', data=src,
                                          islink=False, isexec=False,
                                          copied=None)

            extra = self.genextra(rev.revnum, b)
            if fromtag:
                extra['branch'] = parent.extra().get('branch', 'default')
            self.mapbranch(extra, b in endbranches or fromtag)

            ctx = context.memctx(self.repo,
                                 (parent.node(), node.nullid),
                                 rev.message or ' ',
                                 ['.hgtags'],
                                 fctxfun,
                                 self.authors[rev.author],
                                 date,
                                 extra)
            new = self.repo.commitctx(ctx)

            if not fromtag and (rev.revnum, b) not in self.revmap:
                self.revmap[rev.revnum, b] = new
            if b in endbranches:
                endbranches.pop(b)
                bname = b or 'default'
                self.ui.status('Marked branch %s as closed.\n' % bname)
开发者ID:chaptastic,项目名称:config_files,代码行数:59,代码来源:svnmeta.py

示例13: __str__

 def __str__(self):
     """String representation for storage"""
     time = ' '.join(map(str, self.timestamp))
     oldhashes = ','.join([node.hex(hash) for hash in self.oldhashes])
     newhashes = ','.join([node.hex(hash) for hash in self.newhashes])
     return '\n'.join((
         time, self.user, self.command, self.namespace, self.name,
         oldhashes, newhashes))
开发者ID:motlin,项目名称:cyg,代码行数:8,代码来源:journal.py

示例14: runhooks

 def runhooks():
     args = hookargs.copy()
     args['node'] = hex(added[0])
     op.repo.hook("changegroup", **args)
     for n in added:
         args = hookargs.copy()
         args['node'] = hex(n)
         op.repo.hook("incoming", **args)
开发者ID:Nephyrin,项目名称:bzexport,代码行数:8,代码来源:__init__.py

示例15: movedescendants

def movedescendants(ui, repo, collapsed, tomove, movemap, tagsmap, 
                    parent_hgtags, movelog, debug_delay):
    'Moves the descendants of the source revisions to the collapsed revision'

    sorted_tomove = list(tomove)
    sorted_tomove.sort()

    for r in sorted_tomove:
        ui.debug(_('moving revision %r\n') % r)

        if debug_delay:
            ui.debug(_('sleep debug_delay: %r\n') % debug_delay)
            time.sleep(debug_delay)

        parents = [p.rev() for p in repo[r].parents()]
        nodehex = hex(repo[r].node())
        if repo[r].files() == ['.hgtags'] and len(parents) == 1:
            movemap[r] = movemap[parents[0]]
            phex = hex(repo[parents[0]].node())
            assert phex in tagsmap
            tagsmap[nodehex] = tagsmap[phex]
        else:
            if len(parents) == 1:
                ui.debug(_('setting parent to %d\n') 
                         % movemap[parents[0]].rev())
                repo.dirstate.setparents(movemap[parents[0]].node())
            else:
                ui.debug(_('setting parents to %d and %d\n') %
                    (map_or_rev(repo, movemap, parents[0]).rev(), 
                     map_or_rev(repo, movemap, parents[1]).rev()))
                repo.dirstate.setparents(map_or_rev(repo, movemap, 
                                                    parents[0]).node(),
                                         map_or_rev(repo, movemap, 
                                                    parents[1]).node())

            repo.dirstate.write()
            
            ui.debug(_('reverting to revision %d\n') % r)
            recreaterev(ui, repo, r)

            write_hgtags(parent_hgtags)
            newrev = repo.commit(text=repo[r].description(), 
                                 user=repo[r].user(), date=repo[r].date(),
                                 force=True)

            if newrev == None:
                raise util.Abort(_('no commit done: text=%r, user=%r, date=%r')
                                 % (repo[r].description(), repo[r].user(), 
                                    repo[r].date()))
                
            ctx = repo[newrev]
            movemap[r] = ctx

            newhex = hex(ctx.node())
            tagsmap[nodehex] = newhex
            ui.debug(_('movedescendants %s -> %s\n' % (nodehex, newhex)))
            if movelog:
                movelog.write('move %s -> %s\n' % (nodehex, newhex))
开发者ID:ellipsis-index,项目名称:zeekay-dot-files,代码行数:58,代码来源:collapse.py


注:本文中的mercurial.node.hex函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。