# HG changeset patch # User Benoit Boissinot # Date 1154875356 -7200 # Node ID 1e8b8107a2c9c8de37f0026c582370d5a4204978 # Parent 8ec1b1f0a5f7ff6c2e08d74429a9c90f793a75b6 util.patch: use shellquote diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -99,9 +99,9 @@ def patch(strip, patchname, ui, cwd=None patcher = find_in_path('gpatch', os.environ.get('PATH', ''), 'patch') args = [] if cwd: - args.append('-d "%s"' % cwd) - fp = os.popen('%s %s -p%d < "%s"' % (patcher, ' '.join(args), strip, - patchname)) + args.append('-d %s' % shellquote(cwd)) + fp = os.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip, + shellquote(patchname))) files = {} for line in fp: line = line.rstrip()