What is a branch?

Bela Babik teki321 at gmail.com
Thu Feb 14 06:44:50 CST 2008


>  Let's say I'm on tip (HEAD off the development tree) I want to start to
>  freeze the development to release version 2.0. In cvs this would be done
>  with "cvs tag -b" which makes the branch and tags it (thats like named
>  branches in hg).
>
>  Now, how is this done in hg?

I can strongly recommend the hgbook:
http://hgbook.red-bean.com/hgbookch4.html#x8-760004.3

The main difference between cvs and mercurial is that in cvs you can
not commit if you do not have the latest version from the files. In hg
you actually can commit and this commit will create a new head (=
branch). That's why you do not need to create branches in mercurial,
if you are doing a commit against a node which already have a
children, then you will create a new branch. The hg branch command
itself just assigns a name to this branch, but you have to assign this
name before the commit, because later you can not do this.

In CVS if you would like to commit two different changesets against
the same version of the file, you need to create a branch first in the
repository, and then you can tell cvs on which branch are you
currently, and then commit to that branch.

So the answer is:
hg branch branchname
But it will not modify the repository.

teki


More information about the Mercurial mailing list