572
572
def id2abspath(self, file_id):
573
573
return self.abspath(self.id2path(file_id))
575
def _check_for_tree_references(self, iterator):
576
"""See if directories have become tree-references."""
577
blocked_parent_ids = set()
578
for path, ie in iterator:
579
if ie.parent_id in blocked_parent_ids:
580
# This entry was pruned because one of its parents became a
581
# TreeReference. If this is a directory, mark it as blocked.
582
if ie.kind == 'directory':
583
blocked_parent_ids.add(ie.file_id)
585
if ie.kind == 'directory' and self._directory_is_tree_reference(path):
586
# This InventoryDirectory needs to be a TreeReference
587
ie = inventory.TreeReference(ie.file_id, ie.name, ie.parent_id)
588
blocked_parent_ids.add(ie.file_id)
591
def iter_entries_by_dir(self, specific_file_ids=None, yield_parents=False):
592
"""See Tree.iter_entries_by_dir()"""
593
# The only trick here is that if we supports_tree_reference then we
594
# need to detect if a directory becomes a tree-reference.
595
iterator = super(WorkingTree, self).iter_entries_by_dir(
596
specific_file_ids=specific_file_ids,
597
yield_parents=yield_parents)
598
if not self.supports_tree_reference():
601
return self._check_for_tree_references(iterator)
575
603
def get_file_size(self, file_id):
576
604
"""See Tree.get_file_size"""
577
605
# XXX: this returns the on-disk size; it should probably return the