archive: don't assume '.' is being archived for changessincelatesttag stable
authorMatt Harbison <matt_harbison@yahoo.com>
Thu, 25 Jun 2015 21:16:47 -0400
branchstable
changeset 25665 dc05a10e1e45
parent 25638 6047b60cdd09
child 25675 c76e8d14383a
child 25676 ec9c258e666d
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.
mercurial/archival.py
tests/test-glog.t
--- 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