~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to patch.py

  • Committer: Aaron Bentley
  • Date: 2008-05-30 02:30:22 UTC
  • Revision ID: aaron@aaronbentley.com-20080530023022-l2fzmlvuzkotwnhv
Remove baz-import

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import sys
18
18
import subprocess
19
19
 
 
20
from bzrlib.workingtree import WorkingTree
20
21
import bzrlib.add
21
22
 
22
23
from bzrlib.plugins.bzrtools.bzrtools import open_from_url
23
 
from errors import PatchFailed, PatchInvokeError
 
24
from errors import CommandError, PatchFailed, PatchInvokeError
24
25
 
25
26
def patch(tree, location, strip, quiet=False):
26
27
    """Apply a patch to a branch, using patch(1).  URLs may be used."""
34
35
 
35
36
 
36
37
def run_patch(directory, patches, strip=0, reverse=False, dry_run=False,
37
 
              quiet=False, _patch_cmd='patch', target_file=None):
 
38
              quiet=False, _patch_cmd='patch'):
38
39
    args = [_patch_cmd, '-d', directory, '-s', '-p%d' % strip, '-f']
39
40
    if quiet:
40
41
        args.append('--quiet')
52
53
        stderr = subprocess.PIPE
53
54
    else:
54
55
        stderr = None
55
 
    if target_file is not None:
56
 
        args.append(target_file)
57
56
 
58
57
    try:
59
58
        process = subprocess.Popen(args, stdin=subprocess.PIPE,