[darcs-users] -p behaves inconsistently

stephen at xemacs.org stephen at xemacs.org
Sat Nov 4 15:40:09 UTC 2006


Tommy Pettersson writes:

 > (perhaps excessively) abide to the patch algebra rules. I
 > suspect there is a way to trim this to do The right thing,

I doubt it, in general.  The canonical example is the one given in the
Darcs manual (IIRC) where two patches each add one element to an enum
in a way that doesn't conflict, and then add

+ #define ENUM_ELEMENT_COUNT 11

(why they both decided to introduce the count at the same time, I
don't know---some kind of command from the benevolent dictator, I
suppose).  Darcs knows that two *different* patches made changes at a
given place, and that is a conflict, even if it's harmless (in this
case it's not---if both patches assume we started with 10 elements,
after applying both there will be 12 even though they agree there are
only 11 :-).

You could make a special exception for ChangeLogs where this (and
pretty much all other conflicts) are pretty clearly harmless, but I
think it would be better to provide a way to template "darcs changes"
so that it generates any changelog format you like (or the GNU Project
mandates).

This would inevitably result in anomolies where ChangeLog entries get
shuffled, annoying people using diff on the ChangeLogs, but that is
probably easier to work out (especially given the real advantages of
Darcs in daily use).

You could also fix this by adding a language parser, and then consider
each entry in a ChangeLog to be a separate "object".  Then use the
trivial resolver (if changes occur in different objects, they can't
conflict :-), and away we go.  I suspect that this is best done in
combination with your editor of choice, though (doing it with Git[1]
and Emacs should be pretty straightforward).

Steve


Footnotes: 
[1]  OK, I'll go wash my mouth out with soap.





More information about the darcs-users mailing list