9906495313b76f06204bdb7408eafa59e9b60b70
[ghc-hetmet.git] / darcs-all
1 #!/bin/sh
2
3 top_dirs="nofib testsuite"
4
5 function darcsall()
6 {
7   for dir in $top_dirs; do
8     if test -d $dir -a -d $dir/_darcs; then
9         echo "== running darcs $* in $dir"
10         (cd $dir && darcs $*)
11     else
12         echo "== $dir not present or not a repository; skipping"
13     fi
14   done
15   cd libraries
16   for repo in `cat default-packages`; do
17     dir=`basename $repo`
18     if test -d $dir; then
19         echo "== running darcs $* in libraries/$dir"
20         (cd $dir && darcs $*)
21     else
22         echo "warning: $dir doesn't seem to exist, use 'darcs-all get' to get it"
23     fi
24   done
25 }
26
27 function darcsget()
28 {
29   case $* in
30     *--partial*) ;;
31     *) echo "warning: adding --partial, to override use --complete"
32   esac
33
34   cd libraries
35   for repo in `cat default-packages`; do
36     if test -d `basename $repo`; then
37         echo "warning: `basename $repo` already present; omitting"
38     else
39         echo "== running darcs get --partial $* $repo"
40         darcs get --partial $* $repo
41     fi
42   done
43 }
44
45 if test ! -d _darcs -o ! -d ghc; then
46   echo "error: darcs-all must be run from the top level of the ghc tree."
47   exit 1;
48 fi
49
50 case $1 in
51   push) darcsall $*;;
52   pull) darcsall $*;;
53   get)  shift; darcsget $*;;
54   *)    echo "syntax: ./darcs-all push|pull"; exit 1;;
55 esac