[PATCH 3 of 3 V2 fixes-subrepo-test] archive: use {changessincelatesttag} to build the metafile

Yuya Nishihara yuya at tcha.org
Wed Jul 1 09:43:45 CDT 2015


On Wed, 01 Jul 2015 00:30:27 -0400, Matt Harbison wrote:
> # 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]))

These look good to me.

Eventually we'll be possible to build .hg_archival.txt by the templater, but
I know it will require more effort.


More information about the Mercurial-devel mailing list