changeset 41927:a60e9f163595

discovery-helper: bail out if destination already exists
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 10 Mar 2019 18:52:22 +0100
parents cb6c9d41a23e
children cae3f7e37623
files contrib/perf-utils/discovery-helper.sh
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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