Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/util.py @ 2786:f4d916351366
Add portable shell-quoting function; teach mq to use it.
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Sat, 05 Aug 2006 15:23:26 -0700 |
parents | e6bef16b6cec |
children | 1e8b8107a2c9 |
comparison
equal
deleted
inserted
replaced
2785:58a679745b38 | 2786:f4d916351366 |
---|---|
609 readlock = _readlock_file | 609 readlock = _readlock_file |
610 | 610 |
611 def samestat(s1, s2): | 611 def samestat(s1, s2): |
612 return False | 612 return False |
613 | 613 |
614 def shellquote(s): | |
615 return '"%s"' % s.replace('"', '\\"') | |
616 | |
614 def explain_exit(code): | 617 def explain_exit(code): |
615 return _("exited with status %d") % code, code | 618 return _("exited with status %d") % code, code |
616 | 619 |
617 try: | 620 try: |
618 # override functions with win32 versions if possible | 621 # override functions with win32 versions if possible |
697 except OSError, why: | 700 except OSError, why: |
698 if why.errno == errno.EINVAL: | 701 if why.errno == errno.EINVAL: |
699 return _readlock_file(pathname) | 702 return _readlock_file(pathname) |
700 else: | 703 else: |
701 raise | 704 raise |
705 | |
706 def shellquote(s): | |
707 return "'%s'" % s.replace("'", "'\\''") | |
702 | 708 |
703 def testpid(pid): | 709 def testpid(pid): |
704 '''return False if pid dead, True if running or not sure''' | 710 '''return False if pid dead, True if running or not sure''' |
705 try: | 711 try: |
706 os.kill(pid, 0) | 712 os.kill(pid, 0) |