Switch between branches (repos behaving as branches)

Rafael Fernández López ereslibre at kde.org
Wed Jun 16 16:52:15 CDT 2010


Hello all,

Probably something has already been invented or whatever, but just to
ping for opinions and suggestions. I happened to like Kiln [1] server
branching model. It's probably the most natural behavior for Mercurial
at server's side. Now, I wanted to have something similar, but on my
client side.

The motivation is that I actually compile big C/C++ projects, and
building time is crucial. Having the building information somehow
shared between repositories sounded like a great idea, because it
would also require very few hard disk space, and a big time gain.

So, basically I wrote this really dumb Ruby script that does the job,
but is extremely simple, and I mean *extremely*. An example:

mkdir myProject ; cd myProject

hg clone -U projectURL featureFoo
<commit stuff>
hg clone -U projectURL2 featureBar
<commit stuff>
hg clone -U projectURL3 featureBaz
<commit stuff>

mkdir workingCopy ; cd workingCopy

hgb featureFoo
hg log

hgb featureBar
hg log

hgb featureBaz
hg log

So, rationale is: workingCopy is where we will always work. The idea
is that all repos will never have working copy. All what happens when
you switch "branches" is:

- hg update null (so we remove all files, and keep the building
information that was properly ignored, or whatever)
- remove .hg symbolic link
- create symbolic link ".hg" and point it to the new working branch
".hg" directory
- hg update

Comments ? Ideas ? Opinions ?


Best regards,
Rafael Fernández López.


[1] http://kilnhg.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hgb
Type: application/octet-stream
Size: 2084 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100616/1f8d876c/attachment.obj>


More information about the Mercurial-devel mailing list