divergent file rename

Matt Mackall mpm at selenic.com
Wed May 6 16:41:03 CDT 2009


On Wed, May 06, 2009 at 12:01:25AM -0300, Diego Oliveira wrote:
> Hello crew,
> I'm having some strange behavior doing the merge of different file reame
> based in the
> same revision. I'm looking to understand what should be the correct behavior
> of the
> merge scenario.
> 
> 
> A (file.txt) --- B (file.txt-> file2.txt) ---+- D (?)
>  \                                                   /
>   +---- @C (file.txt-> file3.txt) ------+
> 
> 
> The actual behavior let the two files in the work dir for the commit D, but
> i think the
> correct should be to keep the file3.txt merged with the changes in
> file2.txt.

Merge is symmetrical, so there's no reason to favor that answer over
keeping file2 and merging in changes from file3. Clearly both can't be
the right answer, so both are wrong.

Mercurial's view is actually that there's no conflict here. If we start with:

 a-story-about-puppies.txt

and one user changes it to:

 a-story-about-kittens.txt

and another changes it to:

 a-story-about-bunnies.txt

then there's nothing intrinsically wrong with the merge result being
two files:

 a-story-about-kittens.txt
 a-story-about-bunnies.txt

Merging bits about kittens into the story about bunnies (or
vice-versa) will likely have undesired results.

Sometimes (but not always), there will be other related changes that
conflict. For instance, if your makefile says:

a-story-about-puppies.pdf:
 txt2pdf a-story-about-puppies.txt

If both sides change it, then you've got a conflict, but the conflict
is -in your Makefile-. Fixing that might mean any of:

a) combining the two files by hand
b) deleting one
c) having multiple Makefile entries
d) having a department-wide meeting about fuzzy animal strategy 

..but it's outside the scope of what Mercurial is prepared to do
anything about.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list