What is a branch?

John D. Mitchell jdmitchell at gmail.com
Fri Feb 15 11:09:54 CST 2008


On Thu, Feb 14, 2008 at 11:28 PM, Martin Geisler <mg at daimi.au.dk> wrote:
[...]
>  Right, but would it not be just as easy to use seperate clones to
>  identify the branches?

Yes.

>  Except that this makes it more cumbersome to develop in a language
>  like Python where you need to have your clone in PYTHONPATH (or at
>  least that is how I do it -- I would love if anybody could tell me how
>  to easily switch from one clone to another and still have the correct
>  clone in my PYTHONPATH. Perhaps one could use a little extension that
>  updates a symlink to point to the correct clone...).

Symlinks are one way.

They way I use to deal with things like this that need to change based
on e.g., location is to create simple shell script to set/modify them
and invoke the underlying tools. I.e., instead of calling
python/java/gcc/whatever directly, I bake all of the necessary junk
into a single, shared configuration file and different executable
scripts to invoke them in all of the different ways that I need for
each project. I.e., runServer, runTestClient, compile, archive, etc.
You can, of course, do the same trick with e.g., make.

For my upcoming talk at SD West (Give IT a REST), all of this is part
of the sample code that I'm distributing in a tarball that contains
the complete hg repository so people can follow all of the (big) steps
by checking out the various revisions of the software.


>  The advantage of seperate clones would be that I can easily delete a
>  clone that is no longer needed, whereas branches are sticky and will
>  leave a trace in the repository when merged. For a branch like "v2" it
>  would probably be good with such a trace, but with a branch like
>  "my-test-feature" it would be somewhat ugly.

Indeed.

This is exactly the same argument as for using a DSCM like hg instead
of a CSCM like perforce.

Have fun,
John


More information about the Mercurial mailing list