~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tree.py

  • Committer: Danny van Heumen
  • Date: 2010-03-09 16:38:10 UTC
  • mto: (4634.139.5 2.0)
  • mto: This revision was merged to the branch mainline in revision 5160.
  • Revision ID: danny@dannyvanheumen.nl-20100309163810-ujn8hcx08f75nlf1
Refined test to make use of locking hooks and also validate if lock is truly a checkout-lock.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2009, 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
39
40
from bzrlib.symbol_versioning import deprecated_function, deprecated_in
40
41
from bzrlib.trace import note
41
42
 
97
98
    def iter_changes(self, from_tree, include_unchanged=False,
98
99
                     specific_files=None, pb=None, extra_trees=None,
99
100
                     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)
520
520
            parent_keys = [(file_id, self._file_revision(t, file_id)) for t in
521
521
                self._iter_parent_trees()]
522
522
            vf.add_lines((file_id, last_revision), parent_keys,
523
 
                         self.get_file_lines(file_id))
 
523
                         self.get_file(file_id).readlines())
524
524
            repo = self.branch.repository
525
525
            base_vf = repo.texts
526
526
        else:
582
582
            yield child.file_id
583
583
 
584
584
    def lock_read(self):
585
 
        """Lock this tree for multiple read only operations.
586
 
        
587
 
        :return: A bzrlib.lock.LogicalLockResult.
588
 
        """
589
585
        pass
590
586
 
591
587
    def revision_tree(self, revision_id):
719
715
                for path in path_names:
720
716
                    yield searcher.get_items(path)
721
717
 
 
718
    @needs_read_lock
722
719
    def _get_rules_searcher(self, default_searcher):
723
720
        """Get the RulesSearcher for this tree given the default one."""
724
721
        searcher = default_searcher
873
870
    will pass through to InterTree as appropriate.
874
871
    """
875
872
 
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
 
 
882
873
    _optimisers = []
883
874
 
884
875
    def _changes_from_entries(self, source_entry, target_entry,
981
972
            a PathsNotVersionedError will be thrown.
982
973
        :param want_unversioned: Scan for unversioned paths.
983
974
        """
 
975
        # NB: show_status depends on being able to pass in non-versioned files
 
976
        # and report them as unknown
984
977
        trees = (self.source,)
985
978
        if extra_trees is not None:
986
979
            trees = trees + tuple(extra_trees)
1130
1123
            if file_id in to_paths:
1131
1124
                # already returned
1132
1125
                continue
1133
 
            if not self.target.has_id(file_id):
 
1126
            if file_id not in self.target.all_file_ids():
1134
1127
                # common case - paths we have not emitted are not present in
1135
1128
                # target.
1136
1129
                to_path = None