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

  • Committer: Robert Collins
  • Date: 2010-05-06 11:08:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506110810-h3j07fh5gmw54s25
Cleaner matcher matching revised unlocking protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    conflicts as _mod_conflicts,
26
26
    debug,
27
27
    delta,
28
 
    errors,
29
28
    filters,
30
29
    osutils,
31
30
    revision as _mod_revision,
32
31
    rules,
33
32
    )
34
33
from bzrlib.decorators import needs_read_lock
 
34
from bzrlib.errors import BzrError, NoSuchId
 
35
from bzrlib import errors
35
36
from bzrlib.inventory import InventoryFile
36
37
from bzrlib.inter import InterObject
37
38
from bzrlib.osutils import fingerprint_file
 
39
from bzrlib.symbol_versioning import deprecated_function, deprecated_in
38
40
from bzrlib.trace import note
39
41
 
40
42
 
155
157
        """
156
158
        return self.inventory.id2path(file_id)
157
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
 
158
172
    @needs_read_lock
159
173
    def iter_entries_by_dir(self, specific_file_ids=None, yield_parents=False):
160
174
        """Walk the tree in 'by_dir' order.
413
427
                        elif child_base.lower() == lelt:
414
428
                            cur_id = child
415
429
                            new_path = osutils.pathjoin(cur_path, child_base)
416
 
                    except errors.NoSuchId:
 
430
                    except NoSuchId:
417
431
                        # before a change is committed we can see this error...
418
432
                        continue
419
433
                if new_path:
506
520
            parent_keys = [(file_id, self._file_revision(t, file_id)) for t in
507
521
                self._iter_parent_trees()]
508
522
            vf.add_lines((file_id, last_revision), parent_keys,
509
 
                         self.get_file_lines(file_id))
 
523
                         self.get_file(file_id).readlines())
510
524
            repo = self.branch.repository
511
525
            base_vf = repo.texts
512
526
        else:
527
541
 
528
542
        if ie.text_size is not None:
529
543
            if ie.text_size != fp['size']:
530
 
                raise errors.BzrError(
531
 
                        "mismatched size for file %r in %r" %
532
 
                        (ie.file_id, self._store),
 
544
                raise BzrError("mismatched size for file %r in %r" % (ie.file_id, self._store),
533
545
                        ["inventory expects %d bytes" % ie.text_size,
534
546
                         "file is actually %d bytes" % fp['size'],
535
547
                         "store is probably damaged/corrupt"])
536
548
 
537
549
        if ie.text_sha1 != fp['sha1']:
538
 
            raise errors.BzrError("wrong SHA-1 for file %r in %r" %
539
 
                    (ie.file_id, self._store),
 
550
            raise BzrError("wrong SHA-1 for file %r in %r" % (ie.file_id, self._store),
540
551
                    ["inventory expects %s" % ie.text_sha1,
541
552
                     "file is actually %s" % fp['sha1'],
542
553
                     "store is probably damaged/corrupt"])
571
582
            yield child.file_id
572
583
 
573
584
    def lock_read(self):
574
 
        """Lock this tree for multiple read only operations.
575
 
        
576
 
        :return: A bzrlib.lock.LogicalLockResult.
577
 
        """
578
585
        pass
579
586
 
580
587
    def revision_tree(self, revision_id):
767
774
    return 'wtf?'
768
775
 
769
776
 
 
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
 
770
788
def find_ids_across_trees(filenames, trees, require_versioned=True):
771
789
    """Find the ids corresponding to specified filenames.
772
790
 
1108
1126
            if file_id in to_paths:
1109
1127
                # already returned
1110
1128
                continue
1111
 
            if not self.target.has_id(file_id):
 
1129
            if file_id not in self.target.all_file_ids():
1112
1130
                # common case - paths we have not emitted are not present in
1113
1131
                # target.
1114
1132
                to_path = None