Mercurial > hg-stable
diff tests/test-extdiff.t @ 24885:eea3977e6fca stable
windows: make shellquote() quote any path containing '\' (issue4629)
The '~' in the bug report is being expanded to a path with Windows style slashes
before being passed to shellquote() via util.shellquote(). But shlex.split()
strips '\' out of the string, leaving an invalid path in dispatch.aliasargs().
This regressed in 1642eb429536.
For now, the tests need to be conditionalized for Windows (because those paths
are quoted). In the future, a more complex regex could probably skip the quotes
if all component separators are double '\'. I opted to glob away the quotes in
test-rename-merge2.t and test-up-local-change.t (which only exist on Windows),
because they are in very large blocks of output and there are way too many diffs
to conditionalize with #if directives. Maybe the entire path should be globbed
away like the following paths in each changed line. Or, letting #if directives
sit in the middle of the output as was mentioned a few months back would work
too.
Unfortunately, I couldn't figure out how to test the specific bug. All of the
'hg serve' tests have a #require serve declaration, causing them to be skipped
on Windows. Adding an alias for 'expandtest = outgoing ~/bogusrepo' prints the
repo as '$TESTTMP/bogusrepo', so the test runner must be changing the
environment somehow.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 29 Apr 2015 21:14:59 -0400 |
parents | f7401f816cc9 |
children | 18bae5eb58c5 |
line wrap: on
line diff
--- a/tests/test-extdiff.t Wed Apr 29 23:55:25 2015 -0400 +++ b/tests/test-extdiff.t Wed Apr 29 21:14:59 2015 -0400 @@ -58,9 +58,15 @@ Should diff cloned files directly: +#if windows + $ hg falabala -r 0:1 + diffing "*\\extdiff.*\\a.8a5febb7f867\\a" "a.34eed99112ab\\a" (glob) + [1] +#else $ hg falabala -r 0:1 diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) [1] +#endif Test diff during merge: @@ -76,23 +82,41 @@ Should diff cloned file against wc file: +#if windows + $ hg falabala + diffing "*\\extdiff.*\\a.2a13a4d2da36\\a" "*\\a\\a" (glob) + [1] +#else $ hg falabala diffing */extdiff.*/a.2a13a4d2da36/a */a/a (glob) [1] +#endif Test --change option: $ hg ci -d '2 0' -mtest3 +#if windows + $ hg falabala -c 1 + diffing "*\\extdiff.*\\a.8a5febb7f867\\a" "a.34eed99112ab\\a" (glob) + [1] +#else $ hg falabala -c 1 diffing */extdiff.*/a.8a5febb7f867/a a.34eed99112ab/a (glob) [1] +#endif Check diff are made from the first parent: +#if windows + $ hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code" + diffing "*\\extdiff.*\\a.2a13a4d2da36\\a" "a.46c0e4daeb72\\a" (glob) + diff-like tools yield a non-zero exit code +#else $ hg falabala -c 3 || echo "diff-like tools yield a non-zero exit code" diffing */extdiff.*/a.2a13a4d2da36/a a.46c0e4daeb72/a (glob) diff-like tools yield a non-zero exit code +#endif issue4463: usage of command line configuration without additional quoting @@ -107,11 +131,11 @@ $ echo a >> a #if windows $ hg --debug 4463a | grep '^running' - running 'echo a-naked \'single quoted\' "double quoted" *\\a *\\a' in */extdiff.* (glob) + running 'echo a-naked \'single quoted\' "double quoted" "*\\a" "*\\a"' in */extdiff.* (glob) $ hg --debug 4463b | grep '^running' - running 'echo b-naked \'single quoted\' "double quoted" *\\a *\\a' in */extdiff.* (glob) + running 'echo b-naked \'single quoted\' "double quoted" "*\\a" "*\\a"' in */extdiff.* (glob) $ hg --debug echo | grep '^running' - running '*echo* *\\a *\\a' in */extdiff.* (glob) + running '*echo* "*\\a" "*\\a"' in */extdiff.* (glob) #else $ hg --debug 4463a | grep '^running' running 'echo a-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob) @@ -138,15 +162,15 @@ > EOF #if windows $ hg --debug 4463b2 | grep '^running' - running 'echo b2-naked \'single quoted\' "double quoted" *\\a *\\a' in */extdiff.* (glob) + running 'echo b2-naked \'single quoted\' "double quoted" "*\\a" "*\\a"' in */extdiff.* (glob) $ hg --debug 4463b3 | grep '^running' - running 'echo b3-naked \'single quoted\' "double quoted" *\\a *\\a' in */extdiff.* (glob) + running 'echo b3-naked \'single quoted\' "double quoted" "*\\a" "*\\a"' in */extdiff.* (glob) $ hg --debug 4463b4 | grep '^running' - running 'echo *\\a *\\a' in */extdiff.* (glob) + running 'echo "*\\a" "*\\a"' in */extdiff.* (glob) $ hg --debug 4463b4 --option b4-naked --option 'being quoted' | grep '^running' - running 'echo b4-naked "being quoted" *\\a *\\a' in */extdiff.* (glob) + running 'echo b4-naked "being quoted" "*\\a" "*\\a"' in */extdiff.* (glob) $ hg --debug extdiff -p echo --option echo-naked --option 'being quoted' | grep '^running' - running 'echo echo-naked "being quoted" *\\a *\\a' in */extdiff.* (glob) + running 'echo echo-naked "being quoted" "*\\a" "*\\a"' in */extdiff.* (glob) #else $ hg --debug 4463b2 | grep '^running' running 'echo b2-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob)