-darcsall()
-{
- message "== running darcs $* at the top level"
- darcs $*
- for dir in $top_dirs; do
- if test -d $dir -a -d $dir/_darcs; then
- message "== running darcs $* in $dir"
- darcs $* --repodir $dir
- else
- message "== $dir not present or not a repository; skipping"
- fi
- done
- for pkg in `cat libraries/core-packages libraries/extra-packages`; do
- if test -d libraries/$pkg; then
- message "== running darcs $* in libraries/$pkg"
- darcs $* --repodir libraries/$pkg
- else
- echo "warning: $pkg doesn't seem to exist, use 'darcs-all get' to get it"
- fi
- done
+sub darcsall {
+ my $localpath;
+ my $path;
+ my $tag;
+
+ darcs @_;
+
+ open IN, "< packages" or die "Can't open packages file";
+ while (<IN>) {
+ chomp;
+ if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+)/) {
+ $localpath = $1;
+ $tag = defined($2) ? $2 : "";
+
+ if (-d "$localpath/_darcs") {
+ darcs (@_, "--repodir", $localpath);
+ }
+ elsif ($tag eq "") {
+ message "== Required repo $localpath is missing! Skipping";
+ }
+ else {
+ message "== $localpath repo not present; skipping";
+ }
+ }
+ elsif (! /^$/) {
+ die "Bad line: $_";
+ }
+ }
+ close IN;
+}
+
+sub darcsget {
+ my $r_flags;
+ my $localpath;
+ my $remotepath;
+ my $path;
+ my $tag;
+
+ if (! grep /(?:--complete|--partial)/, @_) {
+ warning("adding --partial, to override use --complete");
+ $r_flags = [@_, "--partial"];
+ }
+ else {
+ $r_flags = \@_;
+ }
+
+ open IN, "< packages" or die "Can't open packages file";
+ while (<IN>) {
+ chomp;
+ if (/^([^ ]+) +(?:([^ ]+) +)?([^ ]+)/) {
+ $localpath = $1;
+ $tag = defined($2) ? $2 : "";
+ $remotepath = $3;
+
+ if ($checked_out_tree) {
+ $path = "$defaultrepo_base/$localpath";
+ }
+ else {
+ $path = "$defaultrepo_base/$remotepath";
+ }
+
+ if (($tag eq "") || defined($tags{$tag})) {
+ if (-d $localpath) {
+ warning("$localpath already present; omitting");
+ }
+ else {
+ darcs (@$r_flags, $path, $localpath);
+ }
+ }
+ }
+ elsif (! /^$/) {
+ die "Bad line: $_";
+ }
+ }
+ close IN;