# HG changeset patch # User Pierre-Yves David # Date 2019-03-10 17:50:38 # Node ID cb6c9d41a23e641e2a362401677577e9b2f8be51 # Parent 4f283b7dac44be778901bf825f31225270aa42db 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