Fwd: Enriching a file log by branches, tags and bookmarks
Matt Mackall
mpm at selenic.com
Fri Apr 3 15:53:51 UTC 2015
On Fri, 2015-04-03 at 15:55 +0200, Marc Strapetz wrote:
> On 02.04.2015 21:08, Matt Mackall wrote:
> > So if the file log shows revisions 1 and 10, but there's a 1.0 tag at 5,
> > we want to show the tag on 1 to say "this was in 1.0". Right now {tags}
> > will only tell you about tags on the current changeset and doesn't know
> > which set of changesets are going to be displayed.
> >
> > So we don't in fact have a good way to do what's wanted here in a
> > template at present.
>
> I'm not necessarily looking for a template, it will also be fine if this
> could be done within a plugin. I couldn't find any high-level API which
> I could use to compose something useful here. Do you have any suggestions?
>
> > However, I do find this useful:
> >
> > [alias]
> > tagged = log -r 'first($1:: and tagged())'
>
> AFAIU this gives me the most recent tag for a specific revision? I don't
> understand what happens here but could that be generalized to do what
> I'm looking for?
$ hg log -r 'last(::. and file(COPYING))'
changeset: 14512:8c8b55733cbd
user: Matt Mackall <mpm at selenic.com>
date: Thu Jun 02 11:17:02 2011 -0500
summary: COPYING: refresh with current address from fsf.org
The last ancestor (::) of my current working copy (.) to touch COPYING was changeset 14512.
$ hg log -r 'first(14512:: and tagged())'
changeset: 14825:de9eb6b1da4f
branch: stable
tag: 1.9
user: Mads Kiilerich <mads at kiilerich.com>
date: Fri Jul 01 17:37:09 2011 +0200
summary: util: rename the util.localpath that uses url to urllocalpath (issue2875)
The first descendant (:: on the other side) of 14512 that was tagged was 1.9 on Jul 1 2011.
$ hg tagged 14512 -T "{tags}\n"
1.9
Put it all together:
$ hg log -r 'first(last(::. and file(COPYING)):: and tagged())' -T "{tags}\n"
1.9
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial
mailing list