2009-07-07 14:02:09 +04:00
|
|
|
source $stdenv/setup
|
|
|
|
|
|
|
|
set -x
|
|
|
|
|
2009-08-03 10:04:28 +04:00
|
|
|
if ! [ -f "$cacheDB" ]; then
|
|
|
|
echo "Creating cache DB $cacheDB"
|
|
|
|
mtn --db "$cacheDB" db init
|
|
|
|
fi
|
|
|
|
|
2009-07-07 14:02:09 +04:00
|
|
|
header "getting revision $selector";
|
|
|
|
|
|
|
|
done=;
|
|
|
|
for source in $dbs; do
|
2009-11-09 01:30:38 +03:00
|
|
|
if mtn pull --db "$cacheDB" "$source" "${branch}"; then
|
2009-07-07 14:02:09 +04:00
|
|
|
revision="$(mtn --db "$cacheDB" au toposort $(mtn --db "$cacheDB" au select "$selector") | tail -1)";
|
|
|
|
if [ -n "$revision" ]; then
|
|
|
|
if mtn --db "$cacheDB" au get_revision "$revision"; then
|
|
|
|
echo "found revision $revision"
|
|
|
|
done=1;
|
|
|
|
else
|
|
|
|
echo "revision $revision does not exist";
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "selector $selector does not match any revision";
|
|
|
|
fi
|
|
|
|
else
|
2013-08-11 14:47:09 +04:00
|
|
|
echo "pulling branch $branch wasn't successful";
|
2009-07-07 14:02:09 +04:00
|
|
|
fi;
|
|
|
|
if test -n "$done"; then
|
|
|
|
break;
|
|
|
|
fi;
|
|
|
|
done;
|
|
|
|
|
|
|
|
stopNest;
|
|
|
|
|
|
|
|
header "checking out the revision $revision";
|
|
|
|
|
|
|
|
if test -n "$done"; then
|
|
|
|
mtn checkout --db "$cacheDB" -r "$revision" "$out" -b "${branch}"
|
|
|
|
else
|
|
|
|
echo "Needed revision still not found. Exiting";
|
|
|
|
exit 1;
|
|
|
|
fi;
|
|
|
|
|
|
|
|
stopNest
|
|
|
|
|
2009-11-09 01:12:14 +03:00
|
|
|
header "clearing _MTN in the output"
|
|
|
|
|
|
|
|
rm -rf "$out/_MTN"
|
|
|
|
|
|
|
|
stopNest
|