[darcs-users] add conflict avoidance idea... (need input)

David Roundy droundy at abridgegame.org
Mon Sep 27 10:15:19 UTC 2004


On Sun, Sep 26, 2004 at 05:42:35PM -0400, Andrew Pimlott wrote:
> On Sun, Sep 26, 2004 at 05:37:23AM -0400, David Roundy wrote:
> > I have an idea that would immediately make darcs more effective at
> > resolving conflicts when files are added, but it carries a user
> > interface cost, so I'd like to hear opinions on whether it would be a
> > net improvement.
> > 
> > It is much easier for darcs to handle conflicts in renames than
> > conflicts in creations.  The reason is that by definition if two files
> > are renamed to the same file, they started out with different names,
> > and this breaks symmetry, allowing darcs to decide how to rename one of
> > them to deal with the conflict.
> 
> Can you clarify: is this just a usability thing, or is there a deeper
> issue?  If it usability, I don't see why you can't store the two "evil
> twins" (ClearCase terminology) in temporary files and tell the user to
> resolve them to the correct contents, then darcs add.  IOW, I don't see
> why the current behavior (in which one of the files disappears) is not
> simply a bug.

I think of the current behavior as an unimplemented feature, rather than a
bug... :) There's no reason we couldn't do as you suggest, except that it
can be hard to figure out anything more than the simplest case.  For
example, if two directories are added with the same name, and conflicting
files are added in those conflicting directories, you need to be able to
just rename the conflicting directories, not the conflicting files, but
you've got a whole lot of patches involved in the conflict.

The current code just picks one path through the conflict essentially at
random, and tries that.  It's not ideal, but it also gives a valid answer
to the resolution (that is, one which can be applied) regardless of patch
types involved.

> I personally don't like this hack unless there is a fundamental reason
> it is needed.  I guess I'm curious on the exact reason that renames are
> easier than adds.  Maybe you could walk through the ideal workflow for
> the two cases.

The reason is mostly that this would be a very simple change, which
wouldn't affect the core of how darcs works, which could improve slightly
its behavior when there are conflicts.  I don't want to rewrite the
conflict resolution code at this point, because (a) it would be likely to
introduce bugs, and (b) I plan to rething a lot of how merges and conflicts
are dealt with soon after 1.0.0 is released.

The current situation is that if you have two files created with the same
name, a conflict is flagged, and whatsnew shows the file as being added,
and its content in your working directory is one of the two versions.

With the rename hack, no conflict would be flagged (in the sense that a
"merger" is not created), but one of the two files (determined
alphabetically by original name--with date) will be renamed as
"filename-conflict".  You can then rename at your leisure (or delete one of
the two files).
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list