distance to tag
Kastner Masilko, Friedrich
kastner-masilko at at.festo.com
Thu Feb 27 16:03:02 UTC 2014
> 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.
Regards,
Fritz
Development Software Systems
Festo Gesellschaft m.b.H.
Linzer Strasse 227
Austria - 1140 Wien
Firmenbuch Wien
FN 38435y
UID: ATU14650108
Tel: +43(1)91075-198
Fax:
www.festo.at
Der Inhalt dieser E-Mail und moeglicher Anhaenge sind ausschliesslich fuer den bezeichneten Adressaten bestimmt.
Jede Form der Kenntnisnahme, Veroeffentlichung, Vervielfaeltigung oder Weitergabe des Inhalts dieser E-Mail und
moeglicher Anhaenge durch unberechtigte Dritte ist unzulaessig. Wir bitten Sie, sich mit dem Absender der E-Mail in
Verbindung zu setzen, falls Sie nicht der Adressat dieser E-Mail sind sowie das Material von Ihrem Computer zu loeschen.
This e-mail and any attachments are confidential and intended solely for the addressee. The perusal, publication, copying or
dissemination of the contents of this e-mail by unauthorised third parties is prohibited. If you are not the intended recipient of this
e-mail, please delete it and immediately notify the sender.
More information about the Mercurial
mailing list