mercurial/templatekw.py
changeset 34327 4647e0a8d3d7
parent 33912 e278d6d2d7d2
child 34328 dd28b1f55eb8
--- a/mercurial/templatekw.py	Sat Sep 02 23:13:54 2017 +0900
+++ b/mercurial/templatekw.py	Sun Sep 24 12:43:57 2017 +0900
@@ -11,7 +11,6 @@
 from .node import (
     hex,
     nullid,
-    short,
 )
 
 from . import (
@@ -163,16 +162,6 @@
     if endname in templ:
         yield templ(endname, **strmapping)
 
-def _formatrevnode(ctx):
-    """Format changeset as '{rev}:{node|formatnode}', which is the default
-    template provided by cmdutil.changeset_templater"""
-    repo = ctx.repo()
-    if repo.ui.debugflag:
-        hexfunc = hex
-    else:
-        hexfunc = short
-    return '%d:%s' % (scmutil.intrev(ctx), hexfunc(scmutil.binnode(ctx)))
-
 def getfiles(repo, ctx, revcache):
     if 'files' not in revcache:
         revcache['files'] = repo.status(ctx.p1(), ctx)[:3]
@@ -640,7 +629,7 @@
 
     return _hybrid(None, predecessors,
                    lambda x: {'ctx': repo[x], 'revcache': {}},
-                   lambda d: _formatrevnode(d['ctx']))
+                   lambda d: scmutil.formatchangeid(d['ctx']))
 
 @templatekeyword("successorssets")
 def showsuccessorssets(repo, ctx, **args):
@@ -658,7 +647,7 @@
     data = []
     for ss in ssets:
         h = _hybrid(None, ss, lambda x: {'ctx': repo[x], 'revcache': {}},
-                    lambda d: _formatrevnode(d['ctx']))
+                    lambda d: scmutil.formatchangeid(d['ctx']))
         data.append(h)
 
     # Format the successorssets
@@ -698,7 +687,7 @@
         successors = [hex(n) for n in successors]
         successors = _hybrid(None, successors,
                              lambda x: {'ctx': repo[x], 'revcache': {}},
-                             lambda d: _formatrevnode(d['ctx']))
+                             lambda d: scmutil.formatchangeid(d['ctx']))
 
         # Format markers
         finalmarkers = []
@@ -759,7 +748,7 @@
                for p in pctxs]
     f = _showlist('parent', parents, args)
     return _hybrid(f, prevs, lambda x: {'ctx': repo[int(x)], 'revcache': {}},
-                   lambda d: _formatrevnode(d['ctx']))
+                   lambda d: scmutil.formatchangeid(d['ctx']))
 
 @templatekeyword('phase')
 def showphase(repo, ctx, templ, **args):