[PATCH 2 of 4 "] discovery-helper: move repository creation in a function

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun Mar 10 15:19:12 EDT 2019


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at octobus.net>
# Date 1552240238 -3600
#      Sun Mar 10 18:50:38 2019 +0100
# Node ID a8d7ed79c36e13dd29dc50643005e88c5b1546fb
# Parent  acc5042401309c9daaa1fd08b947c5432901199b
# EXP-Topic perf-utils
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r a8d7ed79c36e
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)

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
@@ -81,18 +81,21 @@ if [ $doright -eq 1 ]; then
     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


More information about the Mercurial-devel mailing list