##// END OF EJS Templates
posix: quote the specified string only when it may have to be quoted...
FUJIWARA Katsunori -
r23683:5edb3871 default
parent child Browse files
Show More
@@ -8,7 +8,7 b''
8 8 from i18n import _
9 9 import encoding
10 10 import os, sys, errno, stat, getpass, pwd, grp, socket, tempfile, unicodedata
11 import fcntl
11 import fcntl, re
12 12
13 13 posixfile = open
14 14 normpath = os.path.normpath
@@ -315,9 +315,16 b" if sys.platform == 'cygwin':"
315 315 def checklink(path):
316 316 return False
317 317
318 _needsshellquote = None
318 319 def shellquote(s):
319 320 if os.sys.platform == 'OpenVMS':
320 321 return '"%s"' % s
322 global _needsshellquote
323 if _needsshellquote is None:
324 _needsshellquote = re.compile(r'[^a-zA-Z0-9._/-]').search
325 if not _needsshellquote(s):
326 # "s" shouldn't have to be quoted
327 return s
321 328 else:
322 329 return "'%s'" % s.replace("'", "'\\''")
323 330
@@ -114,11 +114,11 b' issue4463: usage of command line configu'
114 114 running '*echo* *\\a *\\a' in */extdiff.* (glob)
115 115 #else
116 116 $ hg --debug 4463a | grep '^running'
117 running '\'echo\' a-naked \'single quoted\' "double quoted" \'*/a\' \'$TESTTMP/a/a\'' in */extdiff.* (glob)
117 running 'echo a-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob)
118 118 $ hg --debug 4463b | grep '^running'
119 running 'echo b-naked \'single quoted\' "double quoted" \'*/a\' \'$TESTTMP/a/a\'' in */extdiff.* (glob)
119 running 'echo b-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob)
120 120 $ hg --debug echo | grep '^running'
121 running "'*echo*' '*/a' '$TESTTMP/a/a'" in */extdiff.* (glob)
121 running '*echo */a $TESTTMP/a/a' in */extdiff.* (glob)
122 122 #endif
123 123
124 124 (getting options from other than extdiff section)
@@ -149,15 +149,15 b' issue4463: usage of command line configu'
149 149 running 'echo echo-naked "being quoted" *\\a *\\a' in */extdiff.* (glob)
150 150 #else
151 151 $ hg --debug 4463b2 | grep '^running'
152 running 'echo b2-naked \'single quoted\' "double quoted" \'*/a\' \'$TESTTMP/a/a\'' in */extdiff.* (glob)
152 running 'echo b2-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob)
153 153 $ hg --debug 4463b3 | grep '^running'
154 running 'echo b3-naked \'single quoted\' "double quoted" \'*/a\' \'$TESTTMP/a/a\'' in */extdiff.* (glob)
154 running 'echo b3-naked \'single quoted\' "double quoted" */a $TESTTMP/a/a' in */extdiff.* (glob)
155 155 $ hg --debug 4463b4 | grep '^running'
156 running "echo '*/a' '$TESTTMP/a/a'" in */extdiff.* (glob)
157 $ hg --debug 4463b4 --option 'being quoted' | grep '^running'
158 running "echo 'being quoted' '*/a' '$TESTTMP/a/a'" in */extdiff.* (glob)
159 $ hg --debug extdiff -p echo --option 'being quoted' | grep '^running'
160 running "'echo' 'being quoted' '*/a' '$TESTTMP/a/a'" in */extdiff.* (glob)
156 running 'echo */a $TESTTMP/a/a' in */extdiff.* (glob)
157 $ hg --debug 4463b4 --option b4-naked --option 'being quoted' | grep '^running'
158 running "echo b4-naked 'being quoted' */a $TESTTMP/a/a" in */extdiff.* (glob)
159 $ hg --debug extdiff -p echo --option echo-naked --option 'being quoted' | grep '^running'
160 running "echo echo-naked 'being quoted' */a $TESTTMP/a/a" in */extdiff.* (glob)
161 161 #endif
162 162
163 163 #if execbit
@@ -273,7 +273,7 b' Fallback to merge-tools.tool.executable|'
273 273 making snapshot of 2 files from working directory
274 274 a
275 275 b
276 running "'$TESTTMP/a/dir/tool.sh' 'a.*' 'a'" in */extdiff.* (glob)
276 running '$TESTTMP/a/dir/tool.sh a.* a' in */extdiff.* (glob)
277 277 ** custom diff **
278 278 cleaning up temp directory
279 279 [1]
General Comments 0
You need to be logged in to leave comments. Login now