/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 bzrlib/inventory.py

  • Committer: Robert Collins
  • Date: 2007-09-21 06:10:31 UTC
  • mfrom: (2844 +trunk)
  • mto: (2592.3.144 repository)
  • mto: This revision was merged to the branch mainline in revision 2879.
  • Revision ID: robertc@robertcollins.net-20070921061031-p945q13ra1jjcli2
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
809
809
    def _forget_tree_state(self):
810
810
        self.reference_revision = None 
811
811
 
 
812
    def _unchanged(self, previous_ie):
 
813
        """See InventoryEntry._unchanged."""
 
814
        compatible = super(TreeReference, self)._unchanged(previous_ie)
 
815
        if self.reference_revision != previous_ie.reference_revision:
 
816
            compatible = False
 
817
        return compatible
 
818
 
812
819
 
813
820
class Inventory(object):
814
821
    """Inventory of versioned files in a tree.
934
941
                # if we finished all children, pop it off the stack
935
942
                stack.pop()
936
943
 
937
 
    def iter_entries_by_dir(self, from_dir=None, specific_file_ids=None):
 
944
    def iter_entries_by_dir(self, from_dir=None, specific_file_ids=None,
 
945
        yield_parents=False):
938
946
        """Iterate over the entries in a directory first order.
939
947
 
940
948
        This returns all entries for a directory before returning
942
950
        lexicographically sorted order, and is a hybrid between
943
951
        depth-first and breadth-first.
944
952
 
 
953
        :param yield_parents: If True, yield the parents from the root leading
 
954
            down to specific_file_ids that have been requested. This has no
 
955
            impact if specific_file_ids is None.
945
956
        :return: This yields (path, entry) pairs
946
957
        """
947
958
        if specific_file_ids:
953
964
            if self.root is None:
954
965
                return
955
966
            # Optimize a common case
956
 
            if specific_file_ids is not None and len(specific_file_ids) == 1:
 
967
            if (not yield_parents and specific_file_ids is not None and
 
968
                len(specific_file_ids) == 1):
957
969
                file_id = list(specific_file_ids)[0]
958
970
                if file_id in self:
959
971
                    yield self.id2path(file_id), self[file_id]
960
972
                return 
961
973
            from_dir = self.root
962
 
            if (specific_file_ids is None or 
 
974
            if (specific_file_ids is None or yield_parents or
963
975
                self.root.file_id in specific_file_ids):
964
976
                yield u'', self.root
965
977
        elif isinstance(from_dir, basestring):
994
1006
                child_relpath = cur_relpath + child_name
995
1007
 
996
1008
                if (specific_file_ids is None or 
997
 
                    child_ie.file_id in specific_file_ids):
 
1009
                    child_ie.file_id in specific_file_ids or
 
1010
                    (yield_parents and child_ie.file_id in parents)):
998
1011
                    yield child_relpath, child_ie
999
1012
 
1000
1013
                if child_ie.kind == 'directory':