# HG changeset patch # User Mads Kiilerich # Date 2012-06-10 12:41:14 # Node ID 5b89700cce3098daafcb7a3c5506d03f6ad0259a # Parent 3f1a153daadb9f1c73b2cb36fff0fcd99907d7a9 tests: consistently use a HGEDITOR pattern that works with msys on windows Removing the need for an executable sh script that can be run from a native windows application enables some tests for running on windows. diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t --- a/tests/test-commit-amend.t +++ b/tests/test-commit-amend.t @@ -1,5 +1,3 @@ - $ "$TESTDIR/hghave" execbit || exit 80 - $ hg init Setup: @@ -127,13 +125,12 @@ Test -u/-d: Open editor with old commit message if a message isn't given otherwise: - $ cat > editor << '__EOF__' + $ cat > editor.sh << '__EOF__' > #!/bin/sh > cat $1 > echo "another precious commit message" > "$1" > __EOF__ - $ chmod +x editor - $ HGEDITOR="'`pwd`'"/editor hg commit --amend -v + $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v amending changeset 2c94e4a5756f copying changeset 2c94e4a5756f to ad120869acf0 no changes, new message @@ -160,7 +157,7 @@ Open editor with old commit message if a Same, but with changes in working dir (different code path): $ echo a >> a - $ HGEDITOR="'`pwd`'"/editor hg commit --amend -v + $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v amending changeset ffb49186f961 another precious commit message @@ -186,7 +183,7 @@ Same, but with changes in working dir (d added 1 changesets with 1 changes to 1 files committed changeset 1:fb6cca43446f - $ rm editor + $ rm editor.sh $ hg log -r . changeset: 1:fb6cca43446f tag: tip diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t --- a/tests/test-patchbomb.t +++ b/tests/test-patchbomb.t @@ -1,5 +1,3 @@ - $ "$TESTDIR/hghave" system-sh || exit 80 - $ echo "[extensions]" >> $HGRCPATH $ echo "patchbomb=" >> $HGRCPATH @@ -141,12 +139,10 @@ .hg/last-email.txt - $ cat > editor << '__EOF__' - > #!/bin/sh + $ cat > editor.sh << '__EOF__' > echo "a precious introductory message" > "$1" > __EOF__ - $ chmod +x editor - $ HGEDITOR="'`pwd`'"/editor hg email -n -t foo -s test -r 0:tip > /dev/null + $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg email -n -t foo -s test -r 0:tip > /dev/null $ cat .hg/last-email.txt a precious introductory message diff --git a/tests/test-record.t b/tests/test-record.t --- a/tests/test-record.t +++ b/tests/test-record.t @@ -1,5 +1,3 @@ - $ "$TESTDIR/hghave" execbit || exit 80 - Set up a repo $ echo "[ui]" >> $HGRCPATH @@ -1031,12 +1029,10 @@ Abort early when a merge is in progress Editing patch - $ cat > editor << '__EOF__' - > #!/bin/sh + $ cat > editor.sh << '__EOF__' > sed -e 7d -e '5s/^-/ /' "$1" > tmp > mv tmp "$1" > __EOF__ - $ chmod +x editor $ cat > editedfile << '__EOF__' > This is the first line > This is the second line @@ -1049,7 +1045,7 @@ Editing patch > This change will be committed > This is the third line > __EOF__ - $ HGEDITOR="'`pwd`'"/editor hg record -d '23 0' -medit-patch-2 < y > e > EOF @@ -1094,13 +1090,11 @@ Removing changes from patch $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp $ mv tmp editedfile $ echo "This line has been added" >> editedfile - $ cat > editor << '__EOF__' - > #!/bin/sh + $ cat > editor.sh << '__EOF__' > sed -e 's/^[-+]/ /' "$1" > tmp > mv tmp "$1" > __EOF__ - $ chmod +x editor - $ HGEDITOR="'`pwd`'"/editor hg record < y > e > EOF @@ -1131,13 +1125,11 @@ Invalid patch $ sed -e '3s/third/second/' -e '2s/will/will not/' -e 1d editedfile > tmp $ mv tmp editedfile $ echo "This line has been added" >> editedfile - $ cat > editor << '__EOF__' - > #!/bin/sh + $ cat > editor.sh << '__EOF__' > sed s/This/That/ "$1" > tmp > mv tmp "$1" > __EOF__ - $ chmod +x editor - $ HGEDITOR="'`pwd`'"/editor hg record < y > e > EOF diff --git a/tests/test-rollback.t b/tests/test-rollback.t --- a/tests/test-rollback.t +++ b/tests/test-rollback.t @@ -110,12 +110,10 @@ rollback by pretxncommit saves commit me same thing, but run $EDITOR - $ cat > editor << '__EOF__' - > #!/bin/sh + $ cat > editor.sh << '__EOF__' > echo "another precious commit message" > "$1" > __EOF__ - $ chmod +x editor - $ HGEDITOR="'`pwd`'"/editor hg --config hooks.pretxncommit=false commit 2>&1 + $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg --config hooks.pretxncommit=false commit 2>&1 transaction abort! rollback completed note: commit message saved in .hg/last-message.txt diff --git a/tests/test-tag.t b/tests/test-tag.t --- a/tests/test-tag.t +++ b/tests/test-tag.t @@ -1,5 +1,3 @@ - $ "$TESTDIR/hghave" system-sh || exit 80 - $ hg init test $ cd test @@ -214,13 +212,11 @@ tag and branch using same name test custom commit messages - $ cat > editor << '__EOF__' - > #!/bin/sh + $ cat > editor.sh << '__EOF__' > echo "custom tag message" > "$1" > echo "second line" >> "$1" > __EOF__ - $ chmod +x editor - $ HGEDITOR="'`pwd`'"/editor hg tag custom-tag -e + $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg tag custom-tag -e $ hg log -l1 --template "{desc}\n" custom tag message second line @@ -235,7 +231,7 @@ local tag with .hgtags modified $ hg st M .hgtags ? .hgtags.orig - ? editor + ? editor.sh $ hg tag --local baz $ hg revert --no-backup .hgtags @@ -305,7 +301,7 @@ commit hook on tag used to be run withou $ hg init repo-tag $ hg init repo-tag-target - $ hg -R repo-tag --config hooks.commit="hg push \"`pwd`/repo-tag-target\"" tag tag + $ hg -R repo-tag --config hooks.commit="\"hg\" push \"`pwd`/repo-tag-target\"" tag tag pushing to $TESTTMP/repo-tag-target searching for changes adding changesets