~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to patch.py

  • Committer: Aaron Bentley
  • Date: 2008-10-06 23:24:16 UTC
  • Revision ID: aaron@aaronbentley.com-20081006232416-mbohnubye0z5tiev
Add target_file param

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 
36
36
 
37
37
def run_patch(directory, patches, strip=0, reverse=False, dry_run=False,
38
 
              quiet=False, _patch_cmd='patch'):
 
38
              quiet=False, _patch_cmd='patch', target_file=None):
39
39
    args = [_patch_cmd, '-d', directory, '-s', '-p%d' % strip, '-f']
40
40
    if quiet:
41
41
        args.append('--quiet')
53
53
        stderr = subprocess.PIPE
54
54
    else:
55
55
        stderr = None
 
56
    if target_file is not None:
 
57
        args.append(target_file)
56
58
 
57
59
    try:
58
60
        process = subprocess.Popen(args, stdin=subprocess.PIPE,