diff tests/test-extdiff.t @ 23969:01e5b7323a48 stable

extdiff: reintroduce backward compatibility with manual quoting of parameters 72a89cf86fcd broke things ... and the following cleanups didn't fix all issues. It didn't work with the diffargs shipped in mergetools.rc with explicit quoting. Parameters would end up with being quoted twice - especially if they really needed quoting. To work around that, look for explicit quotes around the variables that will be substituted with proper quoting. Also accept an additional prefix so we can handle both --foo='$parent' and '--foo=$parent' It will however still fail if the user intentionally place the variable inside a quoted string, as in 'parent $parent is on the left' There is currently no good way to handle that, short of knowing exactly which quoting mechanism will be used.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 28 Jan 2015 02:28:39 +0100
parents 5edb387158a1
children e484546a7c18
line wrap: on
line diff
--- a/tests/test-extdiff.t	Wed Jan 28 02:28:38 2015 +0100
+++ b/tests/test-extdiff.t	Wed Jan 28 02:28:39 2015 +0100
@@ -160,6 +160,28 @@
   running "echo echo-naked 'being quoted' */a $TESTTMP/a/a" in */extdiff.* (glob)
 #endif
 
+  $ touch 'sp ace'
+  $ hg add 'sp ace'
+  $ hg ci -m 'sp ace'
+  created new head
+  $ echo > 'sp ace'
+
+Test pre-72a89cf86fcd backward compatibility with half-baked manual quoting
+
+  $ cat <<EOF >> $HGRCPATH
+  > [extdiff]
+  > odd =
+  > [merge-tools]
+  > odd.diffargs = --foo='\$clabel' '\$clabel' "--bar=\$clabel" "\$clabel"
+  > odd.executable = echo
+  > EOF
+#if windows
+TODO
+#else
+  $ hg --debug odd | grep '^running'
+  running "/bin/echo --foo='sp ace' 'sp ace' --bar='sp ace' 'sp ace'" in * (glob)
+#endif
+
 #if execbit
 
 Test extdiff of multiple files in tmp dir: