-function darcsget()
-{
- case $* in
- *--partial*) ;;
- *) echo "warning: adding --partial, to override use --complete"
- esac
-
- repo_root=`cat _darcs/prefs/defaultrepo`
- case $repo_root in
- /*) lib_repos=$repo_root/libraries;;
- *) lib_repos=$default_lib_repo_root;;
- esac
-
- cd libraries
- for pkg in `cat default-packages`; do
- if test -d $pkg; then
- echo "warning: $pkg already present; omitting"
- else
- repo=$lib_repos/$pkg
- message "== running darcs get --partial $* $repo"
- darcs get --partial $* $repo
- fi
- done
+sub main {
+ if (! -d "_darcs" || ! -d "compiler") {
+ die "error: darcs-all must be run from the top level of the ghc tree."
+ }
+
+ while ($#_ ne -1) {
+ my $arg = shift;
+ # We handle -q here as well as lower down as we need to skip over it
+ # if it comes before the darcs command
+ if ($arg eq "-q") {
+ $verbose = 1;
+ }
+ elsif ($arg eq "-s") {
+ $verbose = 0;
+ }
+ # --dph says we grab the dph libs with 'get'.
+ # It has no effect on the other commands.
+ elsif ($arg eq "--dph") {
+ $tags{"dph"} = 1;
+ }
+ # --extra says we grab the extra libs with 'get'.
+ # It has no effect on the other commands.
+ elsif ($arg eq "--extra") {
+ $tags{"extralibs"} = 1;
+ }
+ # --nofib tells get to also grab the nofib repo.
+ # It has no effect on the other commands.
+ elsif ($arg eq "--nofib") {
+ $tags{"nofib"} = 1;
+ }
+ # --testsuite tells get to also grab the testsuite repo.
+ # It has no effect on the other commands.
+ elsif ($arg eq "--testsuite") {
+ $tags{"testsuite"} = 1;
+ }
+ else {
+ unshift @_, $arg;
+ if (grep /^-q$/, @_) {
+ $verbose = 1;
+ }
+ last;
+ }
+ }
+
+ if ($#_ eq -1) {
+ die "What do you want to do?";
+ }
+ my $command = $_[0];
+ if ($command eq "get") {
+ darcsget @_;
+ }
+ else {
+ if ($command =~ /^(?:w|wh|wha|what|whats|whatsn|whatsne|whatsnew)$/) {
+ # Hack around whatsnew failing if there are no changes
+ $ignore_failure = 1;
+ }
+ darcsall @_;
+ }