Mercurial > hg > vamp-build-and-test
diff SCRIPTS/update-all.sh @ 100:793467b5e61c
Don't use subrepos, they're too fragile. Just use a list of repos and a script instead.
author | Chris Cannam |
---|---|
date | Fri, 04 Sep 2015 12:01:02 +0100 |
parents | 5addbcdc2e87 |
children |
line wrap: on
line diff
--- a/SCRIPTS/update-all.sh Wed Aug 12 16:05:17 2015 +0100 +++ b/SCRIPTS/update-all.sh Fri Sep 04 12:01:02 2015 +0100 @@ -1,14 +1,37 @@ #!/bin/bash +set -eu + # Run this from the top-level vamp-build-and-test directory -cat .hgsub | grep -v '^#' | awk '{ print $1 }' | while read x; do - if [ -d "$x"/.hg ]; then - ( cd $x ; hg pull && hg update ) - elif [ -d "$x"/.git ]; then - ( cd $x ; git pull ) - else - url=$(grep "^$x " .hgsub | awk '{ print $3; }') - hg clone "$url" "$x" - fi -done +failed=/tmp/failed_$$ +rm -f "$failed" +trap "rm -f $failed" 0 + +cat METADATA/repos.txt | grep -v '^#' | awk -F= '{ print $1, $2 }' | + while read name loc; do + if [ -d "$name"/.hg ]; then + ( cd $name ; hg pull && hg update ) || echo "$name" >> "$failed" + elif [ -d "$name"/.git ]; then + ( cd $name ; git pull ) || echo "$name" >> "$failed" + elif [ -d "$name" ]; then + echo "ERROR: Directory \"$name\" exists, but is not a git or hg repo" 1>&2 + exit 1 + else + case "$loc" in + */hg/*) + hg clone "$loc" "$name" || echo "$name" >> "$failed";; + *//git*) + git clone "$loc" "$name" || echo "$name" >> "$failed";; + *) + echo "ERROR: Can't deduce repo type from URL \"$loc\"" 1>&2 + exit 1;; + esac + fi + done + +echo "Done" +if [ -f "$failed" ]; then + echo "Failed repos:" + cat "$failed" +fi