~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_tree.py

(jameinel) Allow 'bzr serve' to interpret SIGHUP as a graceful shutdown.
 (bug #795025) (John A Meinel)

Show diffs side-by-side

added added

removed removed

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