distance to tag

Mads Kiilerich mads at kiilerich.com
Thu Feb 27 12:44:15 UTC 2014


On 02/27/2014 12:02 PM, Johannes Totz 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.

No.

The default branch recently grew a revset function that returns a list 
of hashes. It would probably not be hard to add a count function that 
returns the number of entries in a list.

/Mads



More information about the Mercurial mailing list