~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_smart_add.py

[merge] robert

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
        branch = Branch.initialize(".")
17
17
        smart_add((".",), recurse=True)
18
18
        for path in paths:
19
 
            self.assertNotEqual(branch.inventory.path2id(path), None)
 
19
            self.assertNotEqual(branch.working_tree().path2id(path), None)
20
20
 
21
21
    def test_add_dot_from_subdir(self):
22
22
        """Test adding . from a subdir of the tree.""" 
27
27
        os.chdir("original")
28
28
        smart_add((".",), recurse=True)
29
29
        for path in paths:
30
 
            self.assertNotEqual(branch.inventory.path2id(path), None)
 
30
            self.assertNotEqual(branch.working_tree().path2id(path), None)
31
31
 
32
32
    def test_add_tree_from_above_tree(self):
33
33
        """Test adding a tree from above the tree.""" 
39
39
        branch = Branch.initialize("branch")
40
40
        smart_add(("branch",))
41
41
        for path in paths:
42
 
            self.assertNotEqual(branch.inventory.path2id(path), None)
 
42
            self.assertNotEqual(branch.working_tree().path2id(path), None)
43
43
 
44
44
    def test_add_above_tree_preserves_tree(self):
45
45
        """Test nested trees are not affect by an add above them."""
56
56
        child_branch = Branch.initialize("original/child")
57
57
        smart_add((".",), True, add_reporter_null)
58
58
        for path in paths:
59
 
            self.assertNotEqual((path, branch.inventory.path2id(path)),
 
59
            self.assertNotEqual((path, branch.working_tree().path2id(path)),
60
60
                                (path, None))
61
61
        for path in full_child_paths:
62
 
            self.assertEqual((path, branch.inventory.path2id(path)),
 
62
            self.assertEqual((path, branch.working_tree().path2id(path)),
63
63
                             (path, None))
64
64
        for path in child_paths:
65
 
            self.assertEqual(child_branch.inventory.path2id(path), None)
 
65
            self.assertEqual(child_branch.working_tree().path2id(path), None)
66
66
 
67
67
    def test_add_paths(self):
68
68
        """Test smart-adding a list of paths."""
72
72
        branch = Branch.initialize(".")
73
73
        smart_add(paths)
74
74
        for path in paths:
75
 
            self.assertNotEqual(branch.inventory.path2id(path), None)
 
75
            self.assertNotEqual(branch.working_tree().path2id(path), None)
76
76
            
77
77
class TestSmartAddBranch(TestCaseInTempDir):
78
78
    """Test smart adds with a specified branch."""
85
85
        branch = Branch.initialize(".")
86
86
        smart_add_branch(branch, (".",))
87
87
        for path in paths:
88
 
            self.assertNotEqual(branch.inventory.path2id(path), None)
 
88
            self.assertNotEqual(branch.working_tree().path2id(path), None)
89
89
 
90
90
    def test_add_dot_from_subdir(self):
91
91
        """Test adding . from a subdir of the tree.""" 
96
96
        os.chdir("original")
97
97
        smart_add_branch(branch, (".",))
98
98
        for path in paths:
99
 
            self.assertNotEqual(branch.inventory.path2id(path), None)
 
99
            self.assertNotEqual(branch.working_tree().path2id(path), None)
100
100
 
101
101
    def test_add_tree_from_above_tree(self):
102
102
        """Test adding a tree from above the tree.""" 
108
108
        branch = Branch.initialize("branch")
109
109
        smart_add_branch(branch, ("branch",))
110
110
        for path in paths:
111
 
            self.assertNotEqual(branch.inventory.path2id(path), None)
 
111
            self.assertNotEqual(branch.working_tree().path2id(path), None)
112
112
 
113
113
    def test_add_above_tree_preserves_tree(self):
114
114
        """Test nested trees are not affect by an add above them."""
123
123
        child_branch = Branch.initialize("original/child")
124
124
        smart_add_branch(branch, (".",))
125
125
        for path in paths:
126
 
            self.assertNotEqual((path, branch.inventory.path2id(path)),
 
126
            self.assertNotEqual((path, branch.working_tree().path2id(path)),
127
127
                                (path, None))
128
128
        for path in full_child_paths:
129
 
            self.assertEqual((path, branch.inventory.path2id(path)),
 
129
            self.assertEqual((path, branch.working_tree().path2id(path)),
130
130
                             (path, None))
131
131
        for path in child_paths:
132
 
            self.assertEqual(child_branch.inventory.path2id(path), None)
 
132
            self.assertEqual(child_branch.working_tree().path2id(path), None)
133
133
 
134
134
    def test_add_paths(self):
135
135
        """Test smart-adding a list of paths."""
139
139
        branch = Branch.initialize(".")
140
140
        smart_add_branch(branch, paths)
141
141
        for path in paths:
142
 
            self.assertNotEqual(branch.inventory.path2id(path), None)
 
142
            self.assertNotEqual(branch.working_tree().path2id(path), None)
143
143
 
144
144
class TestAddCallbacks(TestCaseInTempDir):
145
145