~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to patchsource.py

  • Committer: Aaron Bentley
  • Date: 2011-06-27 23:07:10 UTC
  • Revision ID: aaron@aaronbentley.com-20110627230710-orth0tzf1kwknfen
Better handling of compound tar names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
from bzrlib import patches
 
1
import re
 
2
 
 
3
from bzrlib import (
 
4
    patches,
 
5
    workingtree,
 
6
    )
 
7
 
 
8
from bzrlib.plugins.bzrtools import errors
2
9
 
3
10
class PatchSource(object):
4
11
    def __iter__(self):
24
31
 
25
32
class BzrPatchSource(PatchSource):
26
33
    def __init__(self, revision=None, file_list=None):
27
 
        from bzrlib.builtins import tree_files
28
 
        self.tree, self.file_list = tree_files(file_list)
 
34
        open_containing_paths = workingtree.WorkingTree.open_containing_paths
 
35
        self.tree, self.file_list = open_containing_paths(file_list)
29
36
        self.base = self.tree.basedir
30
37
        self.revision = revision
31
38
 
51
58
 
52
59
        show_diff_trees(self.old_tree, self.tree, f, self.file_list,
53
60
                        old_label='', new_label='')
54
 
 
 
61
        if re.search('Binary files .* differ', f.getvalue()):
 
62
            raise errors.ChangedBinaryFiles()
55
63
        f.seek(0)
56
64
        return f.readlines()