[PATCH 1 of 3] identify: change p1/p2 to a list of parents
Yuya Nishihara
yuya at tcha.org
Mon Jun 26 09:17:59 EDT 2017
On Sun, 25 Jun 2017 23:55:26 -0400, Matt Harbison wrote:
> On Sun, 25 Jun 2017 21:48:02 -0400, Yuya Nishihara <yuya at tcha.org> wrote:
>
> > # HG changeset patch
> > # User Yuya Nishihara <yuya at tcha.org>
> > # Date 1498436335 -32400
> > # Mon Jun 26 09:18:55 2017 +0900
> > # Node ID 556d2afe74385fe2a6dd7cdff5651080a827813f
> > # Parent a49ab7f5e7e765a94a1dfab2ee3b1da695789eb6
> > identify: change p1/p2 to a list of parents
> >
> > It makes sense because the nested data structure is a list of items.
>
> Having them rolled into one list makes it a little more difficult to
> access in a -T pattern, but maybe that's OK. (I know nothing about the
> json parsing aspect.)
>
> What I'm hoping to do is build the version string with the template. The
> closest I came is:
>
> $ ../hg id -T "{latesttag}{if('{dirty}', '+{latesttag % \'{changes}\'}',
> '+{parents % \'{latesttag % \"{changes}\"}\'}')}-{id}{if('{dirty}',
> '{date(date, \"%Y%m%d\")}')}"
>
> Yikes. This won't work for a (clean) merge revision, since there's no way
> to select only p1.
You could use revset(".").
hg identify -T '{revset(".") % "{latesttag % "{changes}"}"}\n'
Well, it doesn't look nice, we might want map operator for non-list so we
can do '{p1rev % "{latesttag ...}"}' for example. But the point of this patch
is that {p1} and {p2} are not lists. {parents} is.
More information about the Mercurial-devel
mailing list