[PATCH 1 of 2] archive: use a templater to build the metadata file

Yuya Nishihara yuya at tcha.org
Mon Jul 17 09:53:12 EDT 2017


On Mon, 17 Jul 2017 00:57:38 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1500241236 14400
> #      Sun Jul 16 17:40:36 2017 -0400
> # Node ID 4d37def90ad5e0196dadb9bc2c9e62effad63691
> # Parent  d09de637cbc88ed2db989298115d0c0cb6cc6f27
> archive: use a templater to build the metadata file

Queued, thanks.

> +    default = (
> +        r'repo: {root}\n'
> +        r'node: {ifcontains(rev, revset("wdir()"),'
> +                            r'"{p1node}{dirty}", "{node}")}\n'
> +        r'branch: {branch|utf8}\n'
>  
> -    base = 'repo: %s\nnode: %s\nbranch: %s\n' % (
> -        _rootctx(repo).hex(), hex, encoding.fromlocal(ctx.branch()))
> +        # {tags} on ctx includes local tags and 'tip', with no current way to
> +        # limit that to global tags.  Therefore, use {latesttag} as a substitute
> +        # when the distance is 0, since that will be the list of global tags on
> +        # ctx.
> +        r'{ifeq(latesttagdistance, 0, latesttag % "tag: {tag}\n",'
> +                       r'"{latesttag % "latesttag: {tag}\n"}'
> +                       r'latesttagdistance: {latesttagdistance}\n'
> +                       r'changessincelatesttag: {changessincelatesttag}\n")}'

You could use {separate('', '', ...)} to eliminate these weird indents.


More information about the Mercurial-devel mailing list