a "patch tree" instead of a patch queue?

Julian Cowley julian at lava.net
Fri Jun 6 19:29:55 CDT 2008


On Tue, 3 Jun 2008, Kai Grossjohann wrote:
> The disadvantage of using named branches is that the Mercurial support is 
> less than perfect for it, and sometimes you have to explicitly name branches 
> in hg commands even though you might think that Mercurial should be able to 
> figure it out.  But I find this is not too great a pain.

Another difference (I wouldn't really call it a disadvantage, though, but 
something to keep in mind) between named branches and multiple 
repositories is that there can be a difference between the changeset ids 
for the heads.  Let me explain.

Let's say you have two repositories, example and example-stable, where 
example-stable is always a (non-proper) subset of example.  You fix bugs 
in example-stable and then merge them back into example.

In this case there is an exact correspondence with the way this would work 
with named branches.  That is, if you do an "hg update" in the example 
repository you get the same result as "hg update example" in a repository 
with named branches.  Similarly, if you do "hg update" in example-stable, 
you get the same result as "hg update example-stable".

Now say you also do the development in example then pull the changes into 
example-stable when development is done.  At this point, repositories are 
exactly the same and share the same changeset id for tip.

In this case, named branches are not equivalent.  This is because there is 
no equivalent in a named branch of pulling in the latest development 
branch into the stable branch -- it always has to be a merge instead of 
just an hg pull:

   hg update example-stable
   hg merge example  (should have no conflicts, assuming subset invariant holds)
   hg commit

The contents of both branches are the same, but the changeset ids differ.

The reason is that a changeset can only have one branch name, so there 
would be no way for the same changeset id to be the head of both the 
example and example-stable branches.  If you do "hg update example" (the 
equivalent of doing "hg update" in example with multiple repositories) you 
end up with a different changeset id than if you do "hg update 
example-stable" (the equivalent of doing "hg update" in the example-stable 
repository).

-- 
The revolution has been cancelled due to low ratings.


More information about the Mercurial mailing list