To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / SCRIPTS / update.sh @ 126:828f0de6b2fb
History | View | Annotate | Download (1.15 KB)
| 1 |
#!/bin/bash |
|---|---|
| 2 |
|
| 3 |
# Run this from the top-level vamp-build-and-test directory |
| 4 |
# Optional argument for the single repo to checkout; default is all of them |
| 5 |
|
| 6 |
single="" |
| 7 |
if [ -n "$1" ]; then |
| 8 |
single="$1" |
| 9 |
fi |
| 10 |
|
| 11 |
set -eu |
| 12 |
|
| 13 |
failed=/tmp/failed_$$ |
| 14 |
rm -f "$failed" |
| 15 |
trap "rm -f $failed" 0 |
| 16 |
|
| 17 |
cat METADATA/repos.txt | grep -v '^#' | awk -F= '{ print $1, $2 }' |
|
| 18 |
while read name loc; do |
| 19 |
if [ -n "$single" ]; then |
| 20 |
if [ "$single" != "$name" ]; then |
| 21 |
continue |
| 22 |
fi |
| 23 |
fi |
| 24 |
if [ -d "$name"/.hg ]; then |
| 25 |
( cd $name ; hg pull && hg update ) || echo "$name" >> "$failed" |
| 26 |
elif [ -d "$name"/.git ]; then |
| 27 |
( cd $name ; git pull ) || echo "$name" >> "$failed" |
| 28 |
elif [ -d "$name" ]; then |
| 29 |
echo "ERROR: Directory \"$name\" exists, but is not a git or hg repo" 1>&2 |
| 30 |
exit 1 |
| 31 |
else |
| 32 |
case "$loc" in |
| 33 |
*/hg/*) |
| 34 |
hg clone "$loc" "$name" || echo "$name" >> "$failed";; |
| 35 |
*//git*) |
| 36 |
git clone "$loc" "$name" || echo "$name" >> "$failed";; |
| 37 |
*) |
| 38 |
echo "ERROR: Can't deduce repo type from URL \"$loc\"" 1>&2 |
| 39 |
exit 1;; |
| 40 |
esac |
| 41 |
fi |
| 42 |
done |
| 43 |
|
| 44 |
echo "Done" |
| 45 |
if [ -f "$failed" ]; then |
| 46 |
echo "Failed repos:" |
| 47 |
cat "$failed" |
| 48 |
fi |