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.
This commit is contained in:
Mads Kiilerich 2012-06-10 14:41:14 +02:00
parent 2ff5fe8552
commit d733986c74
5 changed files with 18 additions and 39 deletions

View File

@ -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 message isn't given otherwise:
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 (different code path):
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

View File

@ -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

View File

@ -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 <<EOF
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record -d '23 0' -medit-patch-2 <<EOF
> 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 <<EOF
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF
> 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 <<EOF
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg record <<EOF
> y
> e
> EOF

View File

@ -110,12 +110,10 @@ rollback by pretxncommit saves commit message (issue 1635)
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

View File

@ -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 without write lock - issue3344
$ 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