[PATCH 3 of 3 V2 fixes-subrepo-test] archive: use {changessincelatesttag} to build the metafile
Matt Harbison
mharbison72 at gmail.com
Tue Jun 30 23:30:27 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 644b9df80fb127d5c1238444c3c9f79247d74c22
# Parent a4e09e0f63bcabe7f9c584dbffbcdd167f57a573
archive: use {changessincelatesttag} to build the metafile
This fixes the crash when ctx is wdir(), and isolates the current magic when
dealing with wdir() and only(). The changes in the test were because the code
here prior to dc05a10e1e45 used '.', and the tests started crashing once merged
into default. (These tests were only on default, since archiving wdir() is not
currently supported on stable.)
diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -80,13 +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(':')
- # 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
diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t
--- a/tests/test-subrepo-deep-nested-change.t
+++ b/tests/test-subrepo-deep-nested-change.t
@@ -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
More information about the Mercurial-devel
mailing list