mercurial/util.py
changeset 5293 32ec518ee3cb
parent 5266 46c5e1ee8aaa
parent 5292 5a65d870871d
child 5351 efe7ef325737
child 5353 c6adf2be6069
equal deleted inserted replaced
5290:05889b6b1468 5293:32ec518ee3cb
   999         global _quotere
   999         global _quotere
  1000         if _quotere is None:
  1000         if _quotere is None:
  1001             _quotere = re.compile(r'(\\*)("|\\$)')
  1001             _quotere = re.compile(r'(\\*)("|\\$)')
  1002         return '"%s"' % _quotere.sub(r'\1\1\\\2', s)
  1002         return '"%s"' % _quotere.sub(r'\1\1\\\2', s)
  1003 
  1003 
       
  1004     def quotecommand(cmd):
       
  1005         """Build a command string suitable for os.popen* calls."""
       
  1006         # The extra quotes are needed because popen* runs the command
       
  1007         # through the current COMSPEC. cmd.exe suppress enclosing quotes.
       
  1008         return '"' + cmd + '"'
       
  1009 
  1004     def explain_exit(code):
  1010     def explain_exit(code):
  1005         return _("exited with status %d") % code, code
  1011         return _("exited with status %d") % code, code
  1006 
  1012 
  1007     # if you change this stub into a real check, please try to implement the
  1013     # if you change this stub into a real check, please try to implement the
  1008     # username and groupname functions above, too.
  1014     # username and groupname functions above, too.
  1151     def shellquote(s):
  1157     def shellquote(s):
  1152         if os.sys.platform == 'OpenVMS':
  1158         if os.sys.platform == 'OpenVMS':
  1153             return '"%s"' % s
  1159             return '"%s"' % s
  1154         else:
  1160         else:
  1155             return "'%s'" % s.replace("'", "'\\''")
  1161             return "'%s'" % s.replace("'", "'\\''")
       
  1162 
       
  1163     def quotecommand(cmd):
       
  1164         return cmd
  1156 
  1165 
  1157     def testpid(pid):
  1166     def testpid(pid):
  1158         '''return False if pid dead, True if running or not sure'''
  1167         '''return False if pid dead, True if running or not sure'''
  1159         if os.sys.platform == 'OpenVMS':
  1168         if os.sys.platform == 'OpenVMS':
  1160             return True
  1169             return True
  1679     if path.startswith(sc):
  1688     if path.startswith(sc):
  1680         path = path[len(sc):]
  1689         path = path[len(sc):]
  1681         if path.startswith('//'):
  1690         if path.startswith('//'):
  1682             path = path[2:]
  1691             path = path[2:]
  1683     return path
  1692     return path
       
  1693 
       
  1694 def uirepr(s):
       
  1695     # Avoid double backslash in Windows path repr()
       
  1696     return repr(s).replace('\\\\', '\\')