# HG changeset patch # User Franz Glasner # Date 1580043766 -3600 # Node ID 90bdc5eff028495afe0fcd570ad01a7041e6227d # Parent 0e70a4ba3bd3f382bb3ff58dc63309c3fa9d9dc7 Factor out the environment test into a shell function diff -r 0e70a4ba3bd3 -r 90bdc5eff028 tests/lib-test-timestamps.sh --- a/tests/lib-test-timestamps.sh Sun Jan 26 13:53:00 2020 +0100 +++ b/tests/lib-test-timestamps.sh Sun Jan 26 14:02:46 2020 +0100 @@ -12,12 +12,13 @@ # - # ... do some manual tests # + # -# Prepare a "canonical" repository for testing the timestamps extension +# Check environment # -# prepare_repo REPO SHOW_OUTPUT +# _check_environment # -prepare_repo() { +_check_environment() { if [ -z "$TESTDIR" ]; then echo "TESTDIR is not set" return 1 @@ -37,12 +38,22 @@ echo "HGRCPATH is not set" return 1 else - # Path after changing wd into $1 + # Path after changing wd into the repo in caller's $1 LOCAL_HGRCPATH=".hg/hgrc" fi else LOCAL_HGRCPATH="$HGRCPATH" fi +} + + +# +# Prepare a "canonical" repository for testing the timestamps extension +# +# prepare_repo REPO SHOW_OUTPUT +# +prepare_repo() { + _check_environment || return 1 SHOW_OUTPUT="$2" hg init "$1" cd "$1"