[PATCH STABLE] test-bookmarks: factor hooks out to a shell script for Windows

Matt Harbison mharbison72 at gmail.com
Wed Apr 26 02:34:00 UTC 2017


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1493172626 14400
#      Tue Apr 25 22:10:26 2017 -0400
# Branch stable
# Node ID 493b1e7c6299055e7240e704548677797de35be7
# Parent  dc1d4df47b5ba0f908f91cf6a4b7e7cf73f40884
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

diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -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)


More information about the Mercurial-devel mailing list