changeset 41931:cb6c9d41a23e

discovery-helper: move repository creation in a function This makes it easier to update this duplicated code. (we do a small output fix as we go)
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sun, 10 Mar 2019 18:50:38 +0100
parents 4f283b7dac44
children a60e9f163595
files contrib/perf-utils/discovery-helper.sh
diffstat 1 files changed, 13 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf-utils/discovery-helper.sh	Fri Mar 08 21:38:57 2019 +0100
+++ b/contrib/perf-utils/discovery-helper.sh	Sun Mar 10 18:50:38 2019 +0100
@@ -81,18 +81,21 @@
     echo '# right revset:' '"'${rightsubset}'"'
 fi
 
-if [ $doleft -eq 1 ]; then
-    echo '### building left repository:' $left-repo
+buildone() {
+    side=$1
+    dest=$2
+    revset=$3
+    echo "### building $side repository: $dest"
     echo '# cloning'
-    hg clone --noupdate "${repo}" "${leftrepo}"
-    echo '# stripping' '"'${leftsubset}'"'
-    hg -R "${leftrepo}" --config extensions.strip= strip --rev "$leftsubset" --no-backup
+    hg clone --noupdate "${repo}" "${dest}"
+    echo '# stripping' '"'${revset}'"'
+    hg -R "${dest}" --config extensions.strip= strip --rev "$revset" --no-backup
+}
+
+if [ $doleft -eq 1 ]; then
+    buildone left $leftrepo $leftsubset
 fi
 
 if [ $doright -eq 1 ]; then
-    echo '### building right repository:' $right-repo
-    echo '# cloning'
-    hg clone --noupdate "${repo}" "${rightrepo}"
-    echo '# stripping:' '"'${rightsubset}'"'
-    hg -R "${rightrepo}" --config extensions.strip= strip --rev "$rightsubset" --no-backup
+    buildone right $rightrepo $rightsubset
 fi