equal
deleted
inserted
replaced
293 """patch and updates the files and fuzz variables""" |
293 """patch and updates the files and fuzz variables""" |
294 fuzz = False |
294 fuzz = False |
295 |
295 |
296 args = [] |
296 args = [] |
297 patcher = ui.config('ui', 'patch') |
297 patcher = ui.config('ui', 'patch') |
|
298 patcher = ((patcher and util.find_exe(patcher)) or |
|
299 util.find_exe('gpatch') or |
|
300 util.find_exe('patch')) |
298 if not patcher: |
301 if not patcher: |
299 patcher = util.find_in_path('gpatch', os.environ.get('PATH', ''), |
302 raise util.Abort(_('no patch command found in hgrc or PATH')) |
300 'patch') |
303 if util.needbinarypatch(): |
301 if util.needbinarypatch(): |
304 args.append('--binary') |
302 args.append('--binary') |
|
303 |
305 |
304 if cwd: |
306 if cwd: |
305 args.append('-d %s' % util.shellquote(cwd)) |
307 args.append('-d %s' % util.shellquote(cwd)) |
306 fp = os.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip, |
308 fp = os.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip, |
307 util.shellquote(patchname))) |
309 util.shellquote(patchname))) |
641 |
643 |
642 for seqno, rev in enumerate(revs): |
644 for seqno, rev in enumerate(revs): |
643 single(rev, seqno+1, fp) |
645 single(rev, seqno+1, fp) |
644 |
646 |
645 def diffstat(patchlines): |
647 def diffstat(patchlines): |
646 if not util.find_in_path('diffstat', os.environ.get('PATH', '')): |
648 if not util.find_exe('diffstat'): |
647 return |
649 return |
648 fd, name = tempfile.mkstemp(prefix="hg-patchbomb-", suffix=".txt") |
650 fd, name = tempfile.mkstemp(prefix="hg-patchbomb-", suffix=".txt") |
649 try: |
651 try: |
650 p = popen2.Popen3('diffstat -p1 -w79 2>/dev/null > ' + name) |
652 p = popen2.Popen3('diffstat -p1 -w79 2>/dev/null > ' + name) |
651 try: |
653 try: |