[darcs-users] Resolving conflicts

Eric Y. Kow eric.kow at gmail.com
Mon Oct 30 05:55:27 UTC 2006


Hi,

> DREAMHOST Sun Oct 29 15:06:18 ~/sonshine>darcs whatsnew
> {
> hunk ./app/webroot/css/sonshine-styles.css 32
> -       line-height: 200%;
> }

I don't think I understand how you have this result on both machines.
Did you do the same manipulations on both machines?

> What should I do? I've tried various manipulations, but everything
> keeps coming back to this same situation. I'm now pretty well
> confused.

In any case, if you don't have any unrecorded changes you can work
your way back to square one (the conflict) by doing

darcs revert
darcs resolve

(*) darcs resolve is very unfortunately named; we plan to rename
    it mark-conflicts one day

This gets you back to an unmanipulated state... now if you do this
I'd be interested to see what your darcs whatsnew output looks like.

My guess is that it looks something like this

{
hunk ./app/webroot/css/sonshine-styles.css 32
-       line-height: 200%;
+ v v v v v v v 
+ ^ ^ ^ ^ ^ ^ ^
}

My next guess is that you then edited the file by hand and removed the
conflict markers (good), and now you are suprised by why there would be
something new. Do I understand the problem correctly?  If so, you can do
the same thing (remove the conflict markers), then do a darcs record
(likely calling the patch something like 'resolve conflict').

Two things to know about darcs
==============================
The rest of this is me trying to help you build up your mental model of
darcs.  It might be useful for dealing with future conflicts.

1. Two patches that do the same thing are considered conflicting.
2. When you have a conflict, the two patches officially cancel out.
   [ it remembers both patches, so no information is lost ]

For example, if patch A and B both remove line-height: 200% from the
same CSS file, there is a conflict in that file.  What darcs remembers
is that line-height is untouched.  You really did want to remove that
line-height, so now you have to go in an introduce a third patch to
remove it all over again.

Darcs helps you to build this third patch by inserting both versions of
what happened, plus some conflict markers into the working directory.
Whatsnew looks like this:
v v v v v v v
one version of things
-------------
another version of things
^ ^ ^ ^ ^ ^ ^

So introducing the third patch usually just means removing the conflict
markers and the version you don't like.

So wait, what happens when patches conflict when they do the same thing?
How does darcs put conflict markers?  Well, it could do something like
this:
v v v v v v v
same version of things
-------------
same version of things
^ ^ ^ ^ ^ ^ ^

But that would be redundant, so instead, it does something like this:

v v v v v v v
same version of things
^ ^ ^ ^ ^ ^ ^

Consequently, if the conflicting patches both consist of removing the
same line, the conflict markers look like this:

v v v v v v v
^ ^ ^ ^ ^ ^ ^

which is what your css file probably looked like when you first
opened it in a text editor.

Does this help?

-- 
Eric Kow                     http://www.loria.fr/~kow
PGP Key ID: 08AC04F9         Merci de corriger mon français.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://lists.osuosl.org/pipermail/darcs-users/attachments/20061030/85d43591/attachment.pgp 


More information about the darcs-users mailing list