Mercurial > hgrepos > DevTools > mercurial-extensions
changeset 263:17df665bb309
FIX: The shell's "source" does not accept params: pack into a function and prepare for a "SHOW_OUTPUT" flag
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Fri, 04 Jan 2019 10:46:22 +0100 |
| parents | 71d8d1200e19 |
| children | f28288fb52a3 |
| files | tests/setup-timestamps.sh tests/test-timestamps.t |
| diffstat | 2 files changed, 27 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/setup-timestamps.sh Fri Jan 04 00:56:03 2019 +0100 +++ b/tests/setup-timestamps.sh Fri Jan 04 10:46:22 2019 +0100 @@ -1,30 +1,35 @@ #!/bin/sh + # # Prepare a "canonical" repository for testing the timestamps extension # - -hg init "$1" -cd "$1" -cat >.hgtimestamps <<EOF +# prepare_repo REPO SHOW_OUTPUT +# +prepare_repo() { + SHOW_OUTPUT="$2" + hg init "$1" + cd "$1" + cat >.hgtimestamps <<EOF [patterns] files/** = EOF -cat >>$HGRCPATH <<EOF + cat >>$HGRCPATH <<EOF [extensions] timestamps=$TESTDIR/../extensions/timestamps.py EOF -hg add .hgtimestamps -hg ci -m 'Activate timestamps' -echo Check that .hgtimestamps.db is created and included automatically -hg manifest -# tracked directory -mkdir files -touch -d 2017-12-01T01:02:03Z files/test1.txt -hg add files/test1.txt -# untracked directory -mkdir untracked-directory -touch -d 2017-12-01T01:02:03 untracked-directory/untracked.txt -hg add untracked-directory/untracked.txt -hg ci -m 'Add a tracked and untracked file' -echo Check the content of .hgtimestamps.db -cat .hgtimestamps.db + hg add .hgtimestamps + hg ci -m 'Activate timestamps' + if [ "$SHOW_OUTPUT" = "1" ]; then echo Check that .hgtimestamps.db is created and included automatically; fi + if [ "$SHOW_OUTPUT" = "1" ]; then hg manifest; fi + # tracked directory + mkdir files + touch -d 2017-12-01T01:02:03Z files/test1.txt + hg add files/test1.txt + # untracked directory + mkdir untracked-directory + touch -d 2017-12-01T01:02:03Z untracked-directory/untracked.txt + hg add untracked-directory/untracked.txt + hg ci -m 'Add a tracked and untracked file' + if [ "$SHOW_OUTPUT" = "1" ]; then echo Check the content of .hgtimestamps.db; fi + if [ "$SHOW_OUTPUT" = "1" ]; then cat .hgtimestamps.db; fi +}
--- a/tests/test-timestamps.t Fri Jan 04 00:56:03 2019 +0100 +++ b/tests/test-timestamps.t Fri Jan 04 10:46:22 2019 +0100 @@ -1,6 +1,7 @@ Setup - $ . $TESTDIR/setup-timestamps.sh ts1 + $ . $TESTDIR/setup-timestamps.sh + $ prepare_repo "ts1" "1" Check that .hgtimestamps.db is created and included automatically .hgtimestamps .hgtimestamps.db
