##// END OF EJS Templates
shellquote: fix missing quotes for empty string...
Yuya Nishihara -
r24108:d65ecb81 stable
parent child Browse files
Show More
@@ -322,7 +322,7 b' def shellquote(s):'
322 global _needsshellquote
322 global _needsshellquote
323 if _needsshellquote is None:
323 if _needsshellquote is None:
324 _needsshellquote = re.compile(r'[^a-zA-Z0-9._/-]').search
324 _needsshellquote = re.compile(r'[^a-zA-Z0-9._/-]').search
325 if not _needsshellquote(s):
325 if s and not _needsshellquote(s):
326 # "s" shouldn't have to be quoted
326 # "s" shouldn't have to be quoted
327 return s
327 return s
328 else:
328 else:
@@ -159,7 +159,7 b' def shellquote(s):'
159 # they are used as a part of path name (and the latter doesn't
159 # they are used as a part of path name (and the latter doesn't
160 # work as "escape character", like one on posix) on Windows
160 # work as "escape character", like one on posix) on Windows
161 _needsshellquote = re.compile(r'[^a-zA-Z0-9._:/\\-]').search
161 _needsshellquote = re.compile(r'[^a-zA-Z0-9._:/\\-]').search
162 if not _needsshellquote(s) and not _quotere.search(s):
162 if s and not _needsshellquote(s) and not _quotere.search(s):
163 # "s" shouldn't have to be quoted
163 # "s" shouldn't have to be quoted
164 return s
164 return s
165 return '"%s"' % _quotere.sub(r'\1\1\\\2', s)
165 return '"%s"' % _quotere.sub(r'\1\1\\\2', s)
@@ -182,6 +182,22 b' TODO'
182 running "*/bin/echo --foo='sp ace' 'sp ace' --bar='sp ace' 'sp ace'" in * (glob)
182 running "*/bin/echo --foo='sp ace' 'sp ace' --bar='sp ace' 'sp ace'" in * (glob)
183 #endif
183 #endif
184
184
185 Empty argument must be quoted
186
187 $ cat <<EOF >> $HGRCPATH
188 > [extdiff]
189 > kdiff3 = echo
190 > [merge-tools]
191 > kdiff3.diffargs=--L1 \$plabel1 --L2 \$clabel \$parent \$child
192 > EOF
193 #if windows
194 $ hg --debug kdiff3 -r0 | grep '^running'
195 running 'echo --L1 "@0" --L2 "" a.8a5febb7f867 a' in * (glob)
196 #else
197 $ hg --debug kdiff3 -r0 | grep '^running'
198 running "echo --L1 '@0' --L2 '' a.8a5febb7f867 a" in * (glob)
199 #endif
200
185 #if execbit
201 #if execbit
186
202
187 Test extdiff of multiple files in tmp dir:
203 Test extdiff of multiple files in tmp dir:
General Comments 0
You need to be logged in to leave comments. Login now