[darcs-users] Re: Merge and conflicts

David Roundy droundy at abridgegame.org
Sat Mar 6 11:47:43 UTC 2004


On Fri, Mar 05, 2004 at 02:43:43PM +0100, Samuel Tardieu wrote:
> >>>>> "David" == David Roundy <droundy at abridgegame.org> writes:
> 
> David> This is when both changes are identical (it only does it once),
> David> or if both changes add a line at the same location in a file
> David> (it chooses which goes first alphabetically), or similar cases.
> 
> Choosing the first one alphabetically can lead to a disaster. For
> example, if two developpers A & B add an entry to two parallel list
> structures, in one file developper A's change may go ahead of developer
> B's and in the other file it will be the reverse situation.

First off, unless you get into interesting three-way conflicts, the problem
you describe can't happen, since the order choice is alphabetical in the
contents of the patches.  That's not quite true... a token replace patch
could change the alphabetical ordering of two patches.

But even if the two develpers get their conflicts resolved differently, you
still have no problem.  If they both record the conflict resolution, you'll
get a conflict between the two resolutions anyways, whether they are the
same or different.

> Is there a way to deactivate this kind of merge in darcs? Maybe with a
> flag on the command line? Merging identical changes is fine of course.

Well, there's the --no-resolve-conflicts option to apply which disables all
conflict resolution (and marking)...

> David> These are still conflicts, but usually all that is needed to
> David> resolve this sort of conflict is a pull (which results in the
> David> conflict) followed by a whatsnew (to see what darcs did with
> David> it) and a record.
> 
> This is the point where I'm getting lost :)
> 
> Do you mean that if I pull a patch and there is a conflict, darcs will
> leave unrecorded changes in my working directory [...]

Yes.

> [...] and if I record those changes they will automatically be classified
> as a merger patch for the conflicting ones?

No.  A merger patch indicates that a conflict exists, but doesn't indicate
how to resolve that conflict.  The resolution of a conflict is an ordinary
patch, which doesn't commute with the merger patch.  So if I create a patch
(modifying an empty file)

hunk ./filename 1
+bar

and you create a patch

hunk ./filename 1
+baz

When I pull (or apply) your patch, there will obviously be a conflict.  The
recorded version of the file will remain empty, but in my working directory
the file filename will contain:

bar
baz

and darcs whatsnew will show

hunk ./filename 1
+bar
+baz

If I record this change, it will resolve the conflict.  If I don't record
it, the conflict will remain in my repository, and someone else who pulls
both my patch and yours from the repository will see the conflict and have
the opportunity of resolving it.
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list