Patchwork [3,of,4,"] discovery-helper: bail out if destination already exists

login
register
mail settings
Submitter Pierre-Yves David
Date March 10, 2019, 7:19 p.m.
Message ID <849b8fd6ec5613e1f667.1552245553@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/39201/
State Accepted
Headers show

Comments

Pierre-Yves David - March 10, 2019, 7:19 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1552240342 -3600
#      Sun Mar 10 18:52:22 2019 +0100
# Node ID 849b8fd6ec5613e1f667d7ccd1d4d00d77050251
# Parent  a8d7ed79c36e13dd29dc50643005e88c5b1546fb
# EXP-Topic perf-utils
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 849b8fd6ec56
discovery-helper: bail out if destination already exists

Patch

diff --git a/contrib/perf-utils/discovery-helper.sh b/contrib/perf-utils/discovery-helper.sh
--- a/contrib/perf-utils/discovery-helper.sh
+++ b/contrib/perf-utils/discovery-helper.sh
@@ -82,10 +82,14 @@  if [ $doright -eq 1 ]; then
 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 @@  buildone() {
 }
 
 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