tests: adjust hooks for Windows

I'm not sure why these weren't working on Windows.  The failures were generally
in the style of:

  -  remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b:  1 -> 0
  +  remote: "phase-move: $HG_NODE:  $HG_OLDPHASE -> $HG_PHASE"

and

  -  abort: pretxnclose-bookmark.force-forward hook exited with status 1
  -  [255]
  +  abort: pretxnclose-bookmark.force-public hook exited with status 255
  +  [255]

These failures originated in 5625d0ddc285::6e3e88681b23.
This commit is contained in:
Matt Harbison 2017-10-20 23:01:56 -04:00
parent 0aa0daf3f0
commit bd8eaff510
4 changed files with 20 additions and 7 deletions

View File

@ -10,7 +10,10 @@
> evolution.exchange=True
> EOF
$ TESTHOOK='hooks.txnclose-bookmark.test=echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"'
$ cat > $TESTTMP/hook.sh <<'EOF'
> echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"
> EOF
$ TESTHOOK="hooks.txnclose-bookmark.test=sh $TESTTMP/hook.sh"
initialize

View File

@ -2,7 +2,10 @@
$ hg init repo
$ cd repo
$ TESTHOOK='hooks.txnclose-bookmark.test=echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"'
$ cat > $TESTTMP/hook.sh <<'EOF'
> echo "test-hook-bookmark: $HG_BOOKMARK: $HG_OLDNODE -> $HG_NODE"
> EOF
$ TESTHOOK="hooks.txnclose-bookmark.test=sh $TESTTMP/hook.sh"
no bookmarks
@ -1074,8 +1077,8 @@ add hooks:
$ cat << EOF >> .hg/hgrc
> [hooks]
> pretxnclose-bookmark.force-public = (echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z "\$HG_NODE" ] || (hg log -r "\$HG_NODE" -T '{phase}' | grep public > /dev/null)
> pretxnclose-bookmark.force-forward = (echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z "\$HG_NODE" ] || (hg log -r "max(\$HG_OLDNODE::\$HG_NODE)" -T 'MATCH' | grep MATCH > /dev/null)
> pretxnclose-bookmark.force-public = sh -c "(echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z \"\$HG_NODE\" ] || (hg log -r \"\$HG_NODE\" -T '{phase}' | grep public > /dev/null)"
> pretxnclose-bookmark.force-forward = sh -c "(echo \$HG_BOOKMARK| grep -v NEW > /dev/null) || [ -z \"\$HG_NODE\" ] || (hg log -r \"max(\$HG_OLDNODE::\$HG_NODE)\" -T 'MATCH' | grep MATCH > /dev/null)"
> EOF
$ hg log -G -T phases

View File

@ -1,9 +1,12 @@
$ cat > $TESTTMP/hook.sh << 'EOF'
> echo "test-hook-close-phase: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE"
> EOF
$ cat >> $HGRCPATH << EOF
> [extensions]
> phasereport=$TESTDIR/testlib/ext-phase-report.py
> [hooks]
> txnclose-phase.test = echo "test-hook-close-phase: \$HG_NODE: \$HG_OLDPHASE -> \$HG_PHASE"
> txnclose-phase.test = sh $TESTTMP/hook.sh
> EOF
$ hglog() { hg log --template "{rev} {phaseidx} {desc}\n" $*; }
@ -796,7 +799,7 @@ Install a hook that prevent b3325c91a4d9 to become public
$ cat >> .hg/hgrc << EOF
> [hooks]
> pretxnclose-phase.nopublish_D = (echo \$HG_NODE| grep -v b3325c91a4d9>/dev/null) || [ 'public' != \$HG_PHASE ]
> pretxnclose-phase.nopublish_D = sh -c "(echo \$HG_NODE| grep -v b3325c91a4d9>/dev/null) || [ 'public' != \$HG_PHASE ]"
> EOF
Try various actions. only the draft move should succeed

View File

@ -56,12 +56,16 @@ expect authorization error: must have authorized user
expect success
$ cat > $TESTTMP/hook.sh <<'EOF'
> echo "phase-move: $HG_NODE: $HG_OLDPHASE -> $HG_PHASE"
> EOF
$ cat >> .hg/hgrc <<EOF
> allow_push = *
> [hooks]
> changegroup = sh -c "printenv.py changegroup 0"
> pushkey = sh -c "printenv.py pushkey 0"
> txnclose-phase.test = echo "phase-move: \$HG_NODE: \$HG_OLDPHASE -> \$HG_PHASE"
> txnclose-phase.test = sh $TESTTMP/hook.sh
> EOF
$ req
pushing to http://localhost:$HGPORT/