[darcs-users] Can I express extra dependencies between patches?

Junio C Hamano junkio at cox.net
Sat Mar 19 10:19:33 UTC 2005


Is there a way to specify dependencies between patches, in
addition to what darcs automatically determines based on the
lines they touch?

Cherry-picking in darcs is very easy and it is one of the things
that makes darcs very attractive to me.  However, sometimes it
is *too* easy and burns me.  Here is a situation:

 * I am maintaining two applications, "foo" and "bar".  Their
   sources are in foo.c, and bar.c; they both use common
   services from libfoobar.c.

 * I needed to add a new feature X to "foo".  For this, I needed
   to add a new function "feature_x_support()" to libfoobar.c,
   and call it from foo.c.

 * Later, feature_x_support() turns out to be useful to
   implement feature Y in "bar".  I add call to the function to
   bar.c.

 * My modification to foo.c to implement the feature X in foo is
   complex and not complete.  The changes to bar.c is easy.  My
   customer wants a new release with feature Y but can live
   without feature X for now.

The following would be the way I would work:

 * Use darcs to version control foo.c, bar.c, and libfoobar.c,
   as everybody else on this list does ;-).  Set up main
   repository "stable" and work-in-progress "wip".

 * In "wip", hack away and add feature_x_support() to
   libfoobar.c.  Test to make sure it does not break anything,
   and then record the changes as "add feature_x_support".

 * In "wip", add calls to feature_x_support() to foo.c and keep
   working.  Implementation of feature X would take more time
   and is not complete at this moment.  Not to lose my local
   changes, I might record the changes so far under some name, with
   the understanding that I might amend it later and I would not
   pull it from "stable" in the current form.

 * In "wip", add calls to feature_x_support() to bar.c.  Test to
   make sure it does not break anything, it implements feature Y
   properly, and then record the changes as "implement feature
   Y".

 * In "stable", pull "add feature_x_support" and "implement
   feature Y" from "wip".  Test away and ship the result.

In the final step, darcs allows me to pull "implement feature Y"
without pulling "add feature_x_support", since they do not
textually depend on each other.  It would be nice if I can
somehow express the fact that the "implement feature Y" patch
depends on "add feature_x_support" patch when I record it.





More information about the darcs-users mailing list