[PATCH] test-hook: use sh when running hg in hooks
Adrian Buehlmann
adrian at cadifra.com
Sun Jun 17 02:49:53 CDT 2012
# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1339917294 -7200
# Node ID a0f221f45f846aea982355840c614d6fced41edb
# Parent 6df859e0a6cd261eb5dea82b4a6b4186a662a650
test-hook: use sh when running hg in hooks
This eliminates the requirement (for this test) to have a hg.exe (on $PATH) when
running on Windows.
diff --git a/tests/test-hook.t b/tests/test-hook.t
--- a/tests/test-hook.t
+++ b/tests/test-hook.t
@@ -8,7 +8,7 @@
> 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"
- > pretxncommit.tip = hg -q tip
+ > pretxncommit.tip = sh -c "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
@@ -129,7 +129,7 @@
pretxncommit hook can see changeset, can roll back txn, changeset no
more there after
- $ echo "pretxncommit.forbid0 = hg tip -q" >> .hg/hgrc
+ $ echo "pretxncommit.forbid0 = sh -c 'hg tip -q'" >> .hg/hgrc
$ echo "pretxncommit.forbid1 = python \"$TESTDIR/printenv.py\" pretxncommit.forbid 1" >> .hg/hgrc
$ echo z > z
$ hg add z
@@ -254,7 +254,7 @@
$ cat > .hg/hgrc <<EOF
> [hooks]
- > pretxnchangegroup.forbid0 = hg tip -q
+ > pretxnchangegroup.forbid0 = sh -c "hg tip -q"
> pretxnchangegroup.forbid1 = python "$TESTDIR/printenv.py" pretxnchangegroup.forbid 1
> EOF
$ hg pull ../a
@@ -555,9 +555,11 @@
commit and update hooks should run after command completion
- $ echo '[hooks]' > .hg/hgrc
- $ echo 'commit = hg id' >> .hg/hgrc
- $ echo 'update = hg id' >> .hg/hgrc
+ $ cat > .hg/hgrc <<EOF
+ > [hooks]
+ > commit = sh -c "hg id"
+ > update = sh -c "hg id"
+ > EOF
$ echo bb > a
$ hg ci -ma
223eafe2750c tip
@@ -603,8 +605,10 @@
$ cd ..
$ hg init to
- $ echo '[hooks]' >> to/.hg/hgrc
- $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc
+ $ cat >> to/.hg/hgrc <<EOF
+ > [hooks]
+ > pretxnchangegroup = sh -c "hg --traceback tip"
+ > EOF
$ echo a >> to/a
$ hg --cwd to ci -Ama
adding a
More information about the Mercurial-devel
mailing list