~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_smart_add.py

  • Committer: Aaron Bentley
  • Date: 2005-09-18 19:00:51 UTC
  • mto: (1185.1.29)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: aaron.bentley@utoronto.ca-20050918190051-991a06375c18492e
Added false 'module does not exist' messages to TODO

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
        paths = ("original/", "original/file1", "original/file2")
14
14
        self.build_tree(paths)
15
15
        branch = Branch(".", init=True)
16
 
        smart_add((".",), False, True)
 
16
        smart_add((".",), recurse=True)
17
17
        for path in paths:
18
18
            self.assertNotEqual(branch.inventory.path2id(path), None)
19
19
 
24
24
        self.build_tree(paths)
25
25
        branch = Branch(".", init=True)
26
26
        os.chdir("original")
27
 
        smart_add((".",), False, True)
 
27
        smart_add((".",), recurse=True)
28
28
        for path in paths:
29
29
            self.assertNotEqual(branch.inventory.path2id(path), None)
30
30
 
36
36
                        "branch/original/file2")
37
37
        self.build_tree(branch_paths)
38
38
        branch = Branch("branch", init=True)
39
 
        smart_add(("branch",), False, True)
 
39
        smart_add(("branch",))
40
40
        for path in paths:
41
41
            self.assertNotEqual(branch.inventory.path2id(path), None)
42
42
 
43
43
    def test_add_above_tree_preserves_tree(self):
44
44
        """Test nested trees are not affect by an add above them."""
45
 
        from bzrlib.add import smart_add
 
45
        from bzrlib.add import smart_add, add_reporter_null
 
46
        
46
47
        paths = ("original/", "original/file1", "original/file2")
47
48
        child_paths = ("path",)
48
49
        full_child_paths = ("original/child", "original/child/path")
52
53
        self.build_tree(build_paths)
53
54
        branch = Branch(".", init=True)
54
55
        child_branch = Branch("original/child", init=True)
55
 
        smart_add((".",), False, True)
 
56
        smart_add((".",), True, add_reporter_null)
56
57
        for path in paths:
57
58
            self.assertNotEqual((path, branch.inventory.path2id(path)),
58
59
                                (path, None))
68
69
        paths = ("file1", "file2")
69
70
        self.build_tree(paths)
70
71
        branch = Branch(".", init=True)
71
 
        smart_add(paths, False, True)
 
72
        smart_add(paths)
72
73
        for path in paths:
73
74
            self.assertNotEqual(branch.inventory.path2id(path), None)
74
75
            
81
82
        paths = ("original/", "original/file1", "original/file2")
82
83
        self.build_tree(paths)
83
84
        branch = Branch(".", init=True)
84
 
        smart_add_branch(branch, (".",), False, True)
 
85
        smart_add_branch(branch, (".",))
85
86
        for path in paths:
86
87
            self.assertNotEqual(branch.inventory.path2id(path), None)
87
88
 
92
93
        self.build_tree(paths)
93
94
        branch = Branch(".", init=True)
94
95
        os.chdir("original")
95
 
        smart_add_branch(branch, (".",), False, True)
 
96
        smart_add_branch(branch, (".",))
96
97
        for path in paths:
97
98
            self.assertNotEqual(branch.inventory.path2id(path), None)
98
99
 
104
105
                        "branch/original/file2")
105
106
        self.build_tree(branch_paths)
106
107
        branch = Branch("branch", init=True)
107
 
        smart_add_branch(branch, ("branch",), False, True)
 
108
        smart_add_branch(branch, ("branch",))
108
109
        for path in paths:
109
110
            self.assertNotEqual(branch.inventory.path2id(path), None)
110
111
 
119
120
        self.build_tree(build_paths)
120
121
        branch = Branch(".", init=True)
121
122
        child_branch = Branch("original/child", init=True)
122
 
        smart_add_branch(branch, (".",), False, True)
 
123
        smart_add_branch(branch, (".",))
123
124
        for path in paths:
124
125
            self.assertNotEqual((path, branch.inventory.path2id(path)),
125
126
                                (path, None))
135
136
        paths = ("file1", "file2")
136
137
        self.build_tree(paths)
137
138
        branch = Branch(".", init=True)
138
 
        smart_add_branch(branch, paths, False, True)
 
139
        smart_add_branch(branch, paths)
139
140
        for path in paths:
140
141
            self.assertNotEqual(branch.inventory.path2id(path), None)
141
142
 
147
148
        self.entry = InventoryEntry("id", "name", "file", None)
148
149
 
149
150
    def test_null_callback(self):
150
 
        from bzrlib.add import _NullAddCallback
151
 
        _NullAddCallback('path', 'file', self.entry)
 
151
        from bzrlib.add import add_reporter_null
 
152
        add_reporter_null('path', 'file', self.entry)
152
153
 
153
154
    def test_print_callback(self):
154
 
        from bzrlib.add import _PrintAddCallback
 
155
        from bzrlib.add import add_reporter_print
155
156
        from StringIO import StringIO
156
157
        stdout = StringIO()
157
 
        self.apply_redirected(None, stdout, None, _PrintAddCallback,
 
158
        self.apply_redirected(None, stdout, None, add_reporter_print,
158
159
                              'path', 'file', self.entry)
159
160
        self.assertEqual(stdout.getvalue(), "added path\n")