test-bookmarks: factor hooks out to a shell script for Windows
The previous incarnation of the hooks weren't being run on Windows, which
altered the DAG and hashes[1].
[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-April/096987.html
--- a/tests/test-bookmarks-pushpull.t Wed Apr 19 17:04:22 2017 -0700
+++ b/tests/test-bookmarks-pushpull.t Tue Apr 25 22:10:26 2017 -0400
@@ -306,6 +306,12 @@
$ hg serve -R pull-race -p $HGPORT -d --pid-file=pull-race.pid -E main-error.log
$ cat pull-race.pid >> $DAEMON_PIDS
+ $ cat <<EOF > $TESTTMP/out_makecommit.sh
+ > #!/bin/sh
+ > hg ci -Am5
+ > echo committed in pull-race
+ > EOF
+
$ hg clone -q http://localhost:$HGPORT/ pull-race2
$ cd pull-race
$ hg up -q Y
@@ -314,7 +320,7 @@
$ echo c5 > f3
$ cat <<EOF > .hg/hgrc
> [hooks]
- > outgoing.makecommit = hg ci -Am5; echo committed in pull-race
+ > outgoing.makecommit = sh $TESTTMP/out_makecommit.sh
> EOF
(new config needs a server restart)
@@ -347,12 +353,21 @@
Update a bookmark right after the initial lookup -B (issue4689)
$ echo c6 > ../pull-race/f3 # to be committed during the race
+ $ cat <<EOF > $TESTTMP/listkeys_makecommit.sh
+ > #!/bin/sh
+ > if hg st | grep -q M; then
+ > hg commit -m race
+ > echo committed in pull-race
+ > else
+ > exit 0
+ > fi
+ > EOF
$ cat <<EOF > ../pull-race/.hg/hgrc
> [hooks]
> # If anything to commit, commit it right after the first key listing used
> # during lookup. This makes the commit appear before the actual getbundle
> # call.
- > listkeys.makecommit= ((hg st | grep -q M) && (hg commit -m race; echo commited in pull-race)) || exit 0
+ > listkeys.makecommit= sh $TESTTMP/listkeys_makecommit.sh
> EOF
(new config need server restart)