diff -r eb8a8af4cbd0 -r 37b33c34bf4f mercurial/templatekw.py --- 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