archive: fix changesincelatesttag with wdir()
authorMatt Mackall <mpm@selenic.com>
Wed, 01 Jul 2015 15:12:45 -0500
changeset 25690 98064baab877
parent 25689 1cce81121472
child 25691 5cda0ce05c42
archive: fix changesincelatesttag with wdir()
mercurial/archival.py
tests/test-subrepo-deep-nested-change.t
--- a/mercurial/archival.py	Mon Jun 29 10:34:56 2015 -0400
+++ b/mercurial/archival.py	Wed Jul 01 15:12:45 2015 -0500
@@ -86,7 +86,11 @@
         ltags, dist = repo.ui.popbuffer().split('\n')
         ltags = ltags.split(':')
         # XXX: ctx.rev() needs to be handled differently with wdir()
-        changessince = len(repo.revs('only(%d,%s)', ctx.rev(), ltags[0]))
+        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
--- a/tests/test-subrepo-deep-nested-change.t	Mon Jun 29 10:34:56 2015 -0400
+++ b/tests/test-subrepo-deep-nested-change.t	Wed Jul 01 15:12:45 2015 -0500
@@ -193,7 +193,7 @@
   branch: default
   latesttag: null
   latesttagdistance: 4
-  changessincelatesttag: 3
+  changessincelatesttag: 4
 
 Attempting to archive 'wdir()' with a missing file is handled gracefully
   $ rm sub1/sub1
@@ -220,7 +220,7 @@
   branch: default
   latesttag: null
   latesttagdistance: 4
-  changessincelatesttag: 3
+  changessincelatesttag: 4
 
   $ touch sub1/sub2/folder/bar
   $ hg addremove sub1/sub2