Patchwork [5,of,7,STABLE] tests: invoke hg command indirectly from shell script to run on Windows

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Jan. 21, 2015, 3:10 p.m.
Message ID <ef59640c1ab192e862b5.1421853052@juju>
Download mbox | patch
Permalink /patch/7529/
State Accepted
Commit 42f3042cc17f302971b365a0be89f679c4620da7
Headers show

Comments

Katsunori FUJIWARA - Jan. 21, 2015, 3:10 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1421852893 -32400
#      Thu Jan 22 00:08:13 2015 +0900
# Branch stable
# Node ID ef59640c1ab192e862b54b9530c3dc281371caf5
# Parent  4935b1a52e6812c2733a541c9ae907456e23e0f6
tests: invoke hg command indirectly from shell script to run on Windows

Before this patch, test-tag.t can't run successfully on Windows,
because:

  - quoted hg command ('"hg"') prevents "hg.bat" from working correctly
    (only at testing with pure Python build)

    "%~f0" and "%~dp0hg" in "hg.bat" cause unexpected result in this
    case. BTW, quoted "\path\to\hg" works correctly.

  - "`pwd`" in the command line is expanded unexpectedly

    not "C:\path\to\TESTTMP" but "C;C:\path\to\TESTTMP"
Matt Mackall - Jan. 23, 2015, 10:54 p.m.
On Thu, 2015-01-22 at 00:10 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1421852893 -32400
> #      Thu Jan 22 00:08:13 2015 +0900
> # Branch stable
> # Node ID ef59640c1ab192e862b54b9530c3dc281371caf5
> # Parent  4935b1a52e6812c2733a541c9ae907456e23e0f6
> tests: invoke hg command indirectly from shell script to run on Windows

Ok, queued for stable, thanks.

I think we'll need a check-code rule for the "complex command in hook"
problem.

Patch

diff --git a/tests/test-tag.t b/tests/test-tag.t
--- a/tests/test-tag.t
+++ b/tests/test-tag.t
@@ -395,7 +395,10 @@  commit hook on tag used to be run withou
   $ hg -R repo-tag commit -A -m "test"
   adding test
   $ hg init repo-tag-target
-  $ hg -R repo-tag --config hooks.commit="\"hg\" push \"`pwd`/repo-tag-target\"" tag tag
+  $ cat > "$TESTTMP/issue3344.sh" <<EOF
+  > hg push "$TESTTMP/repo-tag-target"
+  > EOF
+  $ hg -R repo-tag --config hooks.commit="sh ../issue3344.sh" tag tag
   pushing to $TESTTMP/repo-tag-target (glob)
   searching for changes
   adding changesets