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

Miles Gould miles at assyrian.org.uk
Mon Jun 6 20:48:48 UTC 2011


On Mon, Jun 6, 2011 at 6:18 PM, Eric Kow <kowey at darcs.net> wrote:
> darcs help patterns

Thanks! That's an excellent piece of documentation, by the way - good
work, whoever wrote it. Oh, and there it is listed in "darcs help".
D'oh.

> Tips on how to make this more discoverable would be much appreciated.
> One possibility is
>
>             --matches=PATTERN       select patches matching PATTERN
>                                     (see `darcs help patterns`)

Yeah, that's exactly what I was hoping for. It might also help to make
"darcs help pattern" and "darcs help match" synonyms for "darcs help
patterns" - I tried both of those, but not the one that would have
worked :-(

By the way, I thought it might be fun to measure the extent of the
"underapproximated dependency" problem with my own thesis, to give
Steffen more of an idea how much he should be worrying. Unfortunately,
it turns out that most revisions of my thesis don't compile under
versions of TeXLive released since 2008! Anyone like to suggest
another repo I should try?

Here's my code, FWIW:

#!/usr/bin/perl

use strict;
use warnings;
use 5.010;

use XML::XPath;

my $upstream = shift @ARGV;
my $make_command = join " ", @ARGV;

my $outfile_name = "deptest.out";

my $change_xml = `darcs changes --repo=$upstream --xml`;
my $xp = XML::XPath->new(xml => $change_xml);
my $change_hashes = $xp->find('changelog/patch/@hash');
my @changes;

foreach my $node ($change_hashes->get_nodelist) {
        my $hash = $node->getData();
        $hash =~ s/\.gz$//;
        push @changes, $hash;
}

foreach my $change (reverse @changes) {
        open my $outfile, ">>", $outfile_name;
        say $outfile $change;
        close $outfile;
        system "darcs pull --match 'hash $change' $upstream";
        system "time -o $outfile_name -a $make_command";
        open $outfile, ">>", $outfile_name;
        say $outfile (($? >> 8) == 0) ? "Succeeded" : "Failed";
        say $outfile "";
        close $outfile;
        system "darcs unpull";
}

To use it with a repo $darcsrepo:

1) Save it somewhere in your PATH (I call it "deptest") and chmod +x it.
2) Install XML::XPath: `cpan XML::XPath`
3) Create a new darcs repository:
    mkdir deptest; cd deptest; darcs init
4) Run deptest [path to repo to test] [build command]; in my case that's
    deptest ../thesis "latexmk thesis"
5) Look through "deptest.out" for timing and success/failure info.
"Failed" in this context ought to mean "has unspecified dependencies",
assuming you haven't recorded any broken patches.

[Step 3 is not automated because of further stupidity specific to my
thesis repo.]

Miles.


More information about the darcs-users mailing list