~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_smart_add.py

  • Committer: John Arbash Meinel
  • Date: 2005-09-15 21:35:53 UTC
  • mfrom: (907.1.57)
  • mto: (1393.2.1)
  • mto: This revision was merged to the branch mainline in revision 1396.
  • Revision ID: john@arbash-meinel.com-20050915213552-a6c83a5ef1e20897
(broken) Transport work is merged in. Tests do not pass yet.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
from bzrlib.selftest import TestCaseInTempDir, TestCase
5
5
from bzrlib.branch import Branch
6
6
from bzrlib.errors import NotBranchError, NotVersionedError
7
 
from bzrlib.inventory import InventoryFile
8
7
 
9
8
class TestSmartAdd(TestCaseInTempDir):
10
9
 
13
12
        from bzrlib.add import smart_add
14
13
        paths = ("original/", "original/file1", "original/file2")
15
14
        self.build_tree(paths)
16
 
        branch = Branch.initialize(".")
 
15
        branch = Branch(".", init=True)
17
16
        smart_add((".",), recurse=True)
18
17
        for path in paths:
19
18
            self.assertNotEqual(branch.inventory.path2id(path), None)
23
22
        from bzrlib.add import smart_add
24
23
        paths = ("original/", "original/file1", "original/file2")
25
24
        self.build_tree(paths)
26
 
        branch = Branch.initialize(".")
 
25
        branch = Branch(".", init=True)
27
26
        os.chdir("original")
28
27
        smart_add((".",), recurse=True)
29
28
        for path in paths:
36
35
        branch_paths = ("branch/", "branch/original/", "branch/original/file1",
37
36
                        "branch/original/file2")
38
37
        self.build_tree(branch_paths)
39
 
        branch = Branch.initialize("branch")
 
38
        branch = Branch("branch", init=True)
40
39
        smart_add(("branch",))
41
40
        for path in paths:
42
41
            self.assertNotEqual(branch.inventory.path2id(path), None)
52
51
                       "original/child/", "original/child/path")
53
52
        
54
53
        self.build_tree(build_paths)
55
 
        branch = Branch.initialize(".")
56
 
        child_branch = Branch.initialize("original/child")
 
54
        branch = Branch(".", init=True)
 
55
        child_branch = Branch("original/child", init=True)
57
56
        smart_add((".",), True, add_reporter_null)
58
57
        for path in paths:
59
58
            self.assertNotEqual((path, branch.inventory.path2id(path)),
69
68
        from bzrlib.add import smart_add
70
69
        paths = ("file1", "file2")
71
70
        self.build_tree(paths)
72
 
        branch = Branch.initialize(".")
 
71
        branch = Branch(".", init=True)
73
72
        smart_add(paths)
74
73
        for path in paths:
75
74
            self.assertNotEqual(branch.inventory.path2id(path), None)
82
81
        from bzrlib.add import smart_add_branch
83
82
        paths = ("original/", "original/file1", "original/file2")
84
83
        self.build_tree(paths)
85
 
        branch = Branch.initialize(".")
 
84
        branch = Branch(".", init=True)
86
85
        smart_add_branch(branch, (".",))
87
86
        for path in paths:
88
87
            self.assertNotEqual(branch.inventory.path2id(path), None)
92
91
        from bzrlib.add import smart_add_branch
93
92
        paths = ("original/", "original/file1", "original/file2")
94
93
        self.build_tree(paths)
95
 
        branch = Branch.initialize(".")
 
94
        branch = Branch(".", init=True)
96
95
        os.chdir("original")
97
96
        smart_add_branch(branch, (".",))
98
97
        for path in paths:
105
104
        branch_paths = ("branch/", "branch/original/", "branch/original/file1",
106
105
                        "branch/original/file2")
107
106
        self.build_tree(branch_paths)
108
 
        branch = Branch.initialize("branch")
 
107
        branch = Branch("branch", init=True)
109
108
        smart_add_branch(branch, ("branch",))
110
109
        for path in paths:
111
110
            self.assertNotEqual(branch.inventory.path2id(path), None)
119
118
        build_paths = ("original/", "original/file1", "original/file2", 
120
119
                       "original/child/", "original/child/path")
121
120
        self.build_tree(build_paths)
122
 
        branch = Branch.initialize(".")
123
 
        child_branch = Branch.initialize("original/child")
 
121
        branch = Branch(".", init=True)
 
122
        child_branch = Branch("original/child", init=True)
124
123
        smart_add_branch(branch, (".",))
125
124
        for path in paths:
126
125
            self.assertNotEqual((path, branch.inventory.path2id(path)),
136
135
        from bzrlib.add import smart_add_branch
137
136
        paths = ("file1", "file2")
138
137
        self.build_tree(paths)
139
 
        branch = Branch.initialize(".")
 
138
        branch = Branch(".", init=True)
140
139
        smart_add_branch(branch, paths)
141
140
        for path in paths:
142
141
            self.assertNotEqual(branch.inventory.path2id(path), None)
144
143
class TestAddCallbacks(TestCaseInTempDir):
145
144
 
146
145
    def setUp(self):
 
146
        from bzrlib.inventory import InventoryEntry
147
147
        super(TestAddCallbacks, self).setUp()
148
 
        self.entry = InventoryFile("id", "name", None)
 
148
        self.entry = InventoryEntry("id", "name", "file", None)
149
149
 
150
150
    def test_null_callback(self):
151
151
        from bzrlib.add import add_reporter_null