mercurial/posix.py
changeset 26248 99b6afff09ae
parent 25967 224a33452ed4
child 26876 b8381832ce2b
child 26883 c750ed59892a
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("'", "'\\''")