~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

Merge up through 2.2.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2009 Canonical Ltd
 
1
# Copyright (C) 2005-2010 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
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
40
39
from bzrlib.symbol_versioning import deprecated_function, deprecated_in
41
40
from bzrlib.trace import note
42
41
 
98
97
    def iter_changes(self, from_tree, include_unchanged=False,
99
98
                     specific_files=None, pb=None, extra_trees=None,
100
99
                     require_versioned=True, want_unversioned=False):
 
100
        """See InterTree.iter_changes"""
101
101
        intertree = InterTree.get(from_tree, self)
102
102
        return intertree.iter_changes(include_unchanged, specific_files, pb,
103
103
            extra_trees, require_versioned, want_unversioned=want_unversioned)
404
404
            bit_iter = iter(path.split("/"))
405
405
            for elt in bit_iter:
406
406
                lelt = elt.lower()
 
407
                new_path = None
407
408
                for child in self.iter_children(cur_id):
408
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
409
418
                        child_base = os.path.basename(self.id2path(child))
410
 
                        if child_base.lower() == lelt:
 
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
424
                            cur_id = child
412
 
                            cur_path = osutils.pathjoin(cur_path, child_base)
 
425
                            new_path = osutils.pathjoin(cur_path, child_base)
413
426
                            break
 
427
                        elif child_base.lower() == lelt:
 
428
                            cur_id = child
 
429
                            new_path = osutils.pathjoin(cur_path, child_base)
414
430
                    except NoSuchId:
415
431
                        # before a change is committed we can see this error...
416
432
                        continue
 
433
                if new_path:
 
434
                    cur_path = new_path
417
435
                else:
418
436
                    # got to the end of this directory and no entries matched.
419
437
                    # Return what matched so far, plus the rest as specified.
502
520
            parent_keys = [(file_id, self._file_revision(t, file_id)) for t in
503
521
                self._iter_parent_trees()]
504
522
            vf.add_lines((file_id, last_revision), parent_keys,
505
 
                         self.get_file(file_id).readlines())
 
523
                         self.get_file_lines(file_id))
506
524
            repo = self.branch.repository
507
525
            base_vf = repo.texts
508
526
        else:
564
582
            yield child.file_id
565
583
 
566
584
    def lock_read(self):
 
585
        """Lock this tree for multiple read only operations.
 
586
        
 
587
        :return: A bzrlib.lock.LogicalLockResult.
 
588
        """
567
589
        pass
568
590
 
569
591
    def revision_tree(self, revision_id):
697
719
                for path in path_names:
698
720
                    yield searcher.get_items(path)
699
721
 
700
 
    @needs_read_lock
701
722
    def _get_rules_searcher(self, default_searcher):
702
723
        """Get the RulesSearcher for this tree given the default one."""
703
724
        searcher = default_searcher
852
873
    will pass through to InterTree as appropriate.
853
874
    """
854
875
 
 
876
    # Formats that will be used to test this InterTree. If both are
 
877
    # None, this InterTree will not be tested (e.g. because a complex
 
878
    # setup is required)
 
879
    _matching_from_tree_format = None
 
880
    _matching_to_tree_format = None
 
881
 
855
882
    _optimisers = []
856
883
 
857
884
    def _changes_from_entries(self, source_entry, target_entry,
954
981
            a PathsNotVersionedError will be thrown.
955
982
        :param want_unversioned: Scan for unversioned paths.
956
983
        """
957
 
        # NB: show_status depends on being able to pass in non-versioned files
958
 
        # and report them as unknown
959
984
        trees = (self.source,)
960
985
        if extra_trees is not None:
961
986
            trees = trees + tuple(extra_trees)