[PATCH 2 of 2 V3] archive: use {changessincelatesttag} to build the metadata file

Matt Harbison mharbison72 at gmail.com
Wed Jul 1 19:32:23 CDT 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1435723009 14400
#      Tue Jun 30 23:56:49 2015 -0400
# Node ID 7f7d4a11332ed38e65691a1a2118e63e57a8eda7
# Parent  49d56afc63719c326f7131ad7861090de3ce9102
archive: use {changessincelatesttag} to build the metadata file

This isolates the current magic when dealing with wdir() and only().

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -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


More information about the Mercurial-devel mailing list