multi-headed repo (was Re: new user questions)

Christopher Li hg at chrisli.org
Thu Jun 2 23:37:25 UTC 2005


On Thu, Jun 02, 2005 at 06:36:38PM -0700, Matt Mackall wrote:
> The problem is this:
> 
> I have a repo with a tag "last working version" on revision A
> I pull from someone else with a tag "last working version" on revision B

OK.

>  
> Now I have two heads and the .hgtags files in those heads have
> conflicts. So when I attempt 'hg co "last working version"', what
> should hg do?

I can describe what happen in SM even though I haven't implement
tag for SM yet, that is so up level stuff. Remember SM two parent is
not equal, let say you do "merge A B".  That means bring what ever
newer patch in B to A. The base of the new merge is A.

You did not tell me the merge history between A, B. It is possible
the conflict is resolvable by auto merge. e.g. A is 2.4.10 and B is 2.4.20.
B will over write A.

Let say it is the worse case, you have a real conflict. A and B are
independent having the "last working version". Now auto merge will
fail. It will stop and bring up the UI for user to pick follow A or 
follow B, obvious follow A+B is not an option. Until the user resolve
the conflict and commit, there is no change to A. After user resolve
and commit, there will be new node at the tip of A. Still no change to B.
That is because you chose "merge A B" not "merge B A".

That this time you hg co "last working version" will bring up what
you resolve it to. Before the resolve it when you using last working
version, it will bring up previous A's "last working version". Assume
your current working dir is from branch A.

> 
> > Your hg should remember your current working branch as well (when you
> > check out without any version). Just use the tag file from the tip of that
> > branch.
> 
> There's not guaranteed to be a single head on that branch. Nor is that

We need to unify what it meas. In my world head is the tip of the branch.
One branch has only one head. When you go back to a old version (not
tip of branch) and make a check in there, you automatically gain a new branch.

> generally what you want, because you'll often want to pull from
> someone and then merge against one of their tags.

SM should just work. You need to be more specific when you refer tags, you are
not using the current branch's tip(head) tag file . You are using
the tip of B branch's tags file.

Chris




More information about the Mercurial mailing list