Mercurial > public > mercurial-scm > hg
comparison mercurial/posix.py @ 26248:99b6afff09ae
posix: shellquote do not require quoting for "+" (issue4818)
author | timeless@mozdev.org |
---|---|
date | Fri, 04 Sep 2015 11:15:02 -0400 |
parents | 224a33452ed4 |
children | b8381832ce2b c750ed59892a |
comparison
equal
deleted
inserted
replaced
26247:7df5d4760873 | 26248:99b6afff09ae |
---|---|
348 def shellquote(s): | 348 def shellquote(s): |
349 if os.sys.platform == 'OpenVMS': | 349 if os.sys.platform == 'OpenVMS': |
350 return '"%s"' % s | 350 return '"%s"' % s |
351 global _needsshellquote | 351 global _needsshellquote |
352 if _needsshellquote is None: | 352 if _needsshellquote is None: |
353 _needsshellquote = re.compile(r'[^a-zA-Z0-9._/-]').search | 353 _needsshellquote = re.compile(r'[^a-zA-Z0-9._/+-]').search |
354 if s and not _needsshellquote(s): | 354 if s and not _needsshellquote(s): |
355 # "s" shouldn't have to be quoted | 355 # "s" shouldn't have to be quoted |
356 return s | 356 return s |
357 else: | 357 else: |
358 return "'%s'" % s.replace("'", "'\\''") | 358 return "'%s'" % s.replace("'", "'\\''") |