comparison mercurial/patch.py @ 4644:50252ea60549

patch: fix ui.patch regression introduced by 62019c4427e3. The idea is ui.patch is either empty or wisely filled by user.
author Patrick Mezard <pmezard@gmail.com>
date Tue, 19 Jun 2007 17:02:07 +0200
parents 96d8a56d4ef9
children 7a7d4937272b
comparison
equal deleted inserted replaced
4643:a39cec1d5cb8 4644:50252ea60549
296 """patch and updates the files and fuzz variables""" 296 """patch and updates the files and fuzz variables"""
297 fuzz = False 297 fuzz = False
298 298
299 args = [] 299 args = []
300 patcher = ui.config('ui', 'patch') 300 patcher = ui.config('ui', 'patch')
301 patcher = ((patcher and util.find_exe(patcher)) or 301 if not patcher:
302 util.find_exe('gpatch') or 302 patcher = util.find_exe('gpatch') or util.find_exe('patch')
303 util.find_exe('patch')) 303 # Try to be smart only if patch call was not supplied
304 if util.needbinarypatch():
305 args.append('--binary')
306
304 if not patcher: 307 if not patcher:
305 raise util.Abort(_('no patch command found in hgrc or PATH')) 308 raise util.Abort(_('no patch command found in hgrc or PATH'))
306 if util.needbinarypatch():
307 args.append('--binary')
308 309
309 if cwd: 310 if cwd:
310 args.append('-d %s' % util.shellquote(cwd)) 311 args.append('-d %s' % util.shellquote(cwd))
311 fp = os.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip, 312 fp = os.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip,
312 util.shellquote(patchname))) 313 util.shellquote(patchname)))