36
36
# TODO: test that supplying paths with duplication - i.e. foo, foo, foo/bar -
37
37
# does not result in garbage out.
39
# TODO: Are we meant to raise the precise unversioned paths when some are
40
# unversioned - if so, test this.
40
42
class TestPaths2Ids(TestCaseWithWorkingTree):
54
56
self.assertEqual(set(ids), result)
59
def test_paths_none_result_none(self):
60
tree = self.make_branch_and_tree('tree')
62
self.assertEqual(None, tree.paths2ids(None))
57
65
def test_find_single_root(self):
58
66
tree = self.make_branch_and_tree('tree')
59
67
self.assertExpectedIds([tree.path2id('')], tree, [''])
152
160
self.assertRaises(errors.PathsNotVersionedError, tree.paths2ids, ['unversioned'])
155
def test_unversioned_multiple_trees(self):
156
# in this test, the path is unversioned in only one tree, but it should
157
# still raise an error.
158
tree = self.make_branch_and_tree('tree')
159
tree.commit('make basis')
160
basis = tree.basis_tree()
161
self.build_tree(['tree/unversioned'])
163
def test_unversioned_in_one_of_multiple_trees(self):
164
# in this test, the path is unversioned in only one tree, and thus
165
# should not raise an error: it must be unversioned in *all* trees to
167
tree = self.make_branch_and_tree('tree')
168
tree.commit('make basis')
169
basis = tree.basis_tree()
170
self.build_tree(['tree/in-one'])
171
tree.add(['in-one'], ['in-one'])
172
self.assertExpectedIds(['in-one'], tree, ['in-one'], [basis])
174
def test_unversioned_all_of_multiple_trees(self):
175
# in this test, the path is unversioned in every tree, and thus
176
# should not raise an error: it must be unversioned in *all* trees to
178
tree = self.make_branch_and_tree('tree')
179
tree.commit('make basis')
180
basis = tree.basis_tree()
162
181
self.assertExpectedIds([], tree, ['unversioned'], [basis],
163
182
require_versioned=False)