[darcs-users] Merging Concepts after getting Public Patches.

Andrew Pimlott andrew at pimlott.net
Sat Oct 2 19:11:49 UTC 2004


On Sat, Oct 02, 2004 at 08:56:05AM -0400, David Roundy wrote:
> On Fri, Oct 01, 2004 at 04:56:13PM -0400, Andrew Pimlott wrote:
> > Oops, I was dead wrong.  I automatically assumed that darcs wouldn't do
> > anything that dumb and somehow leapt to blame to diff3 (even though I
> > remember David talking about how darcs produces conflict markers).  I
> > don't understand why darcs doesn't produce conflict markers in that
> > case.
> 
> Well, the idea is to resolve the conflict if possible.  So if two people
> make the change, the default resolution is just that change.

Right, let me get my thoughts straight:  When I saw that case, I assumed
darcs wouldn't do anything that clever!  What I was really calling
"dumb" was this case I ran across, where the two conflicting patches add
a different line at the same point:

    % mkdir a
    % cd a
    % touch a
    % darcs init                  
    Successfully initialized repository!
    % darcs record -m a -a -l     
    Finished recording patch 'a'
    % darcs get . ../b
    Copying patches...
    .
    Finished getting.
    % echo b > a
    % darcs record -m b -a -l
    Finished recording patch 'b'
    % cd ../b
    % echo c > a             
    % darcs record -m c -a -l
    Finished recording patch 'c'
    % darcs pull ../a

    Sat Oct  2 11:26:01 PDT 2004  andrew at pimlott.net
      * b
    Shall I pull this patch? (1/1) [ynWvxqdjk?] y
    So far so good... finished merging.
    We have conflicts in the following files:
    ./a
    Finished pulling.
    % darcs whatsnew
    {
    hunk ./a 1
    +b
    +c
    }

I don't think that is sensible (if b and c were longer sections of code,
you would want to see which came from which patch, and leaving both
would usually be wrong).  Looking at mangle_unravelled_hunks (which I
didn't understand the first time I looked at it, but suddenly makes
sense), it seems a easy change would be to print conflict markers
whenever nchs is plural.  What does this break?

Andrew

New patches:

[include conflict markers even when hunks are pure additions
andrew at pimlott.net**20041002190454] 
<
> {
hunk ./Patch.lhs 1659
 
 mangle_unravelled_hunks :: [[Patch]] -> Patch
 --mangle_unravelled_hunks [[h1],[h2]] = Deal with simple cases handily?
-mangle_unravelled_hunks pss =
-        if null nchs then bug "mangle_unravelled_hunks"
-                     else FP filename (Hunk l (return old) (return new))
+mangle_unravelled_hunks pss = FP filename (Hunk l (return old) (return new))
     where oldf = get_old (repeat Nothing) pss
           newfs = map (get_hunks_new oldf) pss
           l = get_hunkline $ oldf : newfs
hunk ./Patch.lhs 1666
           nchs = sort $ map (make_chunk l) newfs
           filename = get_a_filename pss
           old = make_chunk l oldf
-          new = if null (make_chunk l oldf)
-                then concat nchs
-                else [top] ++ concat (intersperse [middle] nchs) ++ [bottom]
+          new = case nchs of
+                []      -> bug "mangle_unravelled_hunks"
+                [nch]   -> nch
+                _       -> top : concat (intersperse [middle] nchs) ++ [bottom]
           top    = packString "v v v v v v v"
           middle = packString "*************"
           bottom = packString "^ ^ ^ ^ ^ ^ ^"
}



Context:

[add command-line synopses to the manual
andrew at pimlott.net**20040927193749] 
[put the second argument to get in the help output
andrew at pimlott.net**20040927173422] 
[add X-Mail-Originator header to emails sent by darcs.
David Roundy <droundy at abridgegame.org>**20040924103037] 
[Fix build system's use of $libexecdir
simons at cryp.to**20040923111352] 
[Clarify 'darcs rerecord' dialogue.
jvr+darcs at blub.net**20040916132415
 When looking for a patch, it asks "Shall I rerecord ...".
 When considering changes to add,  it asks "Shall I add ...".
] 
[fix bug when resolving conflicts in presence of pending changes.
David Roundy <droundy at abridgegame.org>**20040923110036] 
[fix resolve to indicate properly when there are no conflicts.
David Roundy <droundy at abridgegame.org>**20040922111123] 
[add conflict resolution fixes to TODO list.
David Roundy <droundy at abridgegame.org>**20040922103907] 
[Check for return value of waitpid in compat.c.
Juliusz Chroboczek <jch at pps.jussieu.fr>**20040920190616
 I seem to be getting EINTR when taking time to edit a long comment.
 Perhaps a stray SIGALRM somewhere?
] 
[Explain how to write a long comment
Erik Schnetter <schnetter at aei.mpg.de>**20040920123144
 Put an explanation of how to write a long comment into the file that
 that user is given when he should write a long comment.
] 
[Add missing label darcsssh
Erik Schnetter <schnetter at aei.mpg.de>**20040919125052] 
[Fix typo in documentation
Erik Schnetter <schnetter at aei.mpg.de>**20040919130351] 
[fix missing negative in warning message...
David Roundy <droundy at abridgegame.org>**20040919114315] 
[rename cgi patch summary link to detail
Will <will at glozer.net>**20040918184656] 
[add new cgi diff command to produce unified diff
Will <will at glozer.net>**20040918184535] 
[notify when there are conflicts on push.
David Roundy <droundy at abridgegame.org>**20040918155459] 
[add 'a' key to say yes to all remaining changes.
David Roundy <droundy at abridgegame.org>**20040918153536] 
[automatically generate AUTHORS file from repo history.
David Roundy <droundy at abridgegame.org>**20040918124430] 
[infix liftM in Add.
David Roundy <droundy at abridgegame.org>**20040917110916] 
[support add -r .
David Roundy <droundy at abridgegame.org>**20040917110830] 
[make pull --quiet actually quiet.
David Roundy <droundy at abridgegame.org>**20040916112354] 
[Minor tweak to hashing of current time in atomic_create.
Juliusz Chroboczek <jch at pps.jussieu.fr>**20040915204756] 
[make doc state ghc 6.2 is required
Tommy Pettersson <ptp at lysator.liu.se>**20040911224201] 
[fix some typos in the doc
Tommy Pettersson <ptp at lysator.liu.se>**20040911224008] 
[add information about global author file to doc
Tommy Pettersson <ptp at lysator.liu.se>**20040911223819] 
[clarify on defualts files in the doc
Tommy Pettersson <ptp at lysator.liu.se>**20040911223709] 
[fix bugs in whatsnew -ls.
David Roundy <droundy at abridgegame.org>**20040915104952] 
[fix bug in darcs --commands when called outside a repo.
David Roundy <droundy at abridgegame.org>**20040915103734] 
[add date and configure options to --exact-version output.
David Roundy <droundy at abridgegame.org>**20040915102158] 
[mention in docs that optimize --checkpoint won't work with partial repositories.
David Roundy <droundy at abridgegame.org>**20040914101937] 
[fix warning in Depends.
David Roundy <droundy at abridgegame.org>**20040914101748] 
[better error message in get_extra.
David Roundy <droundy at abridgegame.org>**20040914101722] 
[.orig files produced by eg patch are boring
andrew at pimlott.net**20040913211945] 
[boring documentation
andrew at pimlott.net**20040913211911] 
[TAG 1.0.0rc2
David Roundy <droundy at abridgegame.org>**20040912105611] 

Patch bundle hash:
2a3dac6c172e51f6f81f6eba69d9fdaa711ef8b3





More information about the darcs-users mailing list