~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_tree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-09-03 22:30:56 UTC
  • mfrom: (3644.2.13 index_builder_cleanup)
  • Revision ID: pqm@pqm.ubuntu.com-20080903223056-b108iytb38xkznci
(jam) Streamline BTreeBuilder.add_node et al to make btree creation
        faster.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2009, 2011 Canonical Ltd
 
1
# Copyright (C) 2006, 2008 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
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
"""Tests for Tree and InterTree."""
18
18
 
19
19
from bzrlib import (
20
20
    errors,
21
21
    revision,
 
22
    tests,
22
23
    tree as _mod_tree,
23
24
    )
24
25
from bzrlib.tests import TestCaseWithTransport
41
42
        self.assertIsInstance(optimiser, InterTree)
42
43
 
43
44
    def test_working_tree_revision_tree(self):
44
 
        # we should have an InterTree available for WorkingTree to
 
45
        # we should have an InterTree available for WorkingTree to 
45
46
        # RevisionTree.
46
47
        tree = self.make_branch_and_tree('.')
47
48
        rev_id = tree.commit('first post')
52
53
        self.assertIsInstance(optimiser, InterTree)
53
54
 
54
55
    def test_working_tree_working_tree(self):
55
 
        # we should have an InterTree available for WorkingTree to
 
56
        # we should have an InterTree available for WorkingTree to 
56
57
        # WorkingTree.
57
58
        tree = self.make_branch_and_tree('1')
58
59
        tree2 = self.make_branch_and_tree('2')
71
72
        want_unversioned=False):
72
73
        self.calls.append(
73
74
            ('compare', self.source, self.target, want_unchanged,
74
 
             specific_files, extra_trees, require_versioned,
 
75
             specific_files, extra_trees, require_versioned, 
75
76
             include_root, want_unversioned)
76
77
            )
77
 
 
 
78
    
78
79
    @classmethod
79
80
    def is_compatible(klass, source, target):
80
81
        return True
95
96
            # trivial usage
96
97
            tree.changes_from(tree2)
97
98
            # pass in all optional arguments by position
98
 
            tree.changes_from(tree2, 'unchanged', 'specific', 'extra',
 
99
            tree.changes_from(tree2, 'unchanged', 'specific', 'extra', 
99
100
                              'require', True)
100
101
            # pass in all optional arguments by keyword
101
102
            tree.changes_from(tree2,
122
123
        wt = self.make_branch_and_tree('.')
123
124
        delta = wt.changes_from(wt.basis_tree())
124
125
        self.assertEqual(len(delta.added), 0)
125
 
        delta = wt.changes_from(wt.basis_tree(), include_root=True)
 
126
        delta = wt.changes_from(wt.basis_tree(), wt, include_root=True)
126
127
        self.assertEqual(len(delta.added), 1)
127
128
        self.assertEqual(delta.added[0][0], '')
128
129
 
138
139
 
139
140
        # we need to pass a known file with an unknown file to get this to
140
141
        # fail when expected.
141
 
        delta = wt.changes_from(wt.basis_tree(),
 
142
        delta = wt.changes_from(wt.basis_tree(), wt, 
142
143
            specific_files=['known_file', 'unknown_file'] ,
143
144
            require_versioned=False)
144
145
        self.assertEqual(len(delta.added), 1)
209
210
                other_file_ids.append(None)
210
211
            else:
211
212
                other_file_ids.append(ie.file_id)
212
 
 
 
213
        
213
214
        exp_file_ids = []
214
215
        for path in exp_other_paths:
215
216
            if path is None: