Repo based version numbering

Benoit Boissinot bboissin at gmail.com
Mon Nov 10 05:56:45 CST 2008


On Mon, Nov 10, 2008 at 12:44 PM, Alpár Jüttner <alpar at cs.elte.hu> wrote:
>> Why not call "hg id" during build and use that value?
>
> We came across into a similar problem in our project, and it turned out
> that the hash id is not sufficient for versioning a devel snapshot. Such
> a version string should meet the following criteria:
>
>      * a version of a newer snapshot should be higher
>      * it should be uniquely identify the changeset it is based on.
>      * the changeset should uniquely identify the version
>        (independently the actual contents of the repo)
>      * it is good if the version of the snapshots are higher than the
>        version of the releases, because then the dependencies will
>        hold.
>
> To meet these criteria we give the version LEN.HASH for the snapshots,
> where LEN is the longest path from rev 0 to the current revision. Here
> is our script for computing the value of LEN:

Why not use the number of ancestors ? len(repo.changelog.ancestors(<node>))

regards,

Benoit



More information about the Mercurial mailing list