[PATCH] test-tag: allow commit hook to also work with hg.cmd

Adrian Buehlmann adrian at cadifra.com
Thu Jun 21 10:21:34 CDT 2012


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1340291496 -7200
# Node ID d2295f0fed9fd6d2c83554b65a54078200ad7e7b
# Parent  f8b04734fc337fdfc53cfed414b88c3e68e9c566
test-tag: allow commit hook to also work with hg.cmd

This change allows to also use this test in MSYS on Windows with a hg.cmd file,
instead of a exemaker hg.exe only.

I'm reusing the same strategy as we did in test-hook.t: sh -c "...".

I tried specifying the hook on the command-line with --config, but failed
because we would need three levels of quoting. As a workaround, I've specified
the hook in the hgrc, like we already did in test-hook.t for several cases.

diff --git a/tests/test-tag.t b/tests/test-tag.t
--- a/tests/test-tag.t
+++ b/tests/test-tag.t
@@ -295,13 +295,17 @@
   tip                                2:2a156e8887cc
   t3                                 1:c3adabd1a5f4 local
 
-  $ cd ..
+  $ cd "$TESTTMP"
 
 commit hook on tag used to be run without write lock - issue3344
 
   $ hg init repo-tag
+  $ cat > repo-tag/.hg/hgrc <<EOF
+  > [hooks]
+  > commit = sh -c "hg push \"$TESTTMP/repo-tag-target\""
+  > EOF
   $ hg init repo-tag-target
-  $ hg -R repo-tag --config hooks.commit="\"hg\" push \"`pwd`/repo-tag-target\"" tag tag
+  $ hg -R repo-tag tag tag
   pushing to $TESTTMP/repo-tag-target
   searching for changes
   adding changesets


More information about the Mercurial-devel mailing list