~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-11 04:02:41 UTC
  • mfrom: (5017.2.2 tariff)
  • Revision ID: pqm@pqm.ubuntu.com-20100211040241-w6n021dz0uus341n
(mbp) add import-tariff tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
from bzrlib.inventory import InventoryFile
37
37
from bzrlib.inter import InterObject
38
38
from bzrlib.osutils import fingerprint_file
 
39
import bzrlib.revision
39
40
from bzrlib.symbol_versioning import deprecated_function, deprecated_in
40
41
from bzrlib.trace import note
41
42
 
404
405
            bit_iter = iter(path.split("/"))
405
406
            for elt in bit_iter:
406
407
                lelt = elt.lower()
407
 
                new_path = None
408
408
                for child in self.iter_children(cur_id):
409
409
                    try:
410
 
                        # XXX: it seem like if the child is known to be in the
411
 
                        # tree, we shouldn't need to go from its id back to
412
 
                        # its path -- mbp 2010-02-11
413
 
                        #
414
 
                        # XXX: it seems like we could be more efficient
415
 
                        # by just directly looking up the original name and
416
 
                        # only then searching all children; also by not
417
 
                        # chopping paths so much. -- mbp 2010-02-11
418
410
                        child_base = os.path.basename(self.id2path(child))
419
 
                        if (child_base == elt):
420
 
                            # if we found an exact match, we can stop now; if
421
 
                            # we found an approximate match we need to keep
422
 
                            # searching because there might be an exact match
423
 
                            # later.  
 
411
                        if child_base.lower() == lelt:
424
412
                            cur_id = child
425
 
                            new_path = osutils.pathjoin(cur_path, child_base)
 
413
                            cur_path = osutils.pathjoin(cur_path, child_base)
426
414
                            break
427
 
                        elif child_base.lower() == lelt:
428
 
                            cur_id = child
429
 
                            new_path = osutils.pathjoin(cur_path, child_base)
430
415
                    except NoSuchId:
431
416
                        # before a change is committed we can see this error...
432
417
                        continue
433
 
                if new_path:
434
 
                    cur_path = new_path
435
418
                else:
436
419
                    # got to the end of this directory and no entries matched.
437
420
                    # Return what matched so far, plus the rest as specified.
520
503
            parent_keys = [(file_id, self._file_revision(t, file_id)) for t in
521
504
                self._iter_parent_trees()]
522
505
            vf.add_lines((file_id, last_revision), parent_keys,
523
 
                         self.get_file_lines(file_id))
 
506
                         self.get_file(file_id).readlines())
524
507
            repo = self.branch.repository
525
508
            base_vf = repo.texts
526
509
        else:
582
565
            yield child.file_id
583
566
 
584
567
    def lock_read(self):
585
 
        """Lock this tree for multiple read only operations.
586
 
        
587
 
        :return: A bzrlib.lock.LogicalLockResult.
588
 
        """
589
568
        pass
590
569
 
591
570
    def revision_tree(self, revision_id):
1130
1109
            if file_id in to_paths:
1131
1110
                # already returned
1132
1111
                continue
1133
 
            if not self.target.has_id(file_id):
 
1112
            if file_id not in self.target.all_file_ids():
1134
1113
                # common case - paths we have not emitted are not present in
1135
1114
                # target.
1136
1115
                to_path = None