/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/filter_tree.py

  • Committer: Jelmer Vernooij
  • Date: 2019-03-04 00:16:27 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7318.
  • Revision ID: jelmer@jelmer.uk-20190304001627-v6u7o6pf97tukhek
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
class ContentFilterTree(tree.Tree):
34
34
    """A virtual tree that applies content filters to an underlying tree.
35
 
    
 
35
 
36
36
    Not every operation is supported yet.
37
37
    """
38
38
 
46
46
        self.backing_tree = backing_tree
47
47
        self.filter_stack_callback = filter_stack_callback
48
48
 
49
 
    def get_file_text(self, path, file_id=None):
50
 
        chunks = self.backing_tree.get_file_lines(path, file_id)
 
49
    def get_file_text(self, path):
 
50
        chunks = self.backing_tree.get_file_lines(path)
51
51
        filters = self.filter_stack_callback(path)
52
52
        context = ContentFilterContext(path, self)
53
53
        contents = filtered_output_bytes(chunks, filters, context)
54
54
        content = b''.join(contents)
55
55
        return content
56
56
 
57
 
    def get_file(self, path, file_id=None):
58
 
        return BytesIO(self.get_file_text(path, file_id))
 
57
    def get_file(self, path):
 
58
        return BytesIO(self.get_file_text(path))
59
59
 
60
60
    def has_filename(self, filename):
61
61
        return self.backing_tree.has_filename
62
62
 
63
 
    def is_executable(self, path, file_id=None):
64
 
        return self.backing_tree.is_executable(path, file_id)
 
63
    def is_executable(self, path):
 
64
        return self.backing_tree.is_executable(path)
65
65
 
66
66
    def iter_entries_by_dir(self, specific_files=None):
67
67
        # NB: This simply returns the parent tree's entries; the length may be