Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 5293:32ec518ee3cb
Merge with crew-stable
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Mon, 10 Sep 2007 23:53:23 +0200 |
parents | 46c5e1ee8aaa 5a65d870871d |
children | efe7ef325737 c6adf2be6069 |
line wrap: on
line diff
--- a/mercurial/util.py Fri Sep 07 17:54:38 2007 +0200 +++ b/mercurial/util.py Mon Sep 10 23:53:23 2007 +0200 @@ -1001,6 +1001,12 @@ _quotere = re.compile(r'(\\*)("|\\$)') return '"%s"' % _quotere.sub(r'\1\1\\\2', s) + def quotecommand(cmd): + """Build a command string suitable for os.popen* calls.""" + # The extra quotes are needed because popen* runs the command + # through the current COMSPEC. cmd.exe suppress enclosing quotes. + return '"' + cmd + '"' + def explain_exit(code): return _("exited with status %d") % code, code @@ -1154,6 +1160,9 @@ else: return "'%s'" % s.replace("'", "'\\''") + def quotecommand(cmd): + return cmd + def testpid(pid): '''return False if pid dead, True if running or not sure''' if os.sys.platform == 'OpenVMS': @@ -1681,3 +1690,7 @@ if path.startswith('//'): path = path[2:] return path + +def uirepr(s): + # Avoid double backslash in Windows path repr() + return repr(s).replace('\\\\', '\\')