[darcs-users] How to develop on a (GHC) branch with darcs

Stephen J. Turnbull stephen at xemacs.org
Tue Dec 7 15:16:47 UTC 2010

Ganesh Sittampalam writes:

 > I think there are three things that can help with this problem:
 > 1) a darcs rebase command. This will give you a nice way to manage the 
 > workflow already discussed, and you won't have to squish everything 
 > through into a mega-patch. You'll still have to periodically abandon one 
 > branch for another though (but I think that's also the case with git 
 > rebase).

I'm not sure what you mean by "abandon".

In a git rebase, you pretty much have to forget the original branch
immediately (everywhere in the world!), or there will be great fun for
all concerned.  You really really do not want to merge an original
branch with its rebased descendant in git.[1]  Unfortunately, unless
the rebased branch gets dibs on the branch's name, it's all too easy
to perform such a merge inadvertantly (eg, git pull will do it).  So
in that sense a git rebase means immediately abandoning the old branch,
and all the commit history of the old branch.  (The details of the
history are copied into the rebased commits, but they do not have the
same identity as the originals, so merge conflicts are guaranteed.)

 > I also have some hope, though this is more speculative, of offering
 > a clean way of tracking the relationship between the old branch and
 > the new branch so that any stray patches against the old branch can
 > be cleanly rebased to the new branch later on.

As explained above, DAG-based VCSes like git can't do this cleanly
(that is one way of expressing the reason why rebase is severely
deprecated in some circles), and I don't think git will be able to do
so in the near future.  OTOH, if Darcs gets rebase but can't handle
this, I'd have to count that as a net minus.  Recombinant patching is
really what Darcs is all about IMO.

In practice, git rebase needs to be kept private to a single user, and
is impractical even if private, if the user has propagated the branch
to other local repositories.  Because git branching is so lightweight,
nobody really sees this as a big problem; throwaway branches are used
all the time as interim steps in many operations (eg, git stash).
Darcs branches, on the other hand, are much more heavyweight (modulo
the work you propose on colocated branches, but that's farther away
than rebase is).

IMHO YMMV.  But I strongly recommend you think carefully about this.
Analogies to git rebase are a trap here.  It's implemented differently
and used to solve different problems from the way rebase is proposed
for use in Darcs.

[1]  There may be better ways to deal with this than garbaging the
original commits, but so far nobody really needs it.

More information about the darcs-users mailing list