distance to tag
Benjamin Pollack
benjamin at bitquabit.com
Thu Feb 27 14:05:31 UTC 2014
On Feb 27, 2014, at 6:02 AM, Johannes Totz <johannes at jo-t.de> wrote:
> Hi,
>
> I just (re)discovered templates and revsets, nice stuff.
>
> How do I get the number of revisions between a given revision X and
> another given tag/revision Y (along the longest or shortest path)? I
> know there's latesttagdistance but it's not quite what I'm after.
>
> I guess something like...
> hg log -r X:Y --template "{node|short}" | wc -l
>
> ...would work. But is there a built-in function? I'm mainly on windows,
> no wc there.
Unless I’m badly misunderstanding, I think you just want:
hg parent --template '{latesttag}+{latesttagdistance}-{node|short}\n’
You can obviously tweak the exact output format; the above is borrowed from Hg itself, if I recall correctly, but is also what Kiln uses.
—Benjamin
More information about the Mercurial
mailing list