tests/test-hook.t
changeset 25478 d19787db6fe0
parent 25446 b5311068077e
child 25501 a99fee62611d
--- a/tests/test-hook.t	Mon Jun 08 17:34:45 2015 -0500
+++ b/tests/test-hook.t	Mon Jun 08 15:10:15 2015 -0500
@@ -17,19 +17,19 @@
   $ cd a
   $ cat > .hg/hgrc <<EOF
   > [hooks]
-  > commit = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" commit"
-  > commit.b = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" commit.b"
-  > precommit = sh -c  "HG_LOCAL= HG_NODE= HG_TAG= python \"$TESTDIR/printenv.py\" precommit"
-  > pretxncommit = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxncommit"
+  > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit"
+  > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b"
+  > precommit = sh -c  "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit"
+  > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit"
   > pretxncommit.tip = hg -q tip
-  > pre-identify = python "$TESTDIR/printenv.py" pre-identify 1
-  > pre-cat = python "$TESTDIR/printenv.py" pre-cat
-  > post-cat = python "$TESTDIR/printenv.py" post-cat
-  > pretxnopen = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnopen"
-  > pretxnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" pretxnclose"
-  > txnclose = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnclose"
+  > pre-identify = printenv.py pre-identify 1
+  > pre-cat = printenv.py pre-cat
+  > post-cat = printenv.py post-cat
+  > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen"
+  > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose"
+  > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose"
   > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs
-  > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= python \"$TESTDIR/printenv.py\" txnabort"
+  > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort"
   > txnclose.checklock = sh -c "hg debuglock > /dev/null"
   > EOF
   $ echo a > a
@@ -53,9 +53,9 @@
 
   $ cat > .hg/hgrc <<EOF
   > [hooks]
-  > prechangegroup = python "$TESTDIR/printenv.py" prechangegroup
-  > changegroup = python "$TESTDIR/printenv.py" changegroup
-  > incoming = python "$TESTDIR/printenv.py" incoming
+  > prechangegroup = printenv.py prechangegroup
+  > changegroup = printenv.py changegroup
+  > incoming = printenv.py incoming
   > EOF
 
 pretxncommit and commit hooks can see both parents of merge
@@ -128,8 +128,8 @@
 
   $ cd ../a
   $ cat >> .hg/hgrc <<EOF
-  > pretag = python "$TESTDIR/printenv.py" pretag
-  > tag = sh -c "HG_PARENT1= HG_PARENT2= python \"$TESTDIR/printenv.py\" tag"
+  > pretag = printenv.py pretag
+  > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag"
   > EOF
   $ hg tag -d '3 0' a
   pretag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
@@ -148,7 +148,7 @@
 
 pretag hook can forbid tagging
 
-  $ echo "pretag.forbid = python \"$TESTDIR/printenv.py\" pretag.forbid 1" >> .hg/hgrc
+  $ echo "pretag.forbid = printenv.py pretag.forbid 1" >> .hg/hgrc
   $ hg tag -d '4 0' fa
   pretag hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
   pretag.forbid hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
@@ -164,7 +164,7 @@
 more there after
 
   $ echo "pretxncommit.forbid0 = hg tip -q" >> .hg/hgrc
-  $ echo "pretxncommit.forbid1 = python \"$TESTDIR/printenv.py\" pretxncommit.forbid 1" >> .hg/hgrc
+  $ echo "pretxncommit.forbid1 = printenv.py pretxncommit.forbid 1" >> .hg/hgrc
   $ echo z > z
   $ hg add z
   $ hg -q tip
@@ -202,7 +202,7 @@
 
 precommit hook can prevent commit
 
-  $ echo "precommit.forbid = python \"$TESTDIR/printenv.py\" precommit.forbid 1" >> .hg/hgrc
+  $ echo "precommit.forbid = printenv.py precommit.forbid 1" >> .hg/hgrc
   $ hg commit -m 'fail' -d '4 0'
   precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
   precommit.forbid hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
@@ -213,14 +213,14 @@
 
 preupdate hook can prevent update
 
-  $ echo "preupdate = python \"$TESTDIR/printenv.py\" preupdate" >> .hg/hgrc
+  $ echo "preupdate = printenv.py preupdate" >> .hg/hgrc
   $ hg update 1
   preupdate hook: HG_PARENT1=ab228980c14d
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
 
 update hook
 
-  $ echo "update = python \"$TESTDIR/printenv.py\" update" >> .hg/hgrc
+  $ echo "update = printenv.py update" >> .hg/hgrc
   $ hg update
   preupdate hook: HG_PARENT1=539e4b31b6dc
   update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc
@@ -228,7 +228,7 @@
 
 pushkey hook
 
-  $ echo "pushkey = python \"$TESTDIR/printenv.py\" pushkey" >> .hg/hgrc
+  $ echo "pushkey = printenv.py pushkey" >> .hg/hgrc
   $ cd ../b
   $ hg bookmark -r null foo
   $ hg push -B foo ../a
@@ -245,7 +245,7 @@
 
 listkeys hook
 
-  $ echo "listkeys = python \"$TESTDIR/printenv.py\" listkeys" >> .hg/hgrc
+  $ echo "listkeys = printenv.py listkeys" >> .hg/hgrc
   $ hg bookmark -r null bar
   $ cd ../b
   $ hg pull -B bar ../a
@@ -259,7 +259,7 @@
 
 test that prepushkey can prevent incoming keys
 
-  $ echo "prepushkey = python \"$TESTDIR/printenv.py\" prepushkey.forbid 1" >> .hg/hgrc
+  $ echo "prepushkey = printenv.py prepushkey.forbid 1" >> .hg/hgrc
   $ cd ../b
   $ hg bookmark -r null baz
   $ hg push -B baz ../a
@@ -280,7 +280,7 @@
 
 test that prelistkeys can prevent listing keys
 
-  $ echo "prelistkeys = python \"$TESTDIR/printenv.py\" prelistkeys.forbid 1" >> .hg/hgrc
+  $ echo "prelistkeys = printenv.py prelistkeys.forbid 1" >> .hg/hgrc
   $ hg bookmark -r null quux
   $ cd ../b
   $ hg pull -B quux ../a
@@ -298,7 +298,7 @@
   3:07f3376c1e65
   $ cat > .hg/hgrc <<EOF
   > [hooks]
-  > prechangegroup.forbid = python "$TESTDIR/printenv.py" prechangegroup.forbid 1
+  > prechangegroup.forbid = printenv.py prechangegroup.forbid 1
   > EOF
   $ hg pull ../a
   pulling from ../a
@@ -313,7 +313,7 @@
   $ cat > .hg/hgrc <<EOF
   > [hooks]
   > pretxnchangegroup.forbid0 = hg tip -q
-  > pretxnchangegroup.forbid1 = python "$TESTDIR/printenv.py" pretxnchangegroup.forbid 1
+  > pretxnchangegroup.forbid1 = printenv.py pretxnchangegroup.forbid 1
   > EOF
   $ hg pull ../a
   pulling from ../a
@@ -336,8 +336,8 @@
   $ rm .hg/hgrc
   $ cat > ../a/.hg/hgrc <<EOF
   > [hooks]
-  > preoutgoing = python "$TESTDIR/printenv.py" preoutgoing
-  > outgoing = python "$TESTDIR/printenv.py" outgoing
+  > preoutgoing = printenv.py preoutgoing
+  > outgoing = printenv.py outgoing
   > EOF
   $ hg pull ../a
   pulling from ../a
@@ -355,7 +355,7 @@
 
 preoutgoing hook can prevent outgoing changes
 
-  $ echo "preoutgoing.forbid = python \"$TESTDIR/printenv.py\" preoutgoing.forbid 1" >> ../a/.hg/hgrc
+  $ echo "preoutgoing.forbid = printenv.py preoutgoing.forbid 1" >> ../a/.hg/hgrc
   $ hg pull ../a
   pulling from ../a
   searching for changes
@@ -369,8 +369,8 @@
   $ cd ..
   $ cat > a/.hg/hgrc <<EOF
   > [hooks]
-  > preoutgoing = python "$TESTDIR/printenv.py" preoutgoing
-  > outgoing = python "$TESTDIR/printenv.py" outgoing
+  > preoutgoing = printenv.py preoutgoing
+  > outgoing = printenv.py outgoing
   > EOF
   $ hg clone a c
   preoutgoing hook: HG_SOURCE=clone
@@ -381,7 +381,7 @@
 
 preoutgoing hook can prevent outgoing changes for local clones
 
-  $ echo "preoutgoing.forbid = python \"$TESTDIR/printenv.py\" preoutgoing.forbid 1" >> a/.hg/hgrc
+  $ echo "preoutgoing.forbid = printenv.py preoutgoing.forbid 1" >> a/.hg/hgrc
   $ hg clone a zzz
   preoutgoing hook: HG_SOURCE=clone
   preoutgoing.forbid hook: HG_SOURCE=clone