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

  • Committer: Jelmer Vernooij
  • Date: 2018-03-24 17:48:04 UTC
  • mfrom: (6921 work)
  • mto: This revision was merged to the branch mainline in revision 6923.
  • Revision ID: jelmer@jelmer.uk-20180324174804-xf22o05byoj12x1q
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    rules,
35
35
    trace,
36
36
    )
 
37
from breezy.bzr import (
 
38
    inventory,
 
39
    )
37
40
from breezy.i18n import gettext
38
41
""")
39
42
 
92
95
        return ''
93
96
 
94
97
 
95
 
class TreeReference(TreeEntry):
96
 
    """See TreeEntry. This is a reference to a nested tree in a working tree."""
97
 
 
98
 
    def kind_character(self):
99
 
        return '/'
100
 
 
101
 
 
102
98
class Tree(object):
103
99
    """Abstract file tree.
104
100
 
217
213
        """
218
214
        raise NotImplementedError(self.id2path)
219
215
 
220
 
    def iter_entries_by_dir(self, specific_files=None):
 
216
    def iter_entries_by_dir(self, specific_files=None, yield_parents=False):
221
217
        """Walk the tree in 'by_dir' order.
222
218
 
223
219
        This will yield each entry in the tree as a (path, entry) tuple.
241
237
        The yield order (ignoring root) would be::
242
238
 
243
239
          a, f, a/b, a/d, a/b/c, a/d/e, f/g
 
240
 
 
241
        :param yield_parents: If True, yield the parents from the root leading
 
242
            down to specific_files that have been requested. This has no
 
243
            impact if specific_files is None.
244
244
        """
245
245
        raise NotImplementedError(self.iter_entries_by_dir)
246
246
 
653
653
        searcher = default_searcher
654
654
        return searcher
655
655
 
656
 
    @classmethod
657
 
    def versionable_kind(cls, kind):
658
 
        """Check if this tree support versioning a specific file kind."""
659
 
        return (kind in ('file', 'directory', 'symlink', 'tree-reference'))
660
 
 
661
656
 
662
657
class InterTree(InterObject):
663
658
    """This class represents operations taking place between two Trees.
864
859
        # the unversioned path lookup only occurs on real trees - where there
865
860
        # can be extras. So the fake_entry is solely used to look up
866
861
        # executable it values when execute is not supported.
867
 
        fake_entry = TreeFile()
 
862
        fake_entry = inventory.InventoryFile('unused', 'unused', 'unused')
868
863
        for target_path, target_entry in to_entries_by_dir:
869
864
            while (all_unversioned and
870
865
                all_unversioned[0][0] < target_path.split('/')):
1191
1186
            return (None, None)
1192
1187
        else:
1193
1188
            self._out_of_order_processed.add(file_id)
1194
 
            cur_ie = other_tree.root_inventory.get_entry(file_id)
 
1189
            cur_ie = other_tree.root_inventory[file_id]
1195
1190
            return (cur_path, cur_ie)
1196
1191
 
1197
1192
    def iter_all(self):