distance to tag
Johannes Totz
johannes at jo-t.de
Thu Feb 27 16:27:37 UTC 2014
On 27/02/2014 16:03, Kastner Masilko, Friedrich wrote:
>> From: mercurial-bounces at selenic.com
>> [mailto:mercurial-bounces at selenic.com] On Behalf Of Johannes Totz
>>
>> Indeed! :) I need to produce one in the pattern of 1.2.3.4. Build
>> numbers and similar stuff are quite annoying to manage, so I
>> thought might as well generate that reliably from the repo itself.
>
> I see. We had a use-case here where such a dotversion should be
> generated from nearest tag with a specific regex, including the
> distance to it as well as a part of the hash-code to distinguish
> parallel branches. E.g. the tags to be taken into account would be in
> the form of "X.Y" with X and Y being numbers. Then the generated
> dotversion should be X.Y.D.H, with X and Y taken from the nearest
> tag, D being the distance to this tag and H being the first 2 bytes
> of the hash interpreted as 16-bit word.
>
> I've implemented an extension that offers a template keyword
> "dotversion", and a revset function "dotversion(string)" based on
> settings given in the configuration. This was so you could e.g. do a
> "hg log -r . --template {dotversion}\n" to get the current parent's
> dotversion, and do a 'hg log -r "dotversion(1.2.7.22345)"' to search
> for a certain dotversion.
>
> The extension is quite configurable in terms of format, regex and
> hash mangling. You could even configure it to only return the
> distance without tag info or hash at all.
>
> If there is interest in this, I could upload it to my extensions
> repository at BB.
Yes please!
More information about the Mercurial
mailing list