/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: John Arbash Meinel
  • Date: 2011-04-07 10:36:24 UTC
  • mfrom: (5764 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5766.
  • Revision ID: john@arbash-meinel.com-20110407103624-n76g6tjeqmznwdcd
Merge bzr.dev 5764 to resolve release-notes (aka NEWS) conflicts

Show diffs side-by-side

added added

removed removed

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