[darcs-users] How to you handle content-related dependencies?

Miles Gould miles at assyrian.org.uk
Mon Jun 6 12:39:47 UTC 2011


On Sat, Jun 4, 2011 at 12:12 PM, Steffen Schuldenzucker
<sschuldenzucker at uni-bonn.de> wrote:
> More traditional DVCSs like mercurial or git

As Stephen points out, "more traditional" isn't the right term here:
darcs pre-dates most of the DAG-based DVCSes :-)

> don't have the problem because
> a changeset depends on all other changesets in the current repository

More precisely, it depends on all previous changesets in the current *branch*.

> How do you solve this issue with darcs?

AIUI, this is a fundamental problem with the darcs model: darcs
under-approximates true patch dependencies since it calculates
dependencies using textual overlap. Git et al over-approximate them,
as you describe, and rely on the user to specify patch *independence*
using branching.

> Do you use tags?

What, tag every patch to force a linear history (at least within
repos)? At that point, you might as well give up on darcs, and use a
system that was designed for that model.

I'm not aware of a standard solution to your problem, but here's a
somewhat hacky possibility:

 - add a prehook to darcs-record that looks through any added hunks
for any references to theorems, citations, etc, and any newly-added
definitions. Store these away somewhere.
 - add a posthook to darcs-record that adds lines of the form

ADDED THEOREM: p!=np
ADDED CITATION: euler1735

to your commit message, then reads out the list of referenced
definitions, invokes `darcs changes` to determine the commit in which
each referenced definition was added, and then calls `darcs
amend-record` to add the newly-found dependencies.

Oh, hang on, amend-record doesn't support --ask-deps. How odd. So that
won't work. Let's try ratcheting up the hackiness.


Instead of using hooks, invoke `darcs record` from within an expect
script (I think we were going to have to use expect anyway, since I
can see no non-interactive way of specifying additional dependencies)
that

1. Calls `darcs whatsnew` to see what's changed.
2. Searches the diff for any new definitions and references to
existing definitions.
3. Calls `darcs changes --matches` to find the patches that added
these definitions.
4. Interacts with `darcs record --ask-deps` to add the additional
dependencies, and adds the "ADDED THEOREM" lines to the bottom of your
commit messages.


Anyone got any better ideas?

Miles


More information about the darcs-users mailing list