mercurial/windows.py
changeset 36415 0cb09c322647
parent 35513 c4caf530b1c7
child 36457 0e8b76644e20
--- a/mercurial/windows.py	Fri Feb 23 23:09:58 2018 +0900
+++ b/mercurial/windows.py	Wed Feb 21 22:20:27 2018 +0900
@@ -296,6 +296,15 @@
         return s
     return '"%s"' % _quotere.sub(r'\1\1\\\2', s)
 
+def _unquote(s):
+    if s.startswith(b'"') and s.endswith(b'"'):
+        return s[1:-1]
+    return s
+
+def shellsplit(s):
+    """Parse a command string in cmd.exe way (best-effort)"""
+    return pycompat.maplist(_unquote, pycompat.shlexsplit(s, posix=False))
+
 def quotecommand(cmd):
     """Build a command string suitable for os.popen* calls."""
     if sys.version_info < (2, 7, 1):