changeset 26483:e94f93043a4e

templatekw: factor out the changessincetag calculation to a private method This will be reused in the next patch.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 05 Oct 2015 21:11:50 -0400
parents d2e69584e330
children 93c80e7ed8c8
files mercurial/templatekw.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templatekw.py	Sun Aug 23 23:22:55 2015 -0400
+++ b/mercurial/templatekw.py	Mon Oct 05 21:11:50 2015 -0400
@@ -357,15 +357,20 @@
 def showchangessincelatesttag(repo, ctx, templ, cache, **args):
     """:changessincelatesttag: Integer. All ancestors not in the latest tag."""
     latesttag = getlatesttags(repo, ctx, cache)[2][0]
+
+    return _showchangessincetag(repo, ctx, tag=latesttag, **args)
+
+def _showchangessincetag(repo, ctx, **args):
     offset = 0
     revs = [ctx.rev()]
+    tag = args['tag']
 
     # The only() revset doesn't currently support wdir()
     if ctx.rev() is None:
         offset = 1
         revs = [p.rev() for p in ctx.parents()]
 
-    return len(repo.revs('only(%ld, %s)', revs, latesttag)) + offset
+    return len(repo.revs('only(%ld, %s)', revs, tag)) + offset
 
 def showmanifest(**args):
     repo, ctx, templ = args['repo'], args['ctx'], args['templ']