~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: INADA Naoki
  • Date: 2011-05-17 00:45:09 UTC
  • mfrom: (5875 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5891.
  • Revision ID: songofacandy@gmail.com-20110517004509-q58negjbdjh7t6u1
mergeĀ fromĀ lp:bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
40
40
from bzrlib.decorators import needs_read_lock
41
41
from bzrlib.inter import InterObject
 
42
from bzrlib.symbol_versioning import (
 
43
    deprecated_in,
 
44
    deprecated_method,
 
45
    )
42
46
 
43
47
 
44
48
class Tree(object):
137
141
        """
138
142
        return False
139
143
 
140
 
    def __iter__(self):
141
 
        """Yield all file ids in this tree."""
142
 
        raise NotImplementedError(self.__iter__)
143
 
 
144
144
    def all_file_ids(self):
145
145
        """Iterate through all file ids, including ids for missing files."""
146
 
        return set(self.inventory)
 
146
        raise NotImplementedError(self.all_file_ids)
147
147
 
148
148
    def id2path(self, file_id):
149
149
        """Return the path for a file id.
359
359
            cur_file = (self.get_file_text(file_id),)
360
360
            yield identifier, cur_file
361
361
 
362
 
    def get_symlink_target(self, file_id):
 
362
    def get_symlink_target(self, file_id, path=None):
363
363
        """Get the target for a given file_id.
364
364
 
365
365
        It is assumed that the caller already knows that file_id is referencing
366
366
        a symlink.
367
367
        :param file_id: Handle for the symlink entry.
 
368
        :param path: The path of the file.
 
369
        If both file_id and path are supplied, an implementation may use
 
370
        either one.
368
371
        :return: The path the symlink points to.
369
372
        """
370
373
        raise NotImplementedError(self.get_symlink_target)
371
374
 
372
 
 
373
375
    def get_root_id(self):
374
376
        """Return the file_id for the root of this tree."""
375
377
        raise NotImplementedError(self.get_root_id)
757
759
    def has_or_had_id(self, file_id):
758
760
        return self.inventory.has_id(file_id)
759
761
 
 
762
    def all_file_ids(self):
 
763
        return set(self.inventory)
 
764
 
 
765
    @deprecated_method(deprecated_in((2, 4, 0)))
760
766
    def __iter__(self):
761
767
        return iter(self.inventory)
762
768
 
936
942
 
937
943
    _optimisers = []
938
944
 
 
945
    @classmethod
 
946
    def is_compatible(kls, source, target):
 
947
        # The default implementation is naive and uses the public API, so
 
948
        # it works for all trees.
 
949
        return True
 
950
 
939
951
    def _changes_from_entries(self, source_entry, target_entry,
940
952
        source_path=None, target_path=None):
941
953
        """Generate a iter_changes tuple between source_entry and target_entry.
1310
1322
                    yield result
1311
1323
 
1312
1324
 
 
1325
InterTree.register_optimiser(InterTree)
 
1326
 
 
1327
 
1313
1328
class MultiWalker(object):
1314
1329
    """Walk multiple trees simultaneously, getting combined results."""
1315
1330