[darcs-users] Re: [Haskell-cafe] fptools in darcs now available

zooko at zooko.com zooko at zooko.com
Fri Apr 29 10:17:07 EDT 2005


> Also, I think it's easier to split a darcs repo than it is to join them.

...

> >   1. Make it possible to 'darcs get' just part of a tree.  Patches
> >      that don't touch any files in the "live" parts of the tree
> >      are discarded.  (I don't know if this is possible, or how
> >      difficult it is).
> 
> That's an interesting question.  It's not a darcs feature now, but I
> also don't know how hard it is.

You can currently do something like "darcs changes somepath" to get a list
of patches that touched that file or directory.  You can then do "darcs pull
-ppatchname" for each of those patches.  Of course, you can write a shell
script to do that second step for each patch.  I've done things like this many
times.

This is an example of what you call "splitting a repo", I guess.  It isn't
that hard.

"Joining a repo" is decidedly easier: "mkdir newjoinedthing ; cd
newjoinedthing ; darcs init ; darcs pull -a $firstrepo ; darcs pull -a
$secondrepo".

The only tricky part is "doppleganger patches".  Basically at this point if
you get "doppleganger patches" then you should manually intervene, figure out
what the conflict is, manually fix it, and then resume.  It's a big problem,
because the "manual fix" probably makes it impossible to use any darcs patches
which depend on (at least one of) the conflicting patches.  You would, if you
got into that kind of a fix, probably have to write a shell script (or a
Haskell program, if you like) to run "darcs diff -u -p$patchname | ( cd
newreconstructedrepo ; patch -p0 ; darcs record --all -m$patchname )" for
every patch that depended on the doppleganger patches.

However, avoiding doppleganger conflicts is simple: never make any identical
change more than once to any darcs repo.  For example, suppose you wanted to
add a new subdirectory named "happy".  You could go to one darcs repo and do
"mkdir happy ; darcs add happy ; darcs record --all -mcreatehappydir".  Now
you could go to another darcs repo and do "mkdir happy ; darcs add happy ;
darcs record --all -mcreatehappydir".  Whoops!  You just created doppleganger
patches!  If you ever pull from one of those repos into the other, darcs will
take something like O(2^n) time where n is the number of patches that depend
on the "createhappydir" patches.

The solution is simply that when you want to create a "happy" dir in the other
darcs repo, you cd into that repo and run "darcs pull -pcreatehappydir".  Now
you have a happy dir in both of the repos, and you don't have any doppleganger
patches.

The same caution applies to adding files, changing files (such as with "patch
-p0 < newfeature.diff"), etc.  You must do such things only once, in one repo,
and then pull the change through darcs into any other repo that wants the
change.

As long as you avoid doppleganger patches, then you guys are worrying about
this too much.  Darcs will make it relatively easy for you to do it this way,
do it that way, or change your mind halfway through and move everything around
again.  It isn't like CVS, where you have to agonize about putting everything
in the right place and the start and then live with it for years or undergo
painful transitions.

Regards,

Zooko



More information about the Haskell-Cafe mailing list