mercurial/windows.py
branchstable
changeset 24108 d65ecb814fc0
parent 23682 1642eb429536
child 24148 7a2194473155
equal deleted inserted replaced
24013:942a5a34b2d0 24108:d65ecb814fc0
   157     if _needsshellquote is None:
   157     if _needsshellquote is None:
   158         # ":" and "\\" are also treated as "safe character", because
   158         # ":" and "\\" are also treated as "safe character", because
   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)
   166 
   166 
   167 def quotecommand(cmd):
   167 def quotecommand(cmd):