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
(a4f6d198e7df), 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.
This commit is contained in:
Matt Harbison 2015-06-25 21:16:47 -04:00
parent ec7ad76871
commit d4e8d4f13c
2 changed files with 12 additions and 1 deletions

View File

@ -75,7 +75,8 @@ def buildmetadata(ctx):
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

View File

@ -2013,6 +2013,16 @@ Test --follow and forward --rev
|
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