monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] Merge conflicts


From: Nathaniel Smith
Subject: Re: [Monotone-devel] Merge conflicts
Date: Sat, 8 Apr 2006 18:16:24 -0700
User-agent: Mutt/1.5.11

On Sat, Apr 08, 2006 at 05:15:05PM +0200, Peter Simons wrote:
> while trying to merge a branch, I got this error message:
> 
>   $ mtn merge
>   mtn: starting with revision 1 / 3
>   mtn: merging with revision 2 / 3
>   mtn: [source] 1bfd0c9f4a347913d2573f3bf8b5e3192350f6a8
>   mtn: [source] 1f7b551d990fa8d8f64072f6563874312e3ed62d
>   mtn: warning: orphaned node conflict on node 20547, dead parent 52, name foo
>   mtn: warning: orphaned node conflict on node 20570, dead parent 52, name bar
>   [...]
>   mtn: warning: resolve non-content conflicts and then try again.
>   mtn: error: merge failed due to unresolved conflicts
> 
> This is good news: the old version used to fail with an
> invariant violation. :-)
> 
> How can I resolve those conflicts? Is this problem
> documented somewhere?

What it's complaining about is that something like the following has
happened:
  rev 1: add dir "blah"
  rev 2 (child of rev 1): delete dir "blah"
  rev 3 (child of rev 1): add files "blah/foo", "blah/bar"
and then you merged revs 2 and 3.  Since "blah" was deleted in 2, and
left alone in 3, in new merged rev, there is no "blah" directory.
However, since the files "blah/foo" and "blah/bar" were both created
in 3, they _do_ exist in the new merged rev.

But, there's a problem -- they exist, but what should they be called?
Their names are supposed to be "blah/foo" and "blah/bar", but "blah"
doesn't exist!

So, that's a conflict, requiring resolution -- monotone needs some
help to figure out what names to use for these files.

Ideally, there would be some UI for this; this is one of the things
workspace merge is supposed to provide.

In the mean time, though, the solution is to commit a new child of rev
3 in which the conflict is "pre-resolved".  I.e., make a new rev 4 in
such a way that when revs 2 and 4 are merged, no conflict arises.

Some ways to do this:
  -- move "blah/foo" and "blah/bar" to some location that _will_ exist
     in the merged rev
  -- delete "blah/foo" and "blah/bar"
  -- move "blah/foo" and "blah/bar" out of the way, drop the "blah"
     dir, create a new dir with name "blah", and move "foo" and "bar"
     back into it.

Basically you do whatever you'd do to resolve the conflict if there
_were_ a nice UI to do so.

There isn't any documentation of all the different conflict types that
can arise (except in some long comments in roster_merge.hh in the
source code), yet.  Since the old code had about the same behavior
when encountering these sorts of more esoteric conflicts (i.e., give
up and die, after printing some more or less cryptic message), getting
that done wasn't considered necessary for 0.26.  Hopefully it will
follow soon.

Hope that helps,
-- Nathaniel

-- 
"If you can explain how you do something, then you're very very bad at it."
  -- John Hopfield




reply via email to

[Prev in Thread] Current Thread [Next in Thread]