Mercurial > hgrepos > DevTools > mercurial-extensions
changeset 406:90bdc5eff028
Factor out the environment test into a shell function
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 26 Jan 2020 14:02:46 +0100 |
| parents | 0e70a4ba3bd3 |
| children | 1b4056ee7b48 |
| files | tests/lib-test-timestamps.sh |
| diffstat | 1 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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"
