/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/patch.py

  • Committer: Jelmer Vernooij
  • Date: 2019-06-02 03:11:13 UTC
  • mfrom: (7309 work)
  • mto: This revision was merged to the branch mainline in revision 7310.
  • Revision ID: jelmer@jelmer.uk-20190602031113-3ie05wvkzp3114m1
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
111
111
            raise
112
112
    if status not in (0, 1):
113
113
        raise Exception(stderr)
114
 
    f = open(out_file, 'wb')
115
 
    try:
 
114
    with open(out_file, 'wb') as f:
116
115
        f.write(output)
117
 
    finally:
118
 
        f.close()
119
116
    return status
120
117
 
121
118
 
122
 
def patch_tree(tree, patches, strip=0, reverse=False, dry_run=False, quiet=False,
123
 
               out=None):
124
 
    return run_patch(tree.basedir, patches, strip, reverse, dry_run, quiet,
125
 
                     out=out)
 
119
def patch_tree(tree, patches, strip=0, reverse=False, dry_run=False,
 
120
               quiet=False, out=None):
 
121
    """Apply a patch to a tree.
 
122
 
 
123
    Args:
 
124
      tree: A MutableTree object
 
125
      patches: list of patches as bytes
 
126
      strip: Strip X segments of paths
 
127
      reverse: Apply reversal of patch
 
128
      dry_run: Dry run
 
129
    """
 
130
    return run_patch(tree.basedir, patches, strip, reverse, dry_run,
 
131
                     quiet, out=out)
126
132
 
127
133
 
128
134
def run_patch(directory, patches, strip=0, reverse=False, dry_run=False,