discovery-helper: bail out if destination already exists
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 10 Mar 2019 18:52:22 +0100
changeset 41927 a60e9f163595
parent 41926 cb6c9d41a23e
child 41928 cae3f7e37623
discovery-helper: bail out if destination already exists
contrib/perf-utils/discovery-helper.sh
--- a/contrib/perf-utils/discovery-helper.sh	Sun Mar 10 18:50:38 2019 +0100
+++ b/contrib/perf-utils/discovery-helper.sh	Sun Mar 10 18:52:22 2019 +0100
@@ -82,10 +82,14 @@
 fi
 
 buildone() {
-    side=$1
-    dest=$2
-    revset=$3
+    side="$1"
+    dest="$2"
+    revset="$3"
     echo "### building $side repository: $dest"
+    if [ -e "$dest" ]; then
+        echo "destination repo already exists: $dest" >&2
+        exit 1
+    fi
     echo '# cloning'
     hg clone --noupdate "${repo}" "${dest}"
     echo '# stripping' '"'${revset}'"'
@@ -93,9 +97,9 @@
 }
 
 if [ $doleft -eq 1 ]; then
-    buildone left $leftrepo $leftsubset
+    buildone left "$leftrepo" "$leftsubset"
 fi
 
 if [ $doright -eq 1 ]; then
-    buildone right $rightrepo $rightsubset
+    buildone right "$rightrepo" "$rightsubset"
 fi