changeset 25665:dc05a10e1e45 stable

archive: don't assume '.' is being archived for changessincelatesttag Hardcoding '.' is wrong, and yielded strange results when archiving old revisions. For example, when archiving the cset that adds the signature to 3.4 (c48850339988), the resulting value was previously 51 (the number of commits on stable between 3.4 and today), even though it was a direct descendant of a tag, with a {latesttagdistance} of 2. This still includes all other _ancestor_ paths not included in {latesttag}. Note that archiving wdir() currently blows up several lines above this when building the 'base' variable. Since wdir() isn't documented, ignore that it needs work to handle wdir() here for now.
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 25 Jun 2015 21:16:47 -0400
parents 6047b60cdd09
children c76e8d14383a ec9c258e666d
files mercurial/archival.py tests/test-glog.t
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/archival.py	Sun Jun 21 13:24:43 2015 +0900
+++ b/mercurial/archival.py	Thu Jun 25 21:16:47 2015 -0400
@@ -75,7 +75,8 @@
         cmdutil.show_changeset(repo.ui, repo, opts).show(ctx)
         ltags, dist = repo.ui.popbuffer().split('\n')
         ltags = ltags.split(':')
-        changessince = len(repo.revs('only(.,%s)', ltags[0]))
+        # XXX: ctx.rev() needs to be handled differently with wdir()
+        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
--- a/tests/test-glog.t	Sun Jun 21 13:24:43 2015 +0900
+++ b/tests/test-glog.t	Thu Jun 25 21:16:47 2015 -0400
@@ -2013,6 +2013,16 @@
   |
   o  0 add a
   
+  $ hg archive -r 7 archive
+  $ grep changessincelatesttag archive/.hg_archival.txt
+  changessincelatesttag: 1
+  $ rm -r archive
+
+changessincelatesttag with no prior tag
+  $ hg archive -r 4 archive
+  $ grep changessincelatesttag archive/.hg_archival.txt
+  changessincelatesttag: 5
+
   $ hg export 'all()'
   # HG changeset patch
   # User test