# HG changeset patch # User Pierre-Yves David # Date 2019-03-08 20:38:57 # Node ID 4f283b7dac44be778901bf825f31225270aa42db # Parent 9d4ae5044b4c96bdfb2bbb33fa696908b664a1d7 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. 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 @@ -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 @@ shift 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 @@ leftsubset="ancestors($left, $depth) and 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