[haiku-development] Re: Mercurial version string Was:Re: Re: VOTE: Git or Mercurial (hg) as Haiku's new source control tool

  • From: Niels Sascha Reedijk <niels.reedijk@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 14 May 2011 16:24:06 +0200

Hi,

Final note on the Mercurial side (for now). In addition to that in the
previous message and quoted below...

2011/5/14 Niels Sascha Reedijk <niels.reedijk@xxxxxxxxx>:
> Hi,
>
> Here's a second implementation. Note that my shell-scripting still
> sucks, so forgive me for that.
>
> Anyway, using a small extension on the server-side, it is now possible
> to fetch the revision number of a changeset on haiku-central.
>
>
> So for a build with custom changesets I get:
> custom:46900e539f7b~2011-05-12 derived from haiku-central:39309:47b487e35b93
>
> In case of connection troubles, it would be:
> unverified:64fc2d4b5805~2011-05-11
>
> A 'pure' build would yield the following revision string:
> haiku-central:39383:46900e539f7b


I have also written a small extension that on the client-side provides
support for querying your local repo with haiku-central revision
numbers. This function can be used in every hg command that accepts an
-r argument.
Example:

hg update -r "haikucentral(23454)"
hg log -r "tip:haikucentral(35555)"

Also, I implemented a log template keyword, which you can use to
customize log output. You could do this:

hg log -r 39312:39309 --template
"changeset:\t{rev}:{node|short}\nsummary:\t{desc|firstline}\nhaiku-central\t{haikucentral}\n\n"

Which would then output a log with the haiku-central ids.


So in short: I think this is the best mercurial can offer. The shell
script can generate an IMO useful revision identifier during build
time. For this, the extension is not needed.

With the extension, you can also use the haiku-central identifiers on
your local repository.

The side-note with this all is that a network connection is necessary.
With some further development, I can think of ways to do caching that
would not require you to check back with haiku-central if you did not
add new changesets to your repo.

Anyway, this means that unless the git crew creates new challenges,
this is the end of the arms race for mercurial for now.

Regards,

N>

P.S. The extension (haiku-central.py) is attached to this message. The
server-side extension (maprev.py) has been deployed on hg.haiku-os.org
for your enjoyment.

Other related posts: