views:

98

answers:

3

is this possible with Mercurial? and which Version Control system can do this besides Clearcase?

+1  A: 

No, it's not possible. A branch in Mercurial is a snapshot of the entire repository state.

You could do it with CVS, though, as CVS tracks changes on a per-file basis :)

David Wolever
+3  A: 

David is correct that you can't have a branch that exists on only a single file, but it's worth pointing out that people often have branches that alter only a single file. Since the branch metadata is stored in the changeset, and since the changeset contains only a delta (change), having a branch that alters only a single files is nearly instantanous to create, update, commit, and merge, plus it takes up almost no space on disk.

Resultingly, it's a very common way to handle per-customer configurations. Keep the tiny change for them in a branch, and merge from main, where development happened, into that branch, whenever you want to update their deployment.

Ry4an
+1  A: 

How you could use MQ:

$ hg qnew -m "Changes for client0" client0
... change the file ...
$ hg qref # update the client0 patch with the changes
$ hg qpop # pop the changes off the queue stack
... develop like normal ...
... client0 asks for a build ...
$ hg qpu # apply client0's patch
$ make release
$ hg qpop

It would get a bit finicky if you've got to deal with a lot of clients… But it may be worth considering.

The other thing you could do, of course, is just commit a bunch of .diff files:

... make changes for client 0 ...
$ hg diff > client0.diff
$ hg revert --all
$ hg add client0.diff
$ hg ci -m "Adding client0 changes"
... develop ...
... client0 asks for a build ...
$ patch -p1 < client0.diff
$ make release
$ hg revert --all
David Wolever
thanks a lot, good to learn
Benny