comparison mercurial/util.py @ 2788:1e8b8107a2c9

util.patch: use shellquote
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 06 Aug 2006 16:42:36 +0200
parents f4d916351366
children 345bac2bc4ec b3d1145ed06c
comparison
equal deleted inserted replaced
2787:8ec1b1f0a5f7 2788:1e8b8107a2c9
97 """apply the patch <patchname> to the working directory. 97 """apply the patch <patchname> to the working directory.
98 a list of patched files is returned""" 98 a list of patched files is returned"""
99 patcher = find_in_path('gpatch', os.environ.get('PATH', ''), 'patch') 99 patcher = find_in_path('gpatch', os.environ.get('PATH', ''), 'patch')
100 args = [] 100 args = []
101 if cwd: 101 if cwd:
102 args.append('-d "%s"' % cwd) 102 args.append('-d %s' % shellquote(cwd))
103 fp = os.popen('%s %s -p%d < "%s"' % (patcher, ' '.join(args), strip, 103 fp = os.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip,
104 patchname)) 104 shellquote(patchname)))
105 files = {} 105 files = {}
106 for line in fp: 106 for line in fp:
107 line = line.rstrip() 107 line = line.rstrip()
108 ui.status("%s\n" % line) 108 ui.status("%s\n" % line)
109 if line.startswith('patching file '): 109 if line.startswith('patching file '):