diff --git a/mercurial/windows.py b/mercurial/windows.py --- a/mercurial/windows.py +++ b/mercurial/windows.py @@ -162,6 +162,18 @@ def samestat(s1, s2): _quotere = None _needsshellquote = None def shellquote(s): + r""" + >>> shellquote(r'C:\Users\xyz') + '"C:\\Users\\xyz"' + >>> shellquote(r'C:\Users\xyz/mixed') + '"C:\\Users\\xyz/mixed"' + >>> # Would be safe not to quote too, since it is all double backslashes + >>> shellquote(r'C:\\Users\\xyz') + '"C:\\\\Users\\\\xyz"' + >>> # But this must be quoted + >>> shellquote(r'C:\\Users\\xyz/abc') + '"C:\\\\Users\\\\xyz/abc"' + """ global _quotere if _quotere is None: _quotere = re.compile(r'(\\*)("|\\$)')