[darcs-users] Why is it a conflict?

Andrew afrayedknot at thefrayedknot.armory.com
Mon Dec 6 21:38:52 UTC 2004


On Mon, Dec 06, 2004 at 02:11:39PM +0100, Stephane Bortzmeyer wrote:
> Here is a trimmed-down version, to make discussion and study easier,
> of the problem mentioned in the thread "Endless loop when pushing", a
> problem which seems without a solution.
> 
> Do note that it is specific to darcs, not to decentralized version
> control systems. To illustrate the point, this one works with arch
> (tla) but not with darcs.
> 
> Method: create a directory in a repository, pull the directory in
> another repository. In one directory, create a file in the directory,
> in the other, delete the directory. It is not a conflict with arch,
> but it is with darcs.
> 

Well I could be wrong, and I have a limited knowledge of patches and
am relatively new to the distributed scm world, but it seems like the
having a conflict is the right thing to do since one developer removed a
directory and the other added a file in that directory independent from
each other. Since the repositories are seperate theres no serialization
of the two operations which would have forced one of the two developers
to fix the problem before they would be allowed to commit.

However on a distributed system, theres two answers:
1) remove the directory and ignore repo2's changes to add baz.sh
2) keep the directory and baz.sh in it and then ignore repo1's change to remove the directory.

Which one is right? And more importantly how is arch/darcs to know?
Theres without any meaning associated with the directory i dont think
you can derive the right answer.

I think on arch it took the change from repo2 and applied at after the
changes on repo1, leaving the bar directory with baz.sh in it, had it
applied the patches in the opposite order, it would have ended up without
the bar directory at all. IMO arch is doing you a disservice by ignoring
the potential for a problem.

Its fairly easy to come up with a hypothetical situation where having
something in the bar/ directory would be bad, and arch silently adds
the directory back when the developer knowingly removed the directory.

A slightly different situation would be, in a file named qux.c there
is a function named foo(), and developer 1 removes the function
on his repository, developer 2 adds a printf to the function on his
repository. When one merges the changes with the other theres probably
going to be a conflict, and there probably should be one since dev 2's
changes dont fit anywhere in dev 1's version of qux.c, and on the other hand
dev 1's changes dont remove dev 2's printf.

-Andrew





More information about the darcs-users mailing list