##// END OF EJS Templates
Add portable shell-quoting function; teach mq to use it.
Brendan Cully -
r2791:f4d91635 default
parent child Browse files
Show More
@@ -272,8 +272,8 b' class queue:'
272 patchfile: file name of patch'''
272 patchfile: file name of patch'''
273 try:
273 try:
274 pp = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch')
274 pp = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch')
275 f = os.popen("%s -d '%s' -p1 --no-backup-if-mismatch < '%s'" %
275 f = os.popen("%s -d %s -p1 --no-backup-if-mismatch < %s" %
276 (pp, repo.root, patchfile))
276 (pp, util.shellquote(repo.root), util.shellquote(patchfile)))
277 except:
277 except:
278 self.ui.warn("patch failed, unable to continue (try -v)\n")
278 self.ui.warn("patch failed, unable to continue (try -v)\n")
279 return (None, [], False)
279 return (None, [], False)
@@ -611,6 +611,9 b" if os.name == 'nt':"
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
@@ -700,6 +703,9 b' else:'
700 else:
703 else:
701 raise
704 raise
702
705
706 def shellquote(s):
707 return "'%s'" % s.replace("'", "'\\''")
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:
General Comments 0
You need to be logged in to leave comments. Login now