diff mercurial/templatekw.py @ 32656:4bec8cce6a09

scmutil: pass ctx object to intrev() This makes it slightly easier to sort basectx objects by key=scmutil.intrev. We're most likely to have ctx objects where changectx/workingctx abstraction is necessary, so this won't increase the abstraction overhead.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 03 Jun 2017 18:57:28 +0900
parents 3920b5970f95
children 55ff67ffcead
line wrap: on
line diff
--- a/mercurial/templatekw.py	Sat Jun 03 14:05:52 2017 +0900
+++ b/mercurial/templatekw.py	Sat Jun 03 18:57:28 2017 +0900
@@ -161,7 +161,7 @@
         hexnode = ctx.hex()
     else:
         hexnode = ctx.hex()[:12]
-    return '%d:%s' % (scmutil.intrev(ctx.rev()), hexnode)
+    return '%d:%s' % (scmutil.intrev(ctx), hexnode)
 
 def getfiles(repo, ctx, revcache):
     if 'files' not in revcache:
@@ -611,7 +611,7 @@
 @templatekeyword('rev')
 def showrev(repo, ctx, templ, **args):
     """Integer. The repository-local changeset revision number."""
-    return scmutil.intrev(ctx.rev())
+    return scmutil.intrev(ctx)
 
 def showrevslist(name, revs, **args):
     """helper to generate a list of revisions in which a mapped template will