~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

Use global osutils, otherwise it creates a local var.

Which works, but causes us to run the import on every call.

Show diffs side-by-side

added added

removed removed

Lines of Context:
157
157
        """
158
158
        return self.inventory.id2path(file_id)
159
159
 
160
 
    def is_control_filename(self, filename):
161
 
        """True if filename is the name of a control file in this tree.
162
 
 
163
 
        :param filename: A filename within the tree. This is a relative path
164
 
        from the root of this tree.
165
 
 
166
 
        This is true IF and ONLY IF the filename is part of the meta data
167
 
        that bzr controls in this tree. I.E. a random .bzr directory placed
168
 
        on disk will not be a control file for this tree.
169
 
        """
170
 
        return self.bzrdir.is_control_filename(filename)
171
 
 
172
160
    @needs_read_lock
173
161
    def iter_entries_by_dir(self, specific_file_ids=None, yield_parents=False):
174
162
        """Walk the tree in 'by_dir' order.
520
508
            parent_keys = [(file_id, self._file_revision(t, file_id)) for t in
521
509
                self._iter_parent_trees()]
522
510
            vf.add_lines((file_id, last_revision), parent_keys,
523
 
                         self.get_file(file_id).readlines())
 
511
                         self.get_file_lines(file_id))
524
512
            repo = self.branch.repository
525
513
            base_vf = repo.texts
526
514
        else:
582
570
            yield child.file_id
583
571
 
584
572
    def lock_read(self):
 
573
        """Lock this tree for multiple read only operations.
 
574
        
 
575
        :return: A bzrlib.lock.LogicalLockResult.
 
576
        """
585
577
        pass
586
578
 
587
579
    def revision_tree(self, revision_id):
774
766
    return 'wtf?'
775
767
 
776
768
 
777
 
@deprecated_function(deprecated_in((1, 9, 0)))
778
 
def find_renames(old_inv, new_inv):
779
 
    for file_id in old_inv:
780
 
        if file_id not in new_inv:
781
 
            continue
782
 
        old_name = old_inv.id2path(file_id)
783
 
        new_name = new_inv.id2path(file_id)
784
 
        if old_name != new_name:
785
 
            yield (old_name, new_name)
786
 
 
787
 
 
788
769
def find_ids_across_trees(filenames, trees, require_versioned=True):
789
770
    """Find the ids corresponding to specified filenames.
790
771
 
1126
1107
            if file_id in to_paths:
1127
1108
                # already returned
1128
1109
                continue
1129
 
            if file_id not in self.target.all_file_ids():
 
1110
            if not self.target.has_id(file_id):
1130
1111
                # common case - paths we have not emitted are not present in
1131
1112
                # target.
1132
1113
                to_path = None