[darcs-users] Resolving conflicts

Ralph Dratman ralph.dratman at gmail.com
Mon Oct 30 16:46:22 UTC 2006


Eric,

Thanks very much for your thoughtful reply.

I have done several manipulations since the conflict arose, and
unfortunately I did not keep a record of them. Nevertheless I did a
darcs revert and a darcs resolve. The result is this:

v v v v v v v
*************
	/*line-height: 200%;*/
^ ^ ^ ^ ^ ^ ^

As to how these got to be the same on both machines, I don't exactly
remember the details, but my colleague (Judy) and I are new to darcs
and we are learning it by using it. We are the only two developers and
we have just been taking turns pulling from each other's repositories.
On Friday we both edited the same file and wound up with a conflict. I
didn't know how to resolve that systematically (is that in the
documentation?) so I just tried a few things. Anyway, don't worry
about the other repo right now. Let's concentrate on mine. Judy can
always just make a fresh repository and do a get from mine, once I fix
it.

So really, my main focus is: what should I do next time this happens?

Regards,

Ralph

On 10/30/06, Eric Y. Kow <eric.kow at gmail.com> wrote:
> 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.
>
>
> _______________________________________________
> darcs-users mailing list
> darcs-users at darcs.net
> http://www.abridgegame.org/mailman/listinfo/darcs-users
>
>
>
>




More information about the darcs-users mailing list