changeset 41925:4f283b7dac44

discovery-helper: add an extra argument to generate only one repo This is useful to generate left and right in parallel when dealing with very large repositories.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 08 Mar 2019 21:38:57 +0100
parents 9d4ae5044b4c
children cb6c9d41a23e
files contrib/perf-utils/discovery-helper.sh
diffstat 1 files changed, 44 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/perf-utils/discovery-helper.sh	Fri Mar 08 10:29:48 2019 -0800
+++ b/contrib/perf-utils/discovery-helper.sh	Fri Mar 08 21:38:57 2019 +0100
@@ -28,9 +28,13 @@
 
 set -euo pipefail
 
+printusage () {
+     echo "usage: `basename $0` REPO NBHEADS DEPTH [left|right]" >&2
+}
+
 if [ $# -lt 3 ]; then
-     echo "usage: `basename $0` REPO NBHEADS DEPTH"
-     exit 64
+    printusage
+    exit 64
 fi
 
 repo="$1"
@@ -42,6 +46,24 @@
 depth="$1"
 shift
 
+doleft=1
+doright=1
+if [ $# -gt 1 ]; then
+    printusage
+    exit 64
+elif [ $# -eq 1 ]; then
+    if [ "$1" == "left" ]; then
+        doleft=1
+        doright=0
+    elif [ "$1" == "right" ]; then
+        doleft=0
+        doright=1
+    else
+        printusage
+        exit 64
+    fi
+fi
+
 leftrepo="${repo}-${nbheads}h-${depth}d-left"
 rightrepo="${repo}-${nbheads}h-${depth}d-right"
 
@@ -52,17 +74,25 @@
 rightsubset="ancestors($right, $depth) and only($right, heads(all() - $right))"
 
 echo '### creating left/right repositories with missing changesets:'
-echo '# left  revset:' '"'${leftsubset}'"'
-echo '# right revset:' '"'${rightsubset}'"'
+if [ $doleft -eq 1 ]; then
+    echo '# left  revset:' '"'${leftsubset}'"'
+fi
+if [ $doright -eq 1 ]; then
+    echo '# right revset:' '"'${rightsubset}'"'
+fi
 
-echo '### building left repository:' $left-repo
-echo '# cloning'
-hg clone --noupdate "${repo}" "${leftrepo}"
-echo '# stripping' '"'${leftsubset}'"'
-hg -R "${leftrepo}" --config extensions.strip= strip --rev "$leftsubset" --no-backup
+if [ $doleft -eq 1 ]; then
+    echo '### building left repository:' $left-repo
+    echo '# cloning'
+    hg clone --noupdate "${repo}" "${leftrepo}"
+    echo '# stripping' '"'${leftsubset}'"'
+    hg -R "${leftrepo}" --config extensions.strip= strip --rev "$leftsubset" --no-backup
+fi
 
-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
+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
+fi