[PATCH V2] tests: stabilize test-patch.t on Windows

Matt Harbison mharbison72 at gmail.com
Mon May 21 21:45:42 EDT 2018


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1526871918 14400
#      Sun May 20 23:05:18 2018 -0400
# Node ID 589535dae225b24312ef6d86a54865314a9acebd
# Parent  6acf41bb8d40c55073e846b81c7466f4b0d390dc
tests: stabilize test-patch.t on Windows

$PYTHON needs to be quoted when invoking with cmd.exe, because the value expands
to c:/Python27/python.exe, which seems to be interpreted as 'c' being a command.
We can't just convert to '\', because there are a few places that run $PYTHON
directly in MSYS.  If unquoted there, it results in c:Python27python.exe being
run.  I wonder if we should bake the quotes into the environment variable to
avoid this.

It also wasn't happy with the quoting around exit1.py:

  c:/Python27/python.exe: can't open file ''$TESTTMP/d/exit1.py'': [Errno 22] Invalid argument

diff --git a/tests/test-patch.t b/tests/test-patch.t
--- a/tests/test-patch.t
+++ b/tests/test-patch.t
@@ -97,7 +97,7 @@ Error exit (issue4746)
   > sys.exit(1)
   > EOF
 
-  $ hg import ../c/p --config ui.patch="$PYTHON '`pwd`/exit1.py'"
+  $ hg import ../c/p --config ui.patch="\"$PYTHON\" \"`pwd`/exit1.py\""
   applying ../c/p
   abort: patch command failed: exited with status 1
   [255]


More information about the Mercurial-devel mailing list