archive: use {changessincelatesttag} to build the metadata file
authorMatt Harbison <matt_harbison@yahoo.com>
Tue, 30 Jun 2015 23:56:49 -0400
changeset 25725 f5f43178bdde
parent 25724 4474a750413f
child 25726 b44e483726d3
archive: use {changessincelatesttag} to build the metadata file This isolates the current magic when dealing with wdir() and only().
mercurial/archival.py
--- a/mercurial/archival.py	Fri Jun 26 23:11:05 2015 -0400
+++ b/mercurial/archival.py	Tue Jun 30 23:56:49 2015 -0400
@@ -80,16 +80,12 @@
                    if repo.tagtype(t) == 'global')
     if not tags:
         repo.ui.pushbuffer()
-        opts = {'template': '{latesttag}\n{latesttagdistance}',
+        opts = {'template': '{latesttag}\n{latesttagdistance}\n'
+                            '{changessincelatesttag}',
                 'style': '', 'patch': None, 'git': None}
         cmdutil.show_changeset(repo.ui, repo, opts).show(ctx)
-        ltags, dist = repo.ui.popbuffer().split('\n')
+        ltags, dist, changessince = repo.ui.popbuffer().split('\n')
         ltags = ltags.split(':')
-        if ctx.rev() is None:
-            changessince = len(repo.revs('only(%d,%s)', ctx.p1(),
-                                         ltags[0])) + 1
-        else:
-            changessince = len(repo.revs('only(%d,%s)', ctx.rev(), ltags[0]))
         tags = ''.join('latesttag: %s\n' % t for t in ltags)
         tags += 'latesttagdistance: %s\n' % dist
         tags += 'changessincelatesttag: %s\n' % changessince