mercurial/templatekw.py
changeset 41722 37b33c34bf4f
parent 41397 0bd56c291359
child 41728 36b62a522814
--- a/mercurial/templatekw.py	Sun Feb 17 22:39:12 2019 -0500
+++ b/mercurial/templatekw.py	Fri Feb 15 14:43:31 2019 -0500
@@ -554,6 +554,14 @@
 
     return _hybrid(f, namespaces, makemap, pycompat.identity)
 
+@templatekeyword('negrev', requires={'repo', 'ctx'})
+def shownegrev(context, mapping):
+    """Integer. The repository-local changeset negative revision number,
+    which counts in the opposite direction."""
+    ctx = context.resource(mapping, 'ctx')
+    repo = context.resource(mapping, 'repo')
+    return scmutil.intrev(ctx) - len(repo)
+
 @templatekeyword('node', requires={'ctx'})
 def shownode(context, mapping):
     """String. The changeset identification hash, as a 40 hexadecimal