Merge lp:~jelmer/brz/get-root-id into lp:brz
- get-root-id
- Merge into trunk
Proposed by
Jelmer Vernooij
Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | no longer in the source branch. |
Merge reported by: | The Breezy Bot |
Merged at revision: | not available |
Proposed branch: | lp:~jelmer/brz/get-root-id |
Merge into: | lp:brz |
Diff against target: |
1877 lines (+187/-249) 56 files modified
breezy/bzr/bundle/bundle_data.py (+1/-4) breezy/bzr/bzrdir.py (+1/-1) breezy/bzr/fetch.py (+3/-3) breezy/bzr/inventorytree.py (+0/-4) breezy/bzr/vf_repository.py (+1/-1) breezy/bzr/workingtree.py (+3/-8) breezy/bzr/workingtree_3.py (+2/-2) breezy/bzr/workingtree_4.py (+3/-11) breezy/git/object_store.py (+2/-2) breezy/git/tests/test_repository.py (+1/-1) breezy/git/tree.py (+1/-9) breezy/git/workingtree.py (+1/-1) breezy/memorytree.py (+0/-3) breezy/merge.py (+1/-1) breezy/plugins/weave_fmt/workingtree.py (+2/-2) breezy/tests/blackbox/test_join.py (+1/-1) breezy/tests/per_intertree/test_compare.py (+44/-44) breezy/tests/per_repository/test_commit_builder.py (+2/-2) breezy/tests/per_repository/test_repository.py (+0/-1) breezy/tests/per_repository_vf/test_fileid_involved.py (+2/-2) breezy/tests/per_repository_vf/test_repository.py (+1/-1) breezy/tests/per_tree/test_get_root_id.py (+3/-3) breezy/tests/per_tree/test_ids.py (+1/-1) breezy/tests/per_tree/test_test_trees.py (+1/-1) breezy/tests/per_tree/test_tree.py (+1/-1) breezy/tests/per_workingtree/test_add.py (+2/-2) breezy/tests/per_workingtree/test_add_reference.py (+2/-2) breezy/tests/per_workingtree/test_commit.py (+2/-5) breezy/tests/per_workingtree/test_flush.py (+6/-15) breezy/tests/per_workingtree/test_inv.py (+6/-6) breezy/tests/per_workingtree/test_locking.py (+4/-4) breezy/tests/per_workingtree/test_merge_from_branch.py (+1/-1) breezy/tests/per_workingtree/test_pull.py (+4/-4) breezy/tests/per_workingtree/test_rename_one.py (+0/-1) breezy/tests/per_workingtree/test_set_root_id.py (+8/-11) breezy/tests/per_workingtree/test_workingtree.py (+7/-7) breezy/tests/test__dirstate_helpers.py (+1/-1) breezy/tests/test_commit_merge.py (+1/-1) breezy/tests/test_dirstate.py (+13/-16) breezy/tests/test_extract.py (+1/-1) breezy/tests/test_fetch.py (+1/-1) breezy/tests/test_matchers.py (+1/-1) breezy/tests/test_memorytree.py (+1/-1) breezy/tests/test_merge.py (+3/-3) breezy/tests/test_revert.py (+2/-2) breezy/tests/test_revisiontree.py (+1/-1) breezy/tests/test_shelf_ui.py (+3/-3) breezy/tests/test_smart_add.py (+1/-1) breezy/tests/test_subsume.py (+4/-4) breezy/tests/test_switch.py (+1/-1) breezy/tests/test_transform.py (+13/-13) breezy/tests/test_workingtree_4.py (+5/-8) breezy/transform.py (+7/-10) breezy/tree.py (+0/-4) breezy/workingtree.py (+5/-9) doc/en/release-notes/brz-3.1.txt (+3/-0) |
To merge this branch: | bzr merge lp:~jelmer/brz/get-root-id |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Packman | Approve | ||
Review via email: mp+369477@code.launchpad.net |
Commit message
Remove Tree.get_root_id() in favour of Tree.path2id('').
Description of the change
Remove Tree.get_root_id() in favour of Tree.path2id('').
This is a mechanical change, just s/get_root_
To post a comment you must log in.
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Merging failed
https:/
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'breezy/bzr/bundle/bundle_data.py' | |||
2 | --- breezy/bzr/bundle/bundle_data.py 2019-06-30 10:50:40 +0000 | |||
3 | +++ breezy/bzr/bundle/bundle_data.py 2019-07-25 23:25:31 +0000 | |||
4 | @@ -579,9 +579,6 @@ | |||
5 | 579 | return None | 579 | return None |
6 | 580 | return new_path | 580 | return new_path |
7 | 581 | 581 | ||
8 | 582 | def get_root_id(self): | ||
9 | 583 | return self.path2id('') | ||
10 | 584 | |||
11 | 585 | def path2id(self, path): | 582 | def path2id(self, path): |
12 | 586 | """Return the id of the file present at path in the target tree.""" | 583 | """Return the id of the file present at path in the target tree.""" |
13 | 587 | file_id = self._new_id.get(path) | 584 | file_id = self._new_id.get(path) |
14 | @@ -629,7 +626,7 @@ | |||
15 | 629 | file_id = self.path2id(path) | 626 | file_id = self.path2id(path) |
16 | 630 | base_id = self.old_contents_id(file_id) | 627 | base_id = self.old_contents_id(file_id) |
17 | 631 | if (base_id is not None and | 628 | if (base_id is not None and |
19 | 632 | base_id != self.base_tree.get_root_id()): | 629 | base_id != self.base_tree.path2id('')): |
20 | 633 | old_path = self.base_tree.id2path(base_id) | 630 | old_path = self.base_tree.id2path(base_id) |
21 | 634 | patch_original = self.base_tree.get_file(old_path) | 631 | patch_original = self.base_tree.get_file(old_path) |
22 | 635 | else: | 632 | else: |
23 | 636 | 633 | ||
24 | === modified file 'breezy/bzr/bzrdir.py' | |||
25 | --- breezy/bzr/bzrdir.py 2019-06-21 16:36:04 +0000 | |||
26 | +++ breezy/bzr/bzrdir.py 2019-07-25 23:25:31 +0000 | |||
27 | @@ -459,7 +459,7 @@ | |||
28 | 459 | with wt.lock_write(): | 459 | with wt.lock_write(): |
29 | 460 | if not wt.is_versioned(''): | 460 | if not wt.is_versioned(''): |
30 | 461 | try: | 461 | try: |
32 | 462 | wt.set_root_id(self.open_workingtree.get_root_id()) | 462 | wt.set_root_id(self.open_workingtree.path2id('')) |
33 | 463 | except errors.NoWorkingTree: | 463 | except errors.NoWorkingTree: |
34 | 464 | pass | 464 | pass |
35 | 465 | else: | 465 | else: |
36 | 466 | 466 | ||
37 | === modified file 'breezy/bzr/fetch.py' | |||
38 | --- breezy/bzr/fetch.py 2018-11-16 18:33:17 +0000 | |||
39 | +++ breezy/bzr/fetch.py 2019-07-25 23:25:31 +0000 | |||
40 | @@ -211,7 +211,7 @@ | |||
41 | 211 | def _find_root_ids(self, revs, parent_map, graph): | 211 | def _find_root_ids(self, revs, parent_map, graph): |
42 | 212 | revision_root = {} | 212 | revision_root = {} |
43 | 213 | for tree in self.iter_rev_trees(revs): | 213 | for tree in self.iter_rev_trees(revs): |
45 | 214 | root_id = tree.get_root_id() | 214 | root_id = tree.path2id('') |
46 | 215 | revision_id = tree.get_file_revision(u'') | 215 | revision_id = tree.get_file_revision(u'') |
47 | 216 | revision_root[revision_id] = root_id | 216 | revision_root[revision_id] = root_id |
48 | 217 | # Find out which parents we don't already know root ids for | 217 | # Find out which parents we don't already know root ids for |
49 | @@ -221,7 +221,7 @@ | |||
50 | 221 | # Limit to revisions present in the versionedfile | 221 | # Limit to revisions present in the versionedfile |
51 | 222 | parents = graph.get_parent_map(parents) | 222 | parents = graph.get_parent_map(parents) |
52 | 223 | for tree in self.iter_rev_trees(parents): | 223 | for tree in self.iter_rev_trees(parents): |
54 | 224 | root_id = tree.get_root_id() | 224 | root_id = tree.path2id('') |
55 | 225 | revision_root[tree.get_revision_id()] = root_id | 225 | revision_root[tree.get_revision_id()] = root_id |
56 | 226 | return revision_root | 226 | return revision_root |
57 | 227 | 227 | ||
58 | @@ -296,7 +296,7 @@ | |||
59 | 296 | # But set parent_root_id to None since we don't really know | 296 | # But set parent_root_id to None since we don't really know |
60 | 297 | parent_root_id = None | 297 | parent_root_id = None |
61 | 298 | else: | 298 | else: |
63 | 299 | parent_root_id = tree.get_root_id() | 299 | parent_root_id = tree.path2id('') |
64 | 300 | rev_id_to_root_id_map[parent_id] = None | 300 | rev_id_to_root_id_map[parent_id] = None |
65 | 301 | # XXX: why not: | 301 | # XXX: why not: |
66 | 302 | # rev_id_to_root_id_map[parent_id] = parent_root_id | 302 | # rev_id_to_root_id_map[parent_id] = parent_root_id |
67 | 303 | 303 | ||
68 | === modified file 'breezy/bzr/inventorytree.py' | |||
69 | --- breezy/bzr/inventorytree.py 2019-06-29 12:29:45 +0000 | |||
70 | +++ breezy/bzr/inventorytree.py 2019-07-25 23:25:31 +0000 | |||
71 | @@ -778,10 +778,6 @@ | |||
72 | 778 | nested_revid = self.get_reference_revision(path) | 778 | nested_revid = self.get_reference_revision(path) |
73 | 779 | raise MissingNestedTree(path) | 779 | raise MissingNestedTree(path) |
74 | 780 | 780 | ||
75 | 781 | def get_root_id(self): | ||
76 | 782 | if self.root_inventory.root: | ||
77 | 783 | return self.root_inventory.root.file_id | ||
78 | 784 | |||
79 | 785 | def kind(self, path): | 781 | def kind(self, path): |
80 | 786 | return self._path2ie(path).kind | 782 | return self._path2ie(path).kind |
81 | 787 | 783 | ||
82 | 788 | 784 | ||
83 | === modified file 'breezy/bzr/vf_repository.py' | |||
84 | --- breezy/bzr/vf_repository.py 2019-06-30 10:50:40 +0000 | |||
85 | +++ breezy/bzr/vf_repository.py 2019-07-25 23:25:31 +0000 | |||
86 | @@ -2642,7 +2642,7 @@ | |||
87 | 2642 | current_revision_id, revision.parent_ids)) | 2642 | current_revision_id, revision.parent_ids)) |
88 | 2643 | if self._converting_to_rich_root: | 2643 | if self._converting_to_rich_root: |
89 | 2644 | self._revision_id_to_root_id[current_revision_id] = \ | 2644 | self._revision_id_to_root_id[current_revision_id] = \ |
91 | 2645 | tree.get_root_id() | 2645 | tree.path2id('') |
92 | 2646 | # Determine which texts are in present in this revision but not in | 2646 | # Determine which texts are in present in this revision but not in |
93 | 2647 | # any of the available parents. | 2647 | # any of the available parents. |
94 | 2648 | texts_possibly_new_in_tree = set() | 2648 | texts_possibly_new_in_tree = set() |
95 | 2649 | 2649 | ||
96 | === modified file 'breezy/bzr/workingtree.py' | |||
97 | --- breezy/bzr/workingtree.py 2019-06-22 10:30:21 +0000 | |||
98 | +++ breezy/bzr/workingtree.py 2019-07-25 23:25:31 +0000 | |||
99 | @@ -284,7 +284,7 @@ | |||
100 | 284 | InventoryFile, | 284 | InventoryFile, |
101 | 285 | InventoryLink) | 285 | InventoryLink) |
102 | 286 | with self.lock_tree_write(): | 286 | with self.lock_tree_write(): |
104 | 287 | inv = Inventory(self.get_root_id()) | 287 | inv = Inventory(self.path2id('')) |
105 | 288 | for path, file_id, parent, kind in new_inventory_list: | 288 | for path, file_id, parent, kind in new_inventory_list: |
106 | 289 | name = os.path.basename(path) | 289 | name = os.path.basename(path) |
107 | 290 | if name == "": | 290 | if name == "": |
108 | @@ -658,11 +658,6 @@ | |||
109 | 658 | self._set_inventory(result, dirty=False) | 658 | self._set_inventory(result, dirty=False) |
110 | 659 | return result | 659 | return result |
111 | 660 | 660 | ||
112 | 661 | def get_root_id(self): | ||
113 | 662 | """Return the id of this trees root""" | ||
114 | 663 | with self.lock_read(): | ||
115 | 664 | return self._inventory.root.file_id | ||
116 | 665 | |||
117 | 666 | def has_id(self, file_id): | 661 | def has_id(self, file_id): |
118 | 667 | # files that have been deleted are excluded | 662 | # files that have been deleted are excluded |
119 | 668 | inv, inv_file_id = self._unpack_file_id(file_id) | 663 | inv, inv_file_id = self._unpack_file_id(file_id) |
120 | @@ -672,7 +667,7 @@ | |||
121 | 672 | return osutils.lexists(self.abspath(path)) | 667 | return osutils.lexists(self.abspath(path)) |
122 | 673 | 668 | ||
123 | 674 | def has_or_had_id(self, file_id): | 669 | def has_or_had_id(self, file_id): |
125 | 675 | if file_id == self.get_root_id(): | 670 | if file_id == self.path2id(''): |
126 | 676 | return True | 671 | return True |
127 | 677 | inv, inv_file_id = self._unpack_file_id(file_id) | 672 | inv, inv_file_id = self._unpack_file_id(file_id) |
128 | 678 | return inv.has_id(inv_file_id) | 673 | return inv.has_id(inv_file_id) |
129 | @@ -951,7 +946,7 @@ | |||
130 | 951 | if child_entry.kind == 'directory': | 946 | if child_entry.kind == 'directory': |
131 | 952 | add_children(inventory, child_entry) | 947 | add_children(inventory, child_entry) |
132 | 953 | with self.lock_write(): | 948 | with self.lock_write(): |
134 | 954 | if other_tree.get_root_id() == self.get_root_id(): | 949 | if other_tree.path2id('') == self.path2id(''): |
135 | 955 | raise errors.BadSubsumeSource(self, other_tree, | 950 | raise errors.BadSubsumeSource(self, other_tree, |
136 | 956 | 'Trees have the same root') | 951 | 'Trees have the same root') |
137 | 957 | try: | 952 | try: |
138 | 958 | 953 | ||
139 | === modified file 'breezy/bzr/workingtree_3.py' | |||
140 | --- breezy/bzr/workingtree_3.py 2018-12-04 19:22:35 +0000 | |||
141 | +++ breezy/bzr/workingtree_3.py 2019-07-25 23:25:31 +0000 | |||
142 | @@ -224,8 +224,8 @@ | |||
143 | 224 | try: | 224 | try: |
144 | 225 | basis_tree = branch.repository.revision_tree(revision_id) | 225 | basis_tree = branch.repository.revision_tree(revision_id) |
145 | 226 | # only set an explicit root id if there is one to set. | 226 | # only set an explicit root id if there is one to set. |
148 | 227 | if basis_tree.get_root_id() is not None: | 227 | if basis_tree.path2id('') is not None: |
149 | 228 | wt.set_root_id(basis_tree.get_root_id()) | 228 | wt.set_root_id(basis_tree.path2id('')) |
150 | 229 | if revision_id == _mod_revision.NULL_REVISION: | 229 | if revision_id == _mod_revision.NULL_REVISION: |
151 | 230 | wt.set_parent_trees([]) | 230 | wt.set_parent_trees([]) |
152 | 231 | else: | 231 | else: |
153 | 232 | 232 | ||
154 | === modified file 'breezy/bzr/workingtree_4.py' | |||
155 | --- breezy/bzr/workingtree_4.py 2019-06-29 12:29:45 +0000 | |||
156 | +++ breezy/bzr/workingtree_4.py 2019-07-25 23:25:31 +0000 | |||
157 | @@ -171,8 +171,8 @@ | |||
158 | 171 | except errors.PathNotChild: | 171 | except errors.PathNotChild: |
159 | 172 | raise BadReferenceTarget(self, sub_tree, | 172 | raise BadReferenceTarget(self, sub_tree, |
160 | 173 | 'Target not inside tree.') | 173 | 'Target not inside tree.') |
163 | 174 | sub_tree_id = sub_tree.get_root_id() | 174 | sub_tree_id = sub_tree.path2id('') |
164 | 175 | if sub_tree_id == self.get_root_id(): | 175 | if sub_tree_id == self.path2id(''): |
165 | 176 | raise BadReferenceTarget(self, sub_tree, | 176 | raise BadReferenceTarget(self, sub_tree, |
166 | 177 | 'Trees have the same root id.') | 177 | 'Trees have the same root id.') |
167 | 178 | if self.has_id(sub_tree_id): | 178 | if self.has_id(sub_tree_id): |
168 | @@ -467,11 +467,6 @@ | |||
169 | 467 | def get_nested_tree(self, path): | 467 | def get_nested_tree(self, path): |
170 | 468 | return WorkingTree.open(self.abspath(path)) | 468 | return WorkingTree.open(self.abspath(path)) |
171 | 469 | 469 | ||
172 | 470 | def get_root_id(self): | ||
173 | 471 | """Return the id of this trees root""" | ||
174 | 472 | with self.lock_read(): | ||
175 | 473 | return self._get_entry(path='')[0][2] | ||
176 | 474 | |||
177 | 475 | def has_id(self, file_id): | 470 | def has_id(self, file_id): |
178 | 476 | state = self.current_dirstate() | 471 | state = self.current_dirstate() |
179 | 477 | row, parents = self._get_entry(file_id=file_id) | 472 | row, parents = self._get_entry(file_id=file_id) |
180 | @@ -1549,7 +1544,7 @@ | |||
181 | 1549 | wt.flush() | 1544 | wt.flush() |
182 | 1550 | # if the basis has a root id we have to use that; otherwise we | 1545 | # if the basis has a root id we have to use that; otherwise we |
183 | 1551 | # use a new random one | 1546 | # use a new random one |
185 | 1552 | basis_root_id = basis.get_root_id() | 1547 | basis_root_id = basis.path2id('') |
186 | 1553 | if basis_root_id is not None: | 1548 | if basis_root_id is not None: |
187 | 1554 | wt._set_root_id(basis_root_id) | 1549 | wt._set_root_id(basis_root_id) |
188 | 1555 | wt.flush() | 1550 | wt.flush() |
189 | @@ -1748,9 +1743,6 @@ | |||
190 | 1748 | pred = self.has_filename | 1743 | pred = self.has_filename |
191 | 1749 | return set((p for p in paths if not pred(p))) | 1744 | return set((p for p in paths if not pred(p))) |
192 | 1750 | 1745 | ||
193 | 1751 | def get_root_id(self): | ||
194 | 1752 | return self.path2id('') | ||
195 | 1753 | |||
196 | 1754 | def id2path(self, file_id): | 1746 | def id2path(self, file_id): |
197 | 1755 | "Convert a file-id to a path." | 1747 | "Convert a file-id to a path." |
198 | 1756 | entry = self._get_entry(file_id=file_id) | 1748 | entry = self._get_entry(file_id=file_id) |
199 | 1757 | 1749 | ||
200 | === modified file 'breezy/git/object_store.py' | |||
201 | --- breezy/git/object_store.py 2019-07-25 22:52:58 +0000 | |||
202 | +++ breezy/git/object_store.py 2019-07-25 23:25:31 +0000 | |||
203 | @@ -518,7 +518,7 @@ | |||
204 | 518 | else: | 518 | else: |
205 | 519 | base_sha1 = self._lookup_revision_sha1(rev.parent_ids[0]) | 519 | base_sha1 = self._lookup_revision_sha1(rev.parent_ids[0]) |
206 | 520 | root_tree = self[self[base_sha1].tree] | 520 | root_tree = self[self[base_sha1].tree] |
208 | 521 | root_key_data = (tree.get_root_id(), tree.get_revision_id()) | 521 | root_key_data = (tree.path2id(''), tree.get_revision_id()) |
209 | 522 | if add_cache_entry is not None: | 522 | if add_cache_entry is not None: |
210 | 523 | add_cache_entry(root_tree, root_key_data, "") | 523 | add_cache_entry(root_tree, root_key_data, "") |
211 | 524 | yield "", root_tree | 524 | yield "", root_tree |
212 | @@ -614,7 +614,7 @@ | |||
213 | 614 | path, | 614 | path, |
214 | 615 | bzr_tree.iter_child_entries(path), | 615 | bzr_tree.iter_child_entries(path), |
215 | 616 | get_ie_sha1, unusual_modes, self.mapping.BZR_DUMMY_FILE, | 616 | get_ie_sha1, unusual_modes, self.mapping.BZR_DUMMY_FILE, |
217 | 617 | bzr_tree.get_root_id() == fileid) | 617 | bzr_tree.path2id('') == fileid) |
218 | 618 | if tree is not None: | 618 | if tree is not None: |
219 | 619 | _check_expected_sha(expected_sha, tree) | 619 | _check_expected_sha(expected_sha, tree) |
220 | 620 | return tree | 620 | return tree |
221 | 621 | 621 | ||
222 | === modified file 'breezy/git/tests/test_repository.py' | |||
223 | --- breezy/git/tests/test_repository.py 2018-11-21 21:34:30 +0000 | |||
224 | +++ breezy/git/tests/test_repository.py 2019-07-25 23:25:31 +0000 | |||
225 | @@ -190,7 +190,7 @@ | |||
226 | 190 | repo = self.git_repo | 190 | repo = self.git_repo |
227 | 191 | tree = repo.revision_tree(revision.NULL_REVISION) | 191 | tree = repo.revision_tree(revision.NULL_REVISION) |
228 | 192 | self.assertEqual(tree.get_revision_id(), revision.NULL_REVISION) | 192 | self.assertEqual(tree.get_revision_id(), revision.NULL_REVISION) |
230 | 193 | self.assertIs(None, tree.get_root_id()) | 193 | self.assertIs(None, tree.path2id('')) |
231 | 194 | 194 | ||
232 | 195 | def test_get_parent_map_null(self): | 195 | def test_get_parent_map_null(self): |
233 | 196 | self.assertEqual({revision.NULL_REVISION: ()}, | 196 | self.assertEqual({revision.NULL_REVISION: ()}, |
234 | 197 | 197 | ||
235 | === modified file 'breezy/git/tree.py' | |||
236 | --- breezy/git/tree.py 2019-07-25 22:52:58 +0000 | |||
237 | +++ breezy/git/tree.py 2019-07-25 23:25:31 +0000 | |||
238 | @@ -360,11 +360,6 @@ | |||
239 | 360 | todo.append((store, subpath, hexsha)) | 360 | todo.append((store, subpath, hexsha)) |
240 | 361 | return ret | 361 | return ret |
241 | 362 | 362 | ||
242 | 363 | def get_root_id(self): | ||
243 | 364 | if self.tree is None: | ||
244 | 365 | return None | ||
245 | 366 | return self.path2id("") | ||
246 | 367 | |||
247 | 368 | def has_or_had_id(self, file_id): | 363 | def has_or_had_id(self, file_id): |
248 | 369 | try: | 364 | try: |
249 | 370 | self.id2path(file_id) | 365 | self.id2path(file_id) |
250 | @@ -512,7 +507,7 @@ | |||
251 | 512 | else: | 507 | else: |
252 | 513 | specific_files = set([p.encode('utf-8') | 508 | specific_files = set([p.encode('utf-8') |
253 | 514 | for p in specific_files]) | 509 | for p in specific_files]) |
255 | 515 | todo = deque([(self.store, b"", self.tree, self.get_root_id())]) | 510 | todo = deque([(self.store, b"", self.tree, self.path2id(''))]) |
256 | 516 | if specific_files is None or u"" in specific_files: | 511 | if specific_files is None or u"" in specific_files: |
257 | 517 | yield u"", self._get_dir_ie(b"", None) | 512 | yield u"", self._get_dir_ie(b"", None) |
258 | 518 | while todo: | 513 | while todo: |
259 | @@ -1016,9 +1011,6 @@ | |||
260 | 1016 | def _set_root_id(self, file_id): | 1011 | def _set_root_id(self, file_id): |
261 | 1017 | raise errors.UnsupportedOperation(self._set_root_id, self) | 1012 | raise errors.UnsupportedOperation(self._set_root_id, self) |
262 | 1018 | 1013 | ||
263 | 1019 | def get_root_id(self): | ||
264 | 1020 | return self.path2id(u"") | ||
265 | 1021 | |||
266 | 1022 | def _add(self, files, ids, kinds): | 1014 | def _add(self, files, ids, kinds): |
267 | 1023 | for (path, file_id, kind) in zip(files, ids, kinds): | 1015 | for (path, file_id, kind) in zip(files, ids, kinds): |
268 | 1024 | if file_id is not None: | 1016 | if file_id is not None: |
269 | 1025 | 1017 | ||
270 | === modified file 'breezy/git/workingtree.py' | |||
271 | --- breezy/git/workingtree.py 2019-06-29 15:50:22 +0000 | |||
272 | +++ breezy/git/workingtree.py 2019-07-25 23:25:31 +0000 | |||
273 | @@ -1039,7 +1039,7 @@ | |||
274 | 1039 | prefix = prefix.encode('utf-8') | 1039 | prefix = prefix.encode('utf-8') |
275 | 1040 | per_dir = defaultdict(set) | 1040 | per_dir = defaultdict(set) |
276 | 1041 | if prefix == b"": | 1041 | if prefix == b"": |
278 | 1042 | per_dir[(u'', self.get_root_id())] = set() | 1042 | per_dir[(u'', self.path2id(''))] = set() |
279 | 1043 | 1043 | ||
280 | 1044 | def add_entry(path, kind): | 1044 | def add_entry(path, kind): |
281 | 1045 | if path == b'' or not path.startswith(prefix): | 1045 | if path == b'' or not path.startswith(prefix): |
282 | 1046 | 1046 | ||
283 | === modified file 'breezy/memorytree.py' | |||
284 | --- breezy/memorytree.py 2019-03-04 00:19:25 +0000 | |||
285 | +++ breezy/memorytree.py 2019-07-25 23:25:31 +0000 | |||
286 | @@ -106,9 +106,6 @@ | |||
287 | 106 | stream = self._file_transport.get(path) | 106 | stream = self._file_transport.get(path) |
288 | 107 | return sha_file(stream) | 107 | return sha_file(stream) |
289 | 108 | 108 | ||
290 | 109 | def get_root_id(self): | ||
291 | 110 | return self.path2id('') | ||
292 | 111 | |||
293 | 112 | def _comparison_data(self, entry, path): | 109 | def _comparison_data(self, entry, path): |
294 | 113 | """See Tree._comparison_data.""" | 110 | """See Tree._comparison_data.""" |
295 | 114 | if entry is None: | 111 | if entry is None: |
296 | 115 | 112 | ||
297 | === modified file 'breezy/merge.py' | |||
298 | --- breezy/merge.py 2019-06-22 13:51:23 +0000 | |||
299 | +++ breezy/merge.py 2019-07-25 23:25:31 +0000 | |||
300 | @@ -1563,7 +1563,7 @@ | |||
301 | 1563 | if other_parent is None or other_name is None: | 1563 | if other_parent is None or other_name is None: |
302 | 1564 | other_path = '<deleted>' | 1564 | other_path = '<deleted>' |
303 | 1565 | else: | 1565 | else: |
305 | 1566 | if other_parent == self.other_tree.get_root_id(): | 1566 | if other_parent == self.other_tree.path2id(''): |
306 | 1567 | # The tree transform doesn't know about the other root, | 1567 | # The tree transform doesn't know about the other root, |
307 | 1568 | # so we special case here to avoid a NoFinalPath | 1568 | # so we special case here to avoid a NoFinalPath |
308 | 1569 | # exception | 1569 | # exception |
309 | 1570 | 1570 | ||
310 | === modified file 'breezy/plugins/weave_fmt/workingtree.py' | |||
311 | --- breezy/plugins/weave_fmt/workingtree.py 2018-11-21 03:20:30 +0000 | |||
312 | +++ breezy/plugins/weave_fmt/workingtree.py 2019-07-25 23:25:31 +0000 | |||
313 | @@ -111,8 +111,8 @@ | |||
314 | 111 | _controldir=a_controldir, | 111 | _controldir=a_controldir, |
315 | 112 | _control_files=branch.control_files) | 112 | _control_files=branch.control_files) |
316 | 113 | basis_tree = branch.repository.revision_tree(revision_id) | 113 | basis_tree = branch.repository.revision_tree(revision_id) |
319 | 114 | if basis_tree.get_root_id() is not None: | 114 | if basis_tree.path2id('') is not None: |
320 | 115 | wt.set_root_id(basis_tree.get_root_id()) | 115 | wt.set_root_id(basis_tree.path2id('')) |
321 | 116 | # set the parent list and cache the basis tree. | 116 | # set the parent list and cache the basis tree. |
322 | 117 | if _mod_revision.is_null(revision_id): | 117 | if _mod_revision.is_null(revision_id): |
323 | 118 | parent_trees = [] | 118 | parent_trees = [] |
324 | 119 | 119 | ||
325 | === modified file 'breezy/tests/blackbox/test_join.py' | |||
326 | --- breezy/tests/blackbox/test_join.py 2018-11-11 04:08:32 +0000 | |||
327 | +++ breezy/tests/blackbox/test_join.py 2019-07-25 23:25:31 +0000 | |||
328 | @@ -67,7 +67,7 @@ | |||
329 | 67 | def test_join_reference(self): | 67 | def test_join_reference(self): |
330 | 68 | """Join can add a reference if --reference is supplied""" | 68 | """Join can add a reference if --reference is supplied""" |
331 | 69 | base_tree, sub_tree = self.make_trees() | 69 | base_tree, sub_tree = self.make_trees() |
333 | 70 | subtree_root_id = sub_tree.get_root_id() | 70 | subtree_root_id = sub_tree.path2id('') |
334 | 71 | self.run_bzr('join . --reference', working_dir='tree/subtree') | 71 | self.run_bzr('join . --reference', working_dir='tree/subtree') |
335 | 72 | sub_tree.lock_read() | 72 | sub_tree.lock_read() |
336 | 73 | self.addCleanup(sub_tree.unlock) | 73 | self.addCleanup(sub_tree.unlock) |
337 | 74 | 74 | ||
338 | === modified file 'breezy/tests/per_intertree/test_compare.py' | |||
339 | --- breezy/tests/per_intertree/test_compare.py 2019-06-17 23:01:58 +0000 | |||
340 | +++ breezy/tests/per_intertree/test_compare.py 2019-07-25 23:25:31 +0000 | |||
341 | @@ -73,7 +73,7 @@ | |||
342 | 73 | def test_compare_empty_trees(self): | 73 | def test_compare_empty_trees(self): |
343 | 74 | tree1 = self.make_branch_and_tree('1') | 74 | tree1 = self.make_branch_and_tree('1') |
344 | 75 | tree2 = self.make_to_branch_and_tree('2') | 75 | tree2 = self.make_to_branch_and_tree('2') |
346 | 76 | tree2.set_root_id(tree1.get_root_id()) | 76 | tree2.set_root_id(tree1.path2id('')) |
347 | 77 | tree1 = self.get_tree_no_parents_no_content(tree1) | 77 | tree1 = self.get_tree_no_parents_no_content(tree1) |
348 | 78 | tree2 = self.get_tree_no_parents_no_content(tree2) | 78 | tree2 = self.get_tree_no_parents_no_content(tree2) |
349 | 79 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) | 79 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
350 | @@ -87,7 +87,7 @@ | |||
351 | 87 | def test_empty_to_abc_content(self): | 87 | def test_empty_to_abc_content(self): |
352 | 88 | tree1 = self.make_branch_and_tree('1') | 88 | tree1 = self.make_branch_and_tree('1') |
353 | 89 | tree2 = self.make_to_branch_and_tree('2') | 89 | tree2 = self.make_to_branch_and_tree('2') |
355 | 90 | tree2.set_root_id(tree1.get_root_id()) | 90 | tree2.set_root_id(tree1.path2id('')) |
356 | 91 | tree1 = self.get_tree_no_parents_no_content(tree1) | 91 | tree1 = self.get_tree_no_parents_no_content(tree1) |
357 | 92 | tree2 = self.get_tree_no_parents_abc_content(tree2) | 92 | tree2 = self.get_tree_no_parents_abc_content(tree2) |
358 | 93 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) | 93 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
359 | @@ -109,7 +109,7 @@ | |||
360 | 109 | # the test. | 109 | # the test. |
361 | 110 | tree1 = self.make_branch_and_tree('1') | 110 | tree1 = self.make_branch_and_tree('1') |
362 | 111 | tree2 = self.make_to_branch_and_tree('2') | 111 | tree2 = self.make_to_branch_and_tree('2') |
364 | 112 | tree2.set_root_id(tree1.get_root_id()) | 112 | tree2.set_root_id(tree1.path2id('')) |
365 | 113 | self.build_tree(['2/a']) | 113 | self.build_tree(['2/a']) |
366 | 114 | tree2.add('a') | 114 | tree2.add('a') |
367 | 115 | os.unlink('2/a') | 115 | os.unlink('2/a') |
368 | @@ -131,7 +131,7 @@ | |||
369 | 131 | def test_abc_content_to_empty(self): | 131 | def test_abc_content_to_empty(self): |
370 | 132 | tree1 = self.make_branch_and_tree('1') | 132 | tree1 = self.make_branch_and_tree('1') |
371 | 133 | tree2 = self.make_to_branch_and_tree('2') | 133 | tree2 = self.make_to_branch_and_tree('2') |
373 | 134 | tree2.set_root_id(tree1.get_root_id()) | 134 | tree2.set_root_id(tree1.path2id('')) |
374 | 135 | tree1 = self.get_tree_no_parents_abc_content(tree1) | 135 | tree1 = self.get_tree_no_parents_abc_content(tree1) |
375 | 136 | tree2 = self.get_tree_no_parents_no_content(tree2) | 136 | tree2 = self.get_tree_no_parents_no_content(tree2) |
376 | 137 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) | 137 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
377 | @@ -148,7 +148,7 @@ | |||
378 | 148 | def test_content_modification(self): | 148 | def test_content_modification(self): |
379 | 149 | tree1 = self.make_branch_and_tree('1') | 149 | tree1 = self.make_branch_and_tree('1') |
380 | 150 | tree2 = self.make_to_branch_and_tree('2') | 150 | tree2 = self.make_to_branch_and_tree('2') |
382 | 151 | tree2.set_root_id(tree1.get_root_id()) | 151 | tree2.set_root_id(tree1.path2id('')) |
383 | 152 | tree1 = self.get_tree_no_parents_abc_content(tree1) | 152 | tree1 = self.get_tree_no_parents_abc_content(tree1) |
384 | 153 | tree2 = self.get_tree_no_parents_abc_content_2(tree2) | 153 | tree2 = self.get_tree_no_parents_abc_content_2(tree2) |
385 | 154 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) | 154 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
386 | @@ -163,7 +163,7 @@ | |||
387 | 163 | def test_meta_modification(self): | 163 | def test_meta_modification(self): |
388 | 164 | tree1 = self.make_branch_and_tree('1') | 164 | tree1 = self.make_branch_and_tree('1') |
389 | 165 | tree2 = self.make_to_branch_and_tree('2') | 165 | tree2 = self.make_to_branch_and_tree('2') |
391 | 166 | tree2.set_root_id(tree1.get_root_id()) | 166 | tree2.set_root_id(tree1.path2id('')) |
392 | 167 | tree1 = self.get_tree_no_parents_abc_content(tree1) | 167 | tree1 = self.get_tree_no_parents_abc_content(tree1) |
393 | 168 | tree2 = self.get_tree_no_parents_abc_content_3(tree2) | 168 | tree2 = self.get_tree_no_parents_abc_content_3(tree2) |
394 | 169 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) | 169 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
395 | @@ -178,7 +178,7 @@ | |||
396 | 178 | def test_file_rename(self): | 178 | def test_file_rename(self): |
397 | 179 | tree1 = self.make_branch_and_tree('1') | 179 | tree1 = self.make_branch_and_tree('1') |
398 | 180 | tree2 = self.make_to_branch_and_tree('2') | 180 | tree2 = self.make_to_branch_and_tree('2') |
400 | 181 | tree2.set_root_id(tree1.get_root_id()) | 181 | tree2.set_root_id(tree1.path2id('')) |
401 | 182 | tree1 = self.get_tree_no_parents_abc_content(tree1) | 182 | tree1 = self.get_tree_no_parents_abc_content(tree1) |
402 | 183 | tree2 = self.get_tree_no_parents_abc_content_4(tree2) | 183 | tree2 = self.get_tree_no_parents_abc_content_4(tree2) |
403 | 184 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) | 184 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
404 | @@ -193,7 +193,7 @@ | |||
405 | 193 | def test_file_rename_and_modification(self): | 193 | def test_file_rename_and_modification(self): |
406 | 194 | tree1 = self.make_branch_and_tree('1') | 194 | tree1 = self.make_branch_and_tree('1') |
407 | 195 | tree2 = self.make_to_branch_and_tree('2') | 195 | tree2 = self.make_to_branch_and_tree('2') |
409 | 196 | tree2.set_root_id(tree1.get_root_id()) | 196 | tree2.set_root_id(tree1.path2id('')) |
410 | 197 | tree1 = self.get_tree_no_parents_abc_content(tree1) | 197 | tree1 = self.get_tree_no_parents_abc_content(tree1) |
411 | 198 | tree2 = self.get_tree_no_parents_abc_content_5(tree2) | 198 | tree2 = self.get_tree_no_parents_abc_content_5(tree2) |
412 | 199 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) | 199 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
413 | @@ -208,7 +208,7 @@ | |||
414 | 208 | def test_file_rename_and_meta_modification(self): | 208 | def test_file_rename_and_meta_modification(self): |
415 | 209 | tree1 = self.make_branch_and_tree('1') | 209 | tree1 = self.make_branch_and_tree('1') |
416 | 210 | tree2 = self.make_to_branch_and_tree('2') | 210 | tree2 = self.make_to_branch_and_tree('2') |
418 | 211 | tree2.set_root_id(tree1.get_root_id()) | 211 | tree2.set_root_id(tree1.path2id('')) |
419 | 212 | tree1 = self.get_tree_no_parents_abc_content(tree1) | 212 | tree1 = self.get_tree_no_parents_abc_content(tree1) |
420 | 213 | tree2 = self.get_tree_no_parents_abc_content_6(tree2) | 213 | tree2 = self.get_tree_no_parents_abc_content_6(tree2) |
421 | 214 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) | 214 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
422 | @@ -223,7 +223,7 @@ | |||
423 | 223 | def test_empty_to_abc_content_a_only(self): | 223 | def test_empty_to_abc_content_a_only(self): |
424 | 224 | tree1 = self.make_branch_and_tree('1') | 224 | tree1 = self.make_branch_and_tree('1') |
425 | 225 | tree2 = self.make_to_branch_and_tree('2') | 225 | tree2 = self.make_to_branch_and_tree('2') |
427 | 226 | tree2.set_root_id(tree1.get_root_id()) | 226 | tree2.set_root_id(tree1.path2id('')) |
428 | 227 | tree1 = self.get_tree_no_parents_no_content(tree1) | 227 | tree1 = self.get_tree_no_parents_no_content(tree1) |
429 | 228 | tree2 = self.get_tree_no_parents_abc_content(tree2) | 228 | tree2 = self.get_tree_no_parents_abc_content(tree2) |
430 | 229 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) | 229 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
431 | @@ -349,7 +349,7 @@ | |||
432 | 349 | def test_default_ignores_unversioned_files(self): | 349 | def test_default_ignores_unversioned_files(self): |
433 | 350 | tree1 = self.make_branch_and_tree('tree1') | 350 | tree1 = self.make_branch_and_tree('tree1') |
434 | 351 | tree2 = self.make_to_branch_and_tree('tree2') | 351 | tree2 = self.make_to_branch_and_tree('tree2') |
436 | 352 | tree2.set_root_id(tree1.get_root_id()) | 352 | tree2.set_root_id(tree1.path2id('')) |
437 | 353 | self.build_tree(['tree1/a', 'tree1/c', | 353 | self.build_tree(['tree1/a', 'tree1/c', |
438 | 354 | 'tree2/a', 'tree2/b', 'tree2/c']) | 354 | 'tree2/a', 'tree2/b', 'tree2/c']) |
439 | 355 | tree1.add(['a', 'c'], [b'a-id', b'c-id']) | 355 | tree1.add(['a', 'c'], [b'a-id', b'c-id']) |
440 | @@ -368,7 +368,7 @@ | |||
441 | 368 | def test_unversioned_paths_in_tree(self): | 368 | def test_unversioned_paths_in_tree(self): |
442 | 369 | tree1 = self.make_branch_and_tree('tree1') | 369 | tree1 = self.make_branch_and_tree('tree1') |
443 | 370 | tree2 = self.make_to_branch_and_tree('tree2') | 370 | tree2 = self.make_to_branch_and_tree('tree2') |
445 | 371 | tree2.set_root_id(tree1.get_root_id()) | 371 | tree2.set_root_id(tree1.path2id('')) |
446 | 372 | self.build_tree(['tree2/file', 'tree2/dir/']) | 372 | self.build_tree(['tree2/file', 'tree2/dir/']) |
447 | 373 | if has_symlinks(): | 373 | if has_symlinks(): |
448 | 374 | os.symlink('target', 'tree2/link') | 374 | os.symlink('target', 'tree2/link') |
449 | @@ -495,7 +495,7 @@ | |||
450 | 495 | """Create a tree with filenames chosen to exercise the walk order.""" | 495 | """Create a tree with filenames chosen to exercise the walk order.""" |
451 | 496 | tree1 = self.make_branch_and_tree('tree1') | 496 | tree1 = self.make_branch_and_tree('tree1') |
452 | 497 | tree2 = self.make_to_branch_and_tree('tree2') | 497 | tree2 = self.make_to_branch_and_tree('tree2') |
454 | 498 | tree2.set_root_id(tree1.get_root_id()) | 498 | tree2.set_root_id(tree1.path2id('')) |
455 | 499 | paths, path_ids = self._create_special_names(tree2, 'tree2') | 499 | paths, path_ids = self._create_special_names(tree2, 'tree2') |
456 | 500 | tree2.commit('initial', rev_id=b'rev-1') | 500 | tree2.commit('initial', rev_id=b'rev-1') |
457 | 501 | tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) | 501 | tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
458 | @@ -508,7 +508,7 @@ | |||
459 | 508 | """ | 508 | """ |
460 | 509 | tree1 = self.make_branch_and_tree('tree1') | 509 | tree1 = self.make_branch_and_tree('tree1') |
461 | 510 | tree2 = self.make_to_branch_and_tree('tree2') | 510 | tree2 = self.make_to_branch_and_tree('tree2') |
463 | 511 | tree2.set_root_id(tree1.get_root_id()) | 511 | tree2.set_root_id(tree1.path2id('')) |
464 | 512 | paths, path_ids = self._create_special_names(tree1, 'tree1') | 512 | paths, path_ids = self._create_special_names(tree1, 'tree1') |
465 | 513 | paths, path_ids = self._create_special_names(tree2, 'tree2') | 513 | paths, path_ids = self._create_special_names(tree2, 'tree2') |
466 | 514 | tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) | 514 | tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
467 | @@ -808,7 +808,7 @@ | |||
468 | 808 | tree1.put_file_bytes_non_atomic( | 808 | tree1.put_file_bytes_non_atomic( |
469 | 809 | 'changing/unchanging/file', b'a file') | 809 | 'changing/unchanging/file', b'a file') |
470 | 810 | tree2 = self.make_to_branch_and_tree('2') | 810 | tree2 = self.make_to_branch_and_tree('2') |
472 | 811 | tree2.set_root_id(tree1.get_root_id()) | 811 | tree2.set_root_id(tree1.path2id('')) |
473 | 812 | tree2.mkdir('changed', b'parent-id') | 812 | tree2.mkdir('changed', b'parent-id') |
474 | 813 | tree2.mkdir('changed/unchanging', b'mid-id') | 813 | tree2.mkdir('changed/unchanging', b'mid-id') |
475 | 814 | tree2.add(['changed/unchanging/file'], [b'file-id'], ['file']) | 814 | tree2.add(['changed/unchanging/file'], [b'file-id'], ['file']) |
476 | @@ -887,7 +887,7 @@ | |||
477 | 887 | tree1.add(['a'], [b'a-id'], ['file']) | 887 | tree1.add(['a'], [b'a-id'], ['file']) |
478 | 888 | tree1.put_file_bytes_non_atomic('a', b'a file') | 888 | tree1.put_file_bytes_non_atomic('a', b'a file') |
479 | 889 | tree2 = self.make_to_branch_and_tree('2') | 889 | tree2 = self.make_to_branch_and_tree('2') |
481 | 890 | tree2.set_root_id(tree1.get_root_id()) | 890 | tree2.set_root_id(tree1.path2id('')) |
482 | 891 | tree2.mkdir('a', b'b-id') | 891 | tree2.mkdir('a', b'b-id') |
483 | 892 | tree2.add(['a/c'], [b'c-id'], ['file']) | 892 | tree2.add(['a/c'], [b'c-id'], ['file']) |
484 | 893 | tree2.put_file_bytes_non_atomic('a/c', b'another file') | 893 | tree2.put_file_bytes_non_atomic('a/c', b'another file') |
485 | @@ -907,7 +907,7 @@ | |||
486 | 907 | tree1.mkdir('a/reparented', b'reparented-id') | 907 | tree1.mkdir('a/reparented', b'reparented-id') |
487 | 908 | tree1.mkdir('a/deleted', b'deleted-id') | 908 | tree1.mkdir('a/deleted', b'deleted-id') |
488 | 909 | tree2 = self.make_to_branch_and_tree('2') | 909 | tree2 = self.make_to_branch_and_tree('2') |
490 | 910 | tree2.set_root_id(tree1.get_root_id()) | 910 | tree2.set_root_id(tree1.path2id('')) |
491 | 911 | tree2.mkdir('a', b'a-new-id') | 911 | tree2.mkdir('a', b'a-new-id') |
492 | 912 | tree2.mkdir('a/reparented', b'reparented-id') | 912 | tree2.mkdir('a/reparented', b'reparented-id') |
493 | 913 | tree2.add(['b'], [b'a-old-id'], ['file']) | 913 | tree2.add(['b'], [b'a-old-id'], ['file']) |
494 | @@ -931,7 +931,7 @@ | |||
495 | 931 | tree1.mkdir('a/reparented', b'reparented-id') | 931 | tree1.mkdir('a/reparented', b'reparented-id') |
496 | 932 | tree1.mkdir('a/deleted', b'deleted-id') | 932 | tree1.mkdir('a/deleted', b'deleted-id') |
497 | 933 | tree2 = self.make_to_branch_and_tree('2') | 933 | tree2 = self.make_to_branch_and_tree('2') |
499 | 934 | tree2.set_root_id(tree1.get_root_id()) | 934 | tree2.set_root_id(tree1.path2id('')) |
500 | 935 | tree2.mkdir('a', b'a-new-id') | 935 | tree2.mkdir('a', b'a-new-id') |
501 | 936 | tree2.mkdir('a/reparented', b'reparented-id') | 936 | tree2.mkdir('a/reparented', b'reparented-id') |
502 | 937 | tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) | 937 | tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2) |
503 | @@ -955,7 +955,7 @@ | |||
504 | 955 | tree1.mkdir('a/reparented', b'reparented-id') | 955 | tree1.mkdir('a/reparented', b'reparented-id') |
505 | 956 | tree1.mkdir('collides', b'collides-id') | 956 | tree1.mkdir('collides', b'collides-id') |
506 | 957 | tree2 = self.make_to_branch_and_tree('2') | 957 | tree2 = self.make_to_branch_and_tree('2') |
508 | 958 | tree2.set_root_id(tree1.get_root_id()) | 958 | tree2.set_root_id(tree1.path2id('')) |
509 | 959 | tree2.mkdir('a', b'a-new-id') | 959 | tree2.mkdir('a', b'a-new-id') |
510 | 960 | tree2.mkdir('a/selected', b'selected-id') | 960 | tree2.mkdir('a/selected', b'selected-id') |
511 | 961 | tree2.mkdir('collides', b'reparented-id') | 961 | tree2.mkdir('collides', b'reparented-id') |
512 | @@ -984,7 +984,7 @@ | |||
513 | 984 | tree1.mkdir('a/deleted/reparented', b'reparented-id-2') | 984 | tree1.mkdir('a/deleted/reparented', b'reparented-id-2') |
514 | 985 | tree1.mkdir('a/deleted/deleted', b'deleted-id-2') | 985 | tree1.mkdir('a/deleted/deleted', b'deleted-id-2') |
515 | 986 | tree2 = self.make_to_branch_and_tree('2') | 986 | tree2 = self.make_to_branch_and_tree('2') |
517 | 987 | tree2.set_root_id(tree1.get_root_id()) | 987 | tree2.set_root_id(tree1.path2id('')) |
518 | 988 | tree2.mkdir('a', b'a-new-id') | 988 | tree2.mkdir('a', b'a-new-id') |
519 | 989 | tree2.mkdir('a/reparented', b'reparented-id-1') | 989 | tree2.mkdir('a/reparented', b'reparented-id-1') |
520 | 990 | tree2.mkdir('reparented', b'reparented-id-2') | 990 | tree2.mkdir('reparented', b'reparented-id-2') |
521 | @@ -1068,7 +1068,7 @@ | |||
522 | 1068 | def test_missing_and_renamed(self): | 1068 | def test_missing_and_renamed(self): |
523 | 1069 | tree1 = self.make_branch_and_tree('tree1') | 1069 | tree1 = self.make_branch_and_tree('tree1') |
524 | 1070 | tree2 = self.make_to_branch_and_tree('tree2') | 1070 | tree2 = self.make_to_branch_and_tree('tree2') |
526 | 1071 | tree2.set_root_id(tree1.get_root_id()) | 1071 | tree2.set_root_id(tree1.path2id('')) |
527 | 1072 | self.build_tree(['tree1/file']) | 1072 | self.build_tree(['tree1/file']) |
528 | 1073 | tree1.add(['file'], [b'file-id']) | 1073 | tree1.add(['file'], [b'file-id']) |
529 | 1074 | self.build_tree(['tree2/directory/']) | 1074 | self.build_tree(['tree2/directory/']) |
530 | @@ -1086,7 +1086,7 @@ | |||
531 | 1086 | def test_only_in_source_and_missing(self): | 1086 | def test_only_in_source_and_missing(self): |
532 | 1087 | tree1 = self.make_branch_and_tree('tree1') | 1087 | tree1 = self.make_branch_and_tree('tree1') |
533 | 1088 | tree2 = self.make_to_branch_and_tree('tree2') | 1088 | tree2 = self.make_to_branch_and_tree('tree2') |
535 | 1089 | tree2.set_root_id(tree1.get_root_id()) | 1089 | tree2.set_root_id(tree1.path2id('')) |
536 | 1090 | self.build_tree(['tree1/file']) | 1090 | self.build_tree(['tree1/file']) |
537 | 1091 | tree1.add(['file'], [b'file-id']) | 1091 | tree1.add(['file'], [b'file-id']) |
538 | 1092 | os.unlink('tree1/file') | 1092 | os.unlink('tree1/file') |
539 | @@ -1101,7 +1101,7 @@ | |||
540 | 1101 | def test_only_in_target_and_missing(self): | 1101 | def test_only_in_target_and_missing(self): |
541 | 1102 | tree1 = self.make_branch_and_tree('tree1') | 1102 | tree1 = self.make_branch_and_tree('tree1') |
542 | 1103 | tree2 = self.make_to_branch_and_tree('tree2') | 1103 | tree2 = self.make_to_branch_and_tree('tree2') |
544 | 1104 | tree2.set_root_id(tree1.get_root_id()) | 1104 | tree2.set_root_id(tree1.path2id('')) |
545 | 1105 | self.build_tree(['tree2/file']) | 1105 | self.build_tree(['tree2/file']) |
546 | 1106 | tree2.add(['file'], [b'file-id']) | 1106 | tree2.add(['file'], [b'file-id']) |
547 | 1107 | os.unlink('tree2/file') | 1107 | os.unlink('tree2/file') |
548 | @@ -1116,7 +1116,7 @@ | |||
549 | 1116 | def test_only_in_target_missing_subtree_specific_bug_367632(self): | 1116 | def test_only_in_target_missing_subtree_specific_bug_367632(self): |
550 | 1117 | tree1 = self.make_branch_and_tree('tree1') | 1117 | tree1 = self.make_branch_and_tree('tree1') |
551 | 1118 | tree2 = self.make_to_branch_and_tree('tree2') | 1118 | tree2 = self.make_to_branch_and_tree('tree2') |
553 | 1119 | tree2.set_root_id(tree1.get_root_id()) | 1119 | tree2.set_root_id(tree1.path2id('')) |
554 | 1120 | self.build_tree(['tree2/a-dir/', 'tree2/a-dir/a-file']) | 1120 | self.build_tree(['tree2/a-dir/', 'tree2/a-dir/a-file']) |
555 | 1121 | tree2.add(['a-dir', 'a-dir/a-file'], [b'dir-id', b'file-id']) | 1121 | tree2.add(['a-dir', 'a-dir/a-file'], [b'dir-id', b'file-id']) |
556 | 1122 | os.unlink('tree2/a-dir/a-file') | 1122 | os.unlink('tree2/a-dir/a-file') |
557 | @@ -1226,7 +1226,7 @@ | |||
558 | 1226 | def test_default_ignores_unversioned_files(self): | 1226 | def test_default_ignores_unversioned_files(self): |
559 | 1227 | tree1 = self.make_branch_and_tree('tree1') | 1227 | tree1 = self.make_branch_and_tree('tree1') |
560 | 1228 | tree2 = self.make_to_branch_and_tree('tree2') | 1228 | tree2 = self.make_to_branch_and_tree('tree2') |
562 | 1229 | tree2.set_root_id(tree1.get_root_id()) | 1229 | tree2.set_root_id(tree1.path2id('')) |
563 | 1230 | self.build_tree(['tree1/a', 'tree1/c', | 1230 | self.build_tree(['tree1/a', 'tree1/c', |
564 | 1231 | 'tree2/a', 'tree2/b', 'tree2/c']) | 1231 | 'tree2/a', 'tree2/b', 'tree2/c']) |
565 | 1232 | tree1.add(['a', 'c'], [b'a-id', b'c-id']) | 1232 | tree1.add(['a', 'c'], [b'a-id', b'c-id']) |
566 | @@ -1246,7 +1246,7 @@ | |||
567 | 1246 | def test_unversioned_paths_in_tree(self): | 1246 | def test_unversioned_paths_in_tree(self): |
568 | 1247 | tree1 = self.make_branch_and_tree('tree1') | 1247 | tree1 = self.make_branch_and_tree('tree1') |
569 | 1248 | tree2 = self.make_to_branch_and_tree('tree2') | 1248 | tree2 = self.make_to_branch_and_tree('tree2') |
571 | 1249 | tree2.set_root_id(tree1.get_root_id()) | 1249 | tree2.set_root_id(tree1.path2id('')) |
572 | 1250 | self.build_tree(['tree2/file', 'tree2/dir/']) | 1250 | self.build_tree(['tree2/file', 'tree2/dir/']) |
573 | 1251 | if has_symlinks(): | 1251 | if has_symlinks(): |
574 | 1252 | os.symlink('target', 'tree2/link') | 1252 | os.symlink('target', 'tree2/link') |
575 | @@ -1299,7 +1299,7 @@ | |||
576 | 1299 | # both foo and bar. | 1299 | # both foo and bar. |
577 | 1300 | tree1 = self.make_branch_and_tree('tree1') | 1300 | tree1 = self.make_branch_and_tree('tree1') |
578 | 1301 | tree2 = self.make_to_branch_and_tree('tree2') | 1301 | tree2 = self.make_to_branch_and_tree('tree2') |
580 | 1302 | tree2.set_root_id(tree1.get_root_id()) | 1302 | tree2.set_root_id(tree1.path2id('')) |
581 | 1303 | self.build_tree(['tree2/file', 'tree2/dir/', | 1303 | self.build_tree(['tree2/file', 'tree2/dir/', |
582 | 1304 | 'tree1/file', 'tree2/movedfile', | 1304 | 'tree1/file', 'tree2/movedfile', |
583 | 1305 | 'tree1/dir/', 'tree2/moveddir/']) | 1305 | 'tree1/dir/', 'tree2/moveddir/']) |
584 | @@ -1343,7 +1343,7 @@ | |||
585 | 1343 | """Test when we have a few files with similar names.""" | 1343 | """Test when we have a few files with similar names.""" |
586 | 1344 | tree1 = self.make_branch_and_tree('tree1') | 1344 | tree1 = self.make_branch_and_tree('tree1') |
587 | 1345 | tree2 = self.make_branch_and_tree('tree2') | 1345 | tree2 = self.make_branch_and_tree('tree2') |
589 | 1346 | tree2.set_root_id(tree1.get_root_id()) | 1346 | tree2.set_root_id(tree1.path2id('')) |
590 | 1347 | 1347 | ||
591 | 1348 | # The trees are actually identical, but they happen to contain | 1348 | # The trees are actually identical, but they happen to contain |
592 | 1349 | # similarly named files. | 1349 | # similarly named files. |
593 | @@ -1371,7 +1371,7 @@ | |||
594 | 1371 | self.assertEqual([], self.do_iter_changes(tree1, tree2, | 1371 | self.assertEqual([], self.do_iter_changes(tree1, tree2, |
595 | 1372 | want_unversioned=True)) | 1372 | want_unversioned=True)) |
596 | 1373 | expected = self.sorted([ | 1373 | expected = self.sorted([ |
598 | 1374 | self.unchanged(tree2, tree2.get_root_id()), | 1374 | self.unchanged(tree2, tree2.path2id('')), |
599 | 1375 | self.unchanged(tree2, b'a-id'), | 1375 | self.unchanged(tree2, b'a-id'), |
600 | 1376 | self.unchanged(tree2, b'b-id'), | 1376 | self.unchanged(tree2, b'b-id'), |
601 | 1377 | self.unchanged(tree2, b'c-id'), | 1377 | self.unchanged(tree2, b'c-id'), |
602 | @@ -1387,7 +1387,7 @@ | |||
603 | 1387 | def test_unversioned_subtree_only_emits_root(self): | 1387 | def test_unversioned_subtree_only_emits_root(self): |
604 | 1388 | tree1 = self.make_branch_and_tree('tree1') | 1388 | tree1 = self.make_branch_and_tree('tree1') |
605 | 1389 | tree2 = self.make_to_branch_and_tree('tree2') | 1389 | tree2 = self.make_to_branch_and_tree('tree2') |
607 | 1390 | tree2.set_root_id(tree1.get_root_id()) | 1390 | tree2.set_root_id(tree1.path2id('')) |
608 | 1391 | self.build_tree(['tree2/dir/', 'tree2/dir/file']) | 1391 | self.build_tree(['tree2/dir/', 'tree2/dir/file']) |
609 | 1392 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) | 1392 | tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2) |
610 | 1393 | self.not_applicable_if_cannot_represent_unversioned(tree2) | 1393 | self.not_applicable_if_cannot_represent_unversioned(tree2) |
611 | @@ -1400,7 +1400,7 @@ | |||
612 | 1400 | def make_trees_with_symlinks(self): | 1400 | def make_trees_with_symlinks(self): |
613 | 1401 | tree1 = self.make_branch_and_tree('tree1') | 1401 | tree1 = self.make_branch_and_tree('tree1') |
614 | 1402 | tree2 = self.make_to_branch_and_tree('tree2') | 1402 | tree2 = self.make_to_branch_and_tree('tree2') |
616 | 1403 | tree2.set_root_id(tree1.get_root_id()) | 1403 | tree2.set_root_id(tree1.path2id('')) |
617 | 1404 | self.build_tree(['tree1/fromfile', 'tree1/fromdir/']) | 1404 | self.build_tree(['tree1/fromfile', 'tree1/fromdir/']) |
618 | 1405 | self.build_tree(['tree2/tofile', 'tree2/todir/', 'tree2/unknown']) | 1405 | self.build_tree(['tree2/tofile', 'tree2/todir/', 'tree2/unknown']) |
619 | 1406 | os.symlink('original', 'tree1/changed') | 1406 | os.symlink('original', 'tree1/changed') |
620 | @@ -1500,7 +1500,7 @@ | |||
621 | 1500 | def test_trees_with_deleted_dir(self): | 1500 | def test_trees_with_deleted_dir(self): |
622 | 1501 | tree1 = self.make_branch_and_tree('tree1') | 1501 | tree1 = self.make_branch_and_tree('tree1') |
623 | 1502 | tree2 = self.make_to_branch_and_tree('tree2') | 1502 | tree2 = self.make_to_branch_and_tree('tree2') |
625 | 1503 | tree2.set_root_id(tree1.get_root_id()) | 1503 | tree2.set_root_id(tree1.path2id('')) |
626 | 1504 | self.build_tree(['tree1/a', 'tree1/b/', 'tree1/b/c', | 1504 | self.build_tree(['tree1/a', 'tree1/b/', 'tree1/b/c', |
627 | 1505 | 'tree1/b/d/', 'tree1/b/d/e', 'tree1/f/', 'tree1/f/g', | 1505 | 'tree1/b/d/', 'tree1/b/d/e', 'tree1/f/', 'tree1/f/g', |
628 | 1506 | 'tree2/a', 'tree2/f/', 'tree2/f/g']) | 1506 | 'tree2/a', 'tree2/f/', 'tree2/f/g']) |
629 | @@ -1525,7 +1525,7 @@ | |||
630 | 1525 | def test_added_unicode(self): | 1525 | def test_added_unicode(self): |
631 | 1526 | tree1 = self.make_branch_and_tree('tree1') | 1526 | tree1 = self.make_branch_and_tree('tree1') |
632 | 1527 | tree2 = self.make_to_branch_and_tree('tree2') | 1527 | tree2 = self.make_to_branch_and_tree('tree2') |
634 | 1528 | root_id = tree1.get_root_id() | 1528 | root_id = tree1.path2id('') |
635 | 1529 | tree2.set_root_id(root_id) | 1529 | tree2.set_root_id(root_id) |
636 | 1530 | 1530 | ||
637 | 1531 | # u'\u03b1' == GREEK SMALL LETTER ALPHA | 1531 | # u'\u03b1' == GREEK SMALL LETTER ALPHA |
638 | @@ -1554,7 +1554,7 @@ | |||
639 | 1554 | def test_deleted_unicode(self): | 1554 | def test_deleted_unicode(self): |
640 | 1555 | tree1 = self.make_branch_and_tree('tree1') | 1555 | tree1 = self.make_branch_and_tree('tree1') |
641 | 1556 | tree2 = self.make_to_branch_and_tree('tree2') | 1556 | tree2 = self.make_to_branch_and_tree('tree2') |
643 | 1557 | root_id = tree1.get_root_id() | 1557 | root_id = tree1.path2id('') |
644 | 1558 | tree2.set_root_id(root_id) | 1558 | tree2.set_root_id(root_id) |
645 | 1559 | 1559 | ||
646 | 1560 | # u'\u03b1' == GREEK SMALL LETTER ALPHA | 1560 | # u'\u03b1' == GREEK SMALL LETTER ALPHA |
647 | @@ -1583,7 +1583,7 @@ | |||
648 | 1583 | def test_modified_unicode(self): | 1583 | def test_modified_unicode(self): |
649 | 1584 | tree1 = self.make_branch_and_tree('tree1') | 1584 | tree1 = self.make_branch_and_tree('tree1') |
650 | 1585 | tree2 = self.make_to_branch_and_tree('tree2') | 1585 | tree2 = self.make_to_branch_and_tree('tree2') |
652 | 1586 | root_id = tree1.get_root_id() | 1586 | root_id = tree1.path2id('') |
653 | 1587 | tree2.set_root_id(root_id) | 1587 | tree2.set_root_id(root_id) |
654 | 1588 | 1588 | ||
655 | 1589 | # u'\u03b1' == GREEK SMALL LETTER ALPHA | 1589 | # u'\u03b1' == GREEK SMALL LETTER ALPHA |
656 | @@ -1613,7 +1613,7 @@ | |||
657 | 1613 | def test_renamed_unicode(self): | 1613 | def test_renamed_unicode(self): |
658 | 1614 | tree1 = self.make_branch_and_tree('tree1') | 1614 | tree1 = self.make_branch_and_tree('tree1') |
659 | 1615 | tree2 = self.make_to_branch_and_tree('tree2') | 1615 | tree2 = self.make_to_branch_and_tree('tree2') |
661 | 1616 | root_id = tree1.get_root_id() | 1616 | root_id = tree1.path2id('') |
662 | 1617 | tree2.set_root_id(root_id) | 1617 | tree2.set_root_id(root_id) |
663 | 1618 | 1618 | ||
664 | 1619 | # u'\u03b1' == GREEK SMALL LETTER ALPHA | 1619 | # u'\u03b1' == GREEK SMALL LETTER ALPHA |
665 | @@ -1644,7 +1644,7 @@ | |||
666 | 1644 | def test_unchanged_unicode(self): | 1644 | def test_unchanged_unicode(self): |
667 | 1645 | tree1 = self.make_branch_and_tree('tree1') | 1645 | tree1 = self.make_branch_and_tree('tree1') |
668 | 1646 | tree2 = self.make_to_branch_and_tree('tree2') | 1646 | tree2 = self.make_to_branch_and_tree('tree2') |
670 | 1647 | root_id = tree1.get_root_id() | 1647 | root_id = tree1.path2id('') |
671 | 1648 | tree2.set_root_id(root_id) | 1648 | tree2.set_root_id(root_id) |
672 | 1649 | # u'\u03b1' == GREEK SMALL LETTER ALPHA | 1649 | # u'\u03b1' == GREEK SMALL LETTER ALPHA |
673 | 1650 | # u'\u03c9' == GREEK SMALL LETTER OMEGA | 1650 | # u'\u03c9' == GREEK SMALL LETTER OMEGA |
674 | @@ -1692,7 +1692,7 @@ | |||
675 | 1692 | def test_unknown_unicode(self): | 1692 | def test_unknown_unicode(self): |
676 | 1693 | tree1 = self.make_branch_and_tree('tree1') | 1693 | tree1 = self.make_branch_and_tree('tree1') |
677 | 1694 | tree2 = self.make_to_branch_and_tree('tree2') | 1694 | tree2 = self.make_to_branch_and_tree('tree2') |
679 | 1695 | root_id = tree1.get_root_id() | 1695 | root_id = tree1.path2id('') |
680 | 1696 | tree2.set_root_id(root_id) | 1696 | tree2.set_root_id(root_id) |
681 | 1697 | # u'\u03b1' == GREEK SMALL LETTER ALPHA | 1697 | # u'\u03b1' == GREEK SMALL LETTER ALPHA |
682 | 1698 | # u'\u03c9' == GREEK SMALL LETTER OMEGA | 1698 | # u'\u03c9' == GREEK SMALL LETTER OMEGA |
683 | @@ -1746,7 +1746,7 @@ | |||
684 | 1746 | def test_unknown_empty_dir(self): | 1746 | def test_unknown_empty_dir(self): |
685 | 1747 | tree1 = self.make_branch_and_tree('tree1') | 1747 | tree1 = self.make_branch_and_tree('tree1') |
686 | 1748 | tree2 = self.make_to_branch_and_tree('tree2') | 1748 | tree2 = self.make_to_branch_and_tree('tree2') |
688 | 1749 | root_id = tree1.get_root_id() | 1749 | root_id = tree1.path2id('') |
689 | 1750 | tree2.set_root_id(root_id) | 1750 | tree2.set_root_id(root_id) |
690 | 1751 | 1751 | ||
691 | 1752 | # Start with 2 identical trees | 1752 | # Start with 2 identical trees |
692 | @@ -1788,7 +1788,7 @@ | |||
693 | 1788 | def test_rename_over_deleted(self): | 1788 | def test_rename_over_deleted(self): |
694 | 1789 | tree1 = self.make_branch_and_tree('tree1') | 1789 | tree1 = self.make_branch_and_tree('tree1') |
695 | 1790 | tree2 = self.make_to_branch_and_tree('tree2') | 1790 | tree2 = self.make_to_branch_and_tree('tree2') |
697 | 1791 | root_id = tree1.get_root_id() | 1791 | root_id = tree1.path2id('') |
698 | 1792 | tree2.set_root_id(root_id) | 1792 | tree2.set_root_id(root_id) |
699 | 1793 | 1793 | ||
700 | 1794 | # The final changes should be: | 1794 | # The final changes should be: |
701 | @@ -1825,7 +1825,7 @@ | |||
702 | 1825 | """Test a file marked removed, but still present on disk.""" | 1825 | """Test a file marked removed, but still present on disk.""" |
703 | 1826 | tree1 = self.make_branch_and_tree('tree1') | 1826 | tree1 = self.make_branch_and_tree('tree1') |
704 | 1827 | tree2 = self.make_to_branch_and_tree('tree2') | 1827 | tree2 = self.make_to_branch_and_tree('tree2') |
706 | 1828 | root_id = tree1.get_root_id() | 1828 | root_id = tree1.path2id('') |
707 | 1829 | tree2.set_root_id(root_id) | 1829 | tree2.set_root_id(root_id) |
708 | 1830 | 1830 | ||
709 | 1831 | # The final changes should be: | 1831 | # The final changes should be: |
710 | @@ -1863,7 +1863,7 @@ | |||
711 | 1863 | """Test when we have renamed a file, and put another in its place.""" | 1863 | """Test when we have renamed a file, and put another in its place.""" |
712 | 1864 | tree1 = self.make_branch_and_tree('tree1') | 1864 | tree1 = self.make_branch_and_tree('tree1') |
713 | 1865 | tree2 = self.make_to_branch_and_tree('tree2') | 1865 | tree2 = self.make_to_branch_and_tree('tree2') |
715 | 1866 | root_id = tree1.get_root_id() | 1866 | root_id = tree1.path2id('') |
716 | 1867 | tree2.set_root_id(root_id) | 1867 | tree2.set_root_id(root_id) |
717 | 1868 | 1868 | ||
718 | 1869 | # The final changes are: | 1869 | # The final changes are: |
719 | @@ -1900,7 +1900,7 @@ | |||
720 | 1900 | """A file was moved on the filesystem, but not in bzr.""" | 1900 | """A file was moved on the filesystem, but not in bzr.""" |
721 | 1901 | tree1 = self.make_branch_and_tree('tree1') | 1901 | tree1 = self.make_branch_and_tree('tree1') |
722 | 1902 | tree2 = self.make_to_branch_and_tree('tree2') | 1902 | tree2 = self.make_to_branch_and_tree('tree2') |
724 | 1903 | root_id = tree1.get_root_id() | 1903 | root_id = tree1.path2id('') |
725 | 1904 | tree2.set_root_id(root_id) | 1904 | tree2.set_root_id(root_id) |
726 | 1905 | 1905 | ||
727 | 1906 | # The final changes are: | 1906 | # The final changes are: |
728 | @@ -1921,7 +1921,7 @@ | |||
729 | 1921 | self.not_applicable_if_missing_in('a', tree2) | 1921 | self.not_applicable_if_missing_in('a', tree2) |
730 | 1922 | 1922 | ||
731 | 1923 | expected = self.sorted([ | 1923 | expected = self.sorted([ |
733 | 1924 | self.missing(b'a-id', 'a', 'a', tree2.get_root_id(), 'file'), | 1924 | self.missing(b'a-id', 'a', 'a', tree2.path2id(''), 'file'), |
734 | 1925 | self.unversioned(tree2, 'a2'), | 1925 | self.unversioned(tree2, 'a2'), |
735 | 1926 | ]) | 1926 | ]) |
736 | 1927 | self.assertEqual(expected, | 1927 | self.assertEqual(expected, |
737 | 1928 | 1928 | ||
738 | === modified file 'breezy/tests/per_repository/test_commit_builder.py' | |||
739 | --- breezy/tests/per_repository/test_commit_builder.py 2019-06-16 17:36:59 +0000 | |||
740 | +++ breezy/tests/per_repository/test_commit_builder.py 2019-07-25 23:25:31 +0000 | |||
741 | @@ -176,7 +176,7 @@ | |||
742 | 176 | builder.finish_inventory() | 176 | builder.finish_inventory() |
743 | 177 | builder.commit('rev') | 177 | builder.commit('rev') |
744 | 178 | builder_tree = builder.revision_tree() | 178 | builder_tree = builder.revision_tree() |
746 | 179 | new_root_id = builder_tree.get_root_id() | 179 | new_root_id = builder_tree.path2id('') |
747 | 180 | new_root_revision = builder_tree.get_file_revision(u'') | 180 | new_root_revision = builder_tree.get_file_revision(u'') |
748 | 181 | if tree.branch.repository.supports_rich_root(): | 181 | if tree.branch.repository.supports_rich_root(): |
749 | 182 | # We should not have seen a new root revision | 182 | # We should not have seen a new root revision |
750 | @@ -332,7 +332,7 @@ | |||
751 | 332 | try: | 332 | try: |
752 | 333 | tree.add_reference(subtree) | 333 | tree.add_reference(subtree) |
753 | 334 | self._commit_check_unchanged(tree, 'reference', | 334 | self._commit_check_unchanged(tree, 'reference', |
755 | 335 | subtree.get_root_id()) | 335 | subtree.path2id('')) |
756 | 336 | except errors.UnsupportedOperation: | 336 | except errors.UnsupportedOperation: |
757 | 337 | return | 337 | return |
758 | 338 | 338 | ||
759 | 339 | 339 | ||
760 | === modified file 'breezy/tests/per_repository/test_repository.py' | |||
761 | --- breezy/tests/per_repository/test_repository.py 2019-06-26 23:12:10 +0000 | |||
762 | +++ breezy/tests/per_repository/test_repository.py 2019-07-25 23:25:31 +0000 | |||
763 | @@ -485,7 +485,6 @@ | |||
764 | 485 | rev_tree = tree.branch.repository.revision_tree(tree.last_revision()) | 485 | rev_tree = tree.branch.repository.revision_tree(tree.last_revision()) |
765 | 486 | rev_tree.lock_read() | 486 | rev_tree.lock_read() |
766 | 487 | self.addCleanup(rev_tree.unlock) | 487 | self.addCleanup(rev_tree.unlock) |
767 | 488 | root_id = rev_tree.get_root_id() | ||
768 | 489 | self.assertEqual(revid, rev_tree.get_file_revision(u'')) | 488 | self.assertEqual(revid, rev_tree.get_file_revision(u'')) |
769 | 490 | 489 | ||
770 | 491 | def test_pointless_commit(self): | 490 | def test_pointless_commit(self): |
771 | 492 | 491 | ||
772 | === modified file 'breezy/tests/per_repository_vf/test_fileid_involved.py' | |||
773 | --- breezy/tests/per_repository_vf/test_fileid_involved.py 2019-06-17 23:01:58 +0000 | |||
774 | +++ breezy/tests/per_repository_vf/test_fileid_involved.py 2019-07-25 23:25:31 +0000 | |||
775 | @@ -277,7 +277,7 @@ | |||
776 | 277 | def fileids_altered_by_revision_ids(self, revision_ids): | 277 | def fileids_altered_by_revision_ids(self, revision_ids): |
777 | 278 | """This is a wrapper to strip TREE_ROOT if it occurs""" | 278 | """This is a wrapper to strip TREE_ROOT if it occurs""" |
778 | 279 | repo = self.branch.repository | 279 | repo = self.branch.repository |
780 | 280 | root_id = self.branch.basis_tree().get_root_id() | 280 | root_id = self.branch.basis_tree().path2id('') |
781 | 281 | result = repo.fileids_altered_by_revision_ids(revision_ids) | 281 | result = repo.fileids_altered_by_revision_ids(revision_ids) |
782 | 282 | if root_id in result: | 282 | if root_id in result: |
783 | 283 | del result[root_id] | 283 | del result[root_id] |
784 | @@ -352,7 +352,7 @@ | |||
785 | 352 | repo.lock_read() | 352 | repo.lock_read() |
786 | 353 | self.addCleanup(repo.unlock) | 353 | self.addCleanup(repo.unlock) |
787 | 354 | file_ids = repo.fileids_altered_by_revision_ids([revision_id]) | 354 | file_ids = repo.fileids_altered_by_revision_ids([revision_id]) |
789 | 355 | root_id = main_wt.basis_tree().get_root_id() | 355 | root_id = main_wt.basis_tree().path2id('') |
790 | 356 | if root_id in file_ids: | 356 | if root_id in file_ids: |
791 | 357 | self.assertEqual({file_id: {revision_id}, | 357 | self.assertEqual({file_id: {revision_id}, |
792 | 358 | root_id: {revision_id} | 358 | root_id: {revision_id} |
793 | 359 | 359 | ||
794 | === modified file 'breezy/tests/per_repository_vf/test_repository.py' | |||
795 | --- breezy/tests/per_repository_vf/test_repository.py 2019-05-29 03:22:34 +0000 | |||
796 | +++ breezy/tests/per_repository_vf/test_repository.py 2019-07-25 23:25:31 +0000 | |||
797 | @@ -280,7 +280,7 @@ | |||
798 | 280 | 'file_id %r cannot be stored on this' | 280 | 'file_id %r cannot be stored on this' |
799 | 281 | ' platform for this repo format' % (file_id,)) | 281 | ' platform for this repo format' % (file_id,)) |
800 | 282 | if repo._format.rich_root_data: | 282 | if repo._format.rich_root_data: |
802 | 283 | root_commit = (tree.get_root_id(),) + rev_key | 283 | root_commit = (tree.path2id(''),) + rev_key |
803 | 284 | keys = {root_commit} | 284 | keys = {root_commit} |
804 | 285 | parents = {root_commit: ()} | 285 | parents = {root_commit: ()} |
805 | 286 | else: | 286 | else: |
806 | 287 | 287 | ||
807 | === modified file 'breezy/tests/per_tree/test_get_root_id.py' | |||
808 | --- breezy/tests/per_tree/test_get_root_id.py 2018-11-11 04:08:32 +0000 | |||
809 | +++ breezy/tests/per_tree/test_get_root_id.py 2019-07-25 23:25:31 +0000 | |||
810 | @@ -14,7 +14,7 @@ | |||
811 | 14 | # along with this program; if not, write to the Free Software | 14 | # along with this program; if not, write to the Free Software |
812 | 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 15 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
813 | 16 | 16 | ||
815 | 17 | """Tests for Tree.get_root_id()""" | 17 | """Tests for Tree.path2id('')""" |
816 | 18 | 18 | ||
817 | 19 | from breezy.tests.per_tree import TestCaseWithTree | 19 | from breezy.tests.per_tree import TestCaseWithTree |
818 | 20 | 20 | ||
819 | @@ -40,9 +40,9 @@ | |||
820 | 40 | def test_get_root_id_default(self): | 40 | def test_get_root_id_default(self): |
821 | 41 | tree = self.make_tree_with_default_root_id() | 41 | tree = self.make_tree_with_default_root_id() |
822 | 42 | with tree.lock_read(): | 42 | with tree.lock_read(): |
824 | 43 | self.assertIsNot(None, tree.get_root_id()) | 43 | self.assertIsNot(None, tree.path2id('')) |
825 | 44 | 44 | ||
826 | 45 | def test_get_root_id_fixed(self): | 45 | def test_get_root_id_fixed(self): |
827 | 46 | tree = self.make_tree_with_fixed_root_id() | 46 | tree = self.make_tree_with_fixed_root_id() |
828 | 47 | with tree.lock_read(): | 47 | with tree.lock_read(): |
830 | 48 | self.assertEqual(b'custom-tree-root-id', tree.get_root_id()) | 48 | self.assertEqual(b'custom-tree-root-id', tree.path2id('')) |
831 | 49 | 49 | ||
832 | === modified file 'breezy/tests/per_tree/test_ids.py' | |||
833 | --- breezy/tests/per_tree/test_ids.py 2018-11-11 04:08:32 +0000 | |||
834 | +++ breezy/tests/per_tree/test_ids.py 2019-07-25 23:25:31 +0000 | |||
835 | @@ -43,7 +43,7 @@ | |||
836 | 43 | self.assertEqual(b'bla-id', self.tree_a.path2id(['bla'])) | 43 | self.assertEqual(b'bla-id', self.tree_a.path2id(['bla'])) |
837 | 44 | self.assertEqual(b'dir-id', self.tree_a.path2id(['dir'])) | 44 | self.assertEqual(b'dir-id', self.tree_a.path2id(['dir'])) |
838 | 45 | self.assertEqual(b'file-id', self.tree_a.path2id(['dir', 'file'])) | 45 | self.assertEqual(b'file-id', self.tree_a.path2id(['dir', 'file'])) |
840 | 46 | self.assertEqual(self.tree_a.get_root_id(), | 46 | self.assertEqual(self.tree_a.path2id(''), |
841 | 47 | self.tree_a.path2id([])) | 47 | self.tree_a.path2id([])) |
842 | 48 | self.assertIs(None, self.tree_a.path2id(['idontexist'])) | 48 | self.assertIs(None, self.tree_a.path2id(['idontexist'])) |
843 | 49 | self.assertIs(None, self.tree_a.path2id(['dir', 'idontexist'])) | 49 | self.assertIs(None, self.tree_a.path2id(['dir', 'idontexist'])) |
844 | 50 | 50 | ||
845 | === modified file 'breezy/tests/per_tree/test_test_trees.py' | |||
846 | --- breezy/tests/per_tree/test_test_trees.py 2018-11-19 23:04:59 +0000 | |||
847 | +++ breezy/tests/per_tree/test_test_trees.py 2019-07-25 23:25:31 +0000 | |||
848 | @@ -273,7 +273,7 @@ | |||
849 | 273 | b'ba\xe2\x82\xacz-id', | 273 | b'ba\xe2\x82\xacz-id', |
850 | 274 | ] | 274 | ] |
851 | 275 | self.build_tree(paths[1:]) | 275 | self.build_tree(paths[1:]) |
853 | 276 | if tree.get_root_id() is None: | 276 | if tree.path2id('') is None: |
854 | 277 | # Some trees do not have a root yet. | 277 | # Some trees do not have a root yet. |
855 | 278 | tree.add(paths, file_ids) | 278 | tree.add(paths, file_ids) |
856 | 279 | else: | 279 | else: |
857 | 280 | 280 | ||
858 | === modified file 'breezy/tests/per_tree/test_tree.py' | |||
859 | --- breezy/tests/per_tree/test_tree.py 2019-06-29 12:29:45 +0000 | |||
860 | +++ breezy/tests/per_tree/test_tree.py 2019-07-25 23:25:31 +0000 | |||
861 | @@ -120,7 +120,7 @@ | |||
862 | 120 | def test_get_root_id(self): | 120 | def test_get_root_id(self): |
863 | 121 | # trees should return some kind of root id; it can be none | 121 | # trees should return some kind of root id; it can be none |
864 | 122 | tree = self.make_branch_and_tree('tree') | 122 | tree = self.make_branch_and_tree('tree') |
866 | 123 | root_id = tree.get_root_id() | 123 | root_id = tree.path2id('') |
867 | 124 | if root_id is not None: | 124 | if root_id is not None: |
868 | 125 | self.assertIsInstance(root_id, bytes) | 125 | self.assertIsInstance(root_id, bytes) |
869 | 126 | 126 | ||
870 | 127 | 127 | ||
871 | === modified file 'breezy/tests/per_workingtree/test_add.py' | |||
872 | --- breezy/tests/per_workingtree/test_add.py 2018-11-11 04:08:32 +0000 | |||
873 | +++ breezy/tests/per_workingtree/test_add.py 2019-07-25 23:25:31 +0000 | |||
874 | @@ -103,7 +103,7 @@ | |||
875 | 103 | tree.add(['dir'], [b'dir-id']) | 103 | tree.add(['dir'], [b'dir-id']) |
876 | 104 | tree.add(['dir/subdir'], [b'subdir-id']) | 104 | tree.add(['dir/subdir'], [b'subdir-id']) |
877 | 105 | tree.add(['dir/subdir/foo'], [b'foo-id']) | 105 | tree.add(['dir/subdir/foo'], [b'foo-id']) |
879 | 106 | root_id = tree.get_root_id() | 106 | root_id = tree.path2id('') |
880 | 107 | 107 | ||
881 | 108 | self.assertTreeLayout([('', root_id), ('dir/', b'dir-id'), | 108 | self.assertTreeLayout([('', root_id), ('dir/', b'dir-id'), |
882 | 109 | ('dir/subdir/', b'subdir-id'), | 109 | ('dir/subdir/', b'subdir-id'), |
883 | @@ -136,7 +136,7 @@ | |||
884 | 136 | tree.add(['a', 'b', 'dir', 'dir/subdir', 'dir/subdir/foo'], | 136 | tree.add(['a', 'b', 'dir', 'dir/subdir', 'dir/subdir/foo'], |
885 | 137 | [b'a-id', b'b-id', b'dir-id', b'subdir-id', b'foo-id']) | 137 | [b'a-id', b'b-id', b'dir-id', b'subdir-id', b'foo-id']) |
886 | 138 | 138 | ||
888 | 139 | self.assertTreeLayout([('', tree.get_root_id()), ('a', b'a-id'), ('b', b'b-id'), | 139 | self.assertTreeLayout([('', tree.path2id('')), ('a', b'a-id'), ('b', b'b-id'), |
889 | 140 | ('dir/', b'dir-id'), ('dir/subdir/', b'subdir-id'), | 140 | ('dir/', b'dir-id'), ('dir/subdir/', b'subdir-id'), |
890 | 141 | ('dir/subdir/foo', b'foo-id')], tree) | 141 | ('dir/subdir/foo', b'foo-id')], tree) |
891 | 142 | 142 | ||
892 | 143 | 143 | ||
893 | === modified file 'breezy/tests/per_workingtree/test_add_reference.py' | |||
894 | --- breezy/tests/per_workingtree/test_add_reference.py 2018-11-16 18:33:17 +0000 | |||
895 | +++ breezy/tests/per_workingtree/test_add_reference.py 2019-07-25 23:25:31 +0000 | |||
896 | @@ -49,7 +49,7 @@ | |||
897 | 49 | 49 | ||
898 | 50 | def test_add_reference(self): | 50 | def test_add_reference(self): |
899 | 51 | tree, sub_tree = self.make_nested_trees() | 51 | tree, sub_tree = self.make_nested_trees() |
901 | 52 | sub_tree_root_id = sub_tree.get_root_id() | 52 | sub_tree_root_id = sub_tree.path2id('') |
902 | 53 | with tree.lock_write(): | 53 | with tree.lock_write(): |
903 | 54 | if tree.supports_setting_file_ids(): | 54 | if tree.supports_setting_file_ids(): |
904 | 55 | self.assertEqual(tree.path2id('sub-tree'), sub_tree_root_id) | 55 | self.assertEqual(tree.path2id('sub-tree'), sub_tree_root_id) |
905 | @@ -101,7 +101,7 @@ | |||
906 | 101 | 101 | ||
907 | 102 | def test_get_nested_tree(self): | 102 | def test_get_nested_tree(self): |
908 | 103 | tree, sub_tree = self.make_nested_trees() | 103 | tree, sub_tree = self.make_nested_trees() |
910 | 104 | sub_tree_root_id = sub_tree.get_root_id() | 104 | sub_tree_root_id = sub_tree.path2id('') |
911 | 105 | with tree.lock_read(): | 105 | with tree.lock_read(): |
912 | 106 | sub_tree2 = tree.get_nested_tree('sub-tree') | 106 | sub_tree2 = tree.get_nested_tree('sub-tree') |
913 | 107 | self.assertEqual(sub_tree.basedir, sub_tree2.basedir) | 107 | self.assertEqual(sub_tree.basedir, sub_tree2.basedir) |
914 | 108 | 108 | ||
915 | === modified file 'breezy/tests/per_workingtree/test_commit.py' | |||
916 | --- breezy/tests/per_workingtree/test_commit.py 2018-11-11 04:08:32 +0000 | |||
917 | +++ breezy/tests/per_workingtree/test_commit.py 2019-07-25 23:25:31 +0000 | |||
918 | @@ -53,13 +53,10 @@ | |||
919 | 53 | osutils.rmtree('a/dir') | 53 | osutils.rmtree('a/dir') |
920 | 54 | tree_a.commit('autoremoved') | 54 | tree_a.commit('autoremoved') |
921 | 55 | 55 | ||
925 | 56 | tree_a.lock_read() | 56 | with tree_a.lock_read(): |
926 | 57 | try: | 57 | root_id = tree_a.path2id('') |
924 | 58 | root_id = tree_a.get_root_id() | ||
927 | 59 | paths = [(path, ie.file_id) | 58 | paths = [(path, ie.file_id) |
928 | 60 | for path, ie in tree_a.iter_entries_by_dir()] | 59 | for path, ie in tree_a.iter_entries_by_dir()] |
929 | 61 | finally: | ||
930 | 62 | tree_a.unlock() | ||
931 | 63 | # The only paths left should be the root | 60 | # The only paths left should be the root |
932 | 64 | self.assertEqual([('', root_id)], paths) | 61 | self.assertEqual([('', root_id)], paths) |
933 | 65 | 62 | ||
934 | 66 | 63 | ||
935 | === modified file 'breezy/tests/per_workingtree/test_flush.py' | |||
936 | --- breezy/tests/per_workingtree/test_flush.py 2018-03-25 00:39:16 +0000 | |||
937 | +++ breezy/tests/per_workingtree/test_flush.py 2019-07-25 23:25:31 +0000 | |||
938 | @@ -26,11 +26,8 @@ | |||
939 | 26 | 26 | ||
940 | 27 | def test_flush_fresh_tree(self): | 27 | def test_flush_fresh_tree(self): |
941 | 28 | tree = self.make_branch_and_tree('t1') | 28 | tree = self.make_branch_and_tree('t1') |
944 | 29 | tree.lock_write() | 29 | with tree.lock_write(): |
943 | 30 | try: | ||
945 | 31 | tree.flush() | 30 | tree.flush() |
946 | 32 | finally: | ||
947 | 33 | tree.unlock() | ||
948 | 34 | 31 | ||
949 | 35 | def test_flush_when_inventory_is_modified(self): | 32 | def test_flush_when_inventory_is_modified(self): |
950 | 36 | if sys.platform == "win32": | 33 | if sys.platform == "win32": |
951 | @@ -49,30 +46,24 @@ | |||
952 | 49 | tree = self.make_branch_and_tree('tree') | 46 | tree = self.make_branch_and_tree('tree') |
953 | 50 | # prepare for a series of changes that will modify the | 47 | # prepare for a series of changes that will modify the |
954 | 51 | # inventory | 48 | # inventory |
958 | 52 | tree.lock_write() | 49 | with tree.lock_write(): |
959 | 53 | try: | 50 | old_root = tree.path2id('') |
957 | 54 | old_root = tree.get_root_id() | ||
960 | 55 | tree.add('') | 51 | tree.add('') |
961 | 56 | # to detect that the inventory is written by flush, we | 52 | # to detect that the inventory is written by flush, we |
962 | 57 | # first check that it was not written yet. | 53 | # first check that it was not written yet. |
963 | 58 | reference_tree = tree.controldir.open_workingtree() | 54 | reference_tree = tree.controldir.open_workingtree() |
965 | 59 | self.assertEqual(old_root, reference_tree.get_root_id()) | 55 | self.assertEqual(old_root, reference_tree.path2id('')) |
966 | 60 | # now flush the tree which should write the inventory. | 56 | # now flush the tree which should write the inventory. |
967 | 61 | tree.flush() | 57 | tree.flush() |
968 | 62 | # and check it was written using another reference tree | 58 | # and check it was written using another reference tree |
969 | 63 | reference_tree = tree.controldir.open_workingtree() | 59 | reference_tree = tree.controldir.open_workingtree() |
973 | 64 | self.assertIsNot(None, reference_tree.get_root_id()) | 60 | self.assertIsNot(None, reference_tree.path2id('')) |
971 | 65 | finally: | ||
972 | 66 | tree.unlock() | ||
974 | 67 | 61 | ||
975 | 68 | def test_flush_with_read_lock_fails(self): | 62 | def test_flush_with_read_lock_fails(self): |
976 | 69 | """Flush cannot be used during a read lock.""" | 63 | """Flush cannot be used during a read lock.""" |
977 | 70 | tree = self.make_branch_and_tree('t1') | 64 | tree = self.make_branch_and_tree('t1') |
980 | 71 | tree.lock_read() | 65 | with tree.lock_read(): |
979 | 72 | try: | ||
981 | 73 | self.assertRaises(errors.NotWriteLocked, tree.flush) | 66 | self.assertRaises(errors.NotWriteLocked, tree.flush) |
982 | 74 | finally: | ||
983 | 75 | tree.unlock() | ||
984 | 76 | 67 | ||
985 | 77 | def test_flush_with_no_lock_fails(self): | 68 | def test_flush_with_no_lock_fails(self): |
986 | 78 | tree = self.make_branch_and_tree('t1') | 69 | tree = self.make_branch_and_tree('t1') |
987 | 79 | 70 | ||
988 | === modified file 'breezy/tests/per_workingtree/test_inv.py' | |||
989 | --- breezy/tests/per_workingtree/test_inv.py 2018-11-11 04:08:32 +0000 | |||
990 | +++ breezy/tests/per_workingtree/test_inv.py 2019-07-25 23:25:31 +0000 | |||
991 | @@ -53,7 +53,7 @@ | |||
992 | 53 | wt = self.make_branch_and_tree('.') | 53 | wt = self.make_branch_and_tree('.') |
993 | 54 | wt.lock_write() | 54 | wt.lock_write() |
994 | 55 | self.addCleanup(wt.unlock) | 55 | self.addCleanup(wt.unlock) |
996 | 56 | root_id = wt.get_root_id() | 56 | root_id = wt.path2id('') |
997 | 57 | wt.apply_inventory_delta([(None, 'bar/foo', b'foo-id', | 57 | wt.apply_inventory_delta([(None, 'bar/foo', b'foo-id', |
998 | 58 | inventory.InventoryFile(b'foo-id', 'foo', parent_id=b'bar-id')), | 58 | inventory.InventoryFile(b'foo-id', 'foo', parent_id=b'bar-id')), |
999 | 59 | (None, 'bar', b'bar-id', inventory.InventoryDirectory(b'bar-id', | 59 | (None, 'bar', b'bar-id', inventory.InventoryDirectory(b'bar-id', |
1000 | @@ -74,7 +74,7 @@ | |||
1001 | 74 | def test_rename_dir_with_children(self): | 74 | def test_rename_dir_with_children(self): |
1002 | 75 | wt = self.make_branch_and_tree('.') | 75 | wt = self.make_branch_and_tree('.') |
1003 | 76 | wt.lock_write() | 76 | wt.lock_write() |
1005 | 77 | root_id = wt.get_root_id() | 77 | root_id = wt.path2id('') |
1006 | 78 | self.addCleanup(wt.unlock) | 78 | self.addCleanup(wt.unlock) |
1007 | 79 | self.build_tree(['foo/', 'foo/bar']) | 79 | self.build_tree(['foo/', 'foo/bar']) |
1008 | 80 | wt.add(['foo', 'foo/bar'], | 80 | wt.add(['foo', 'foo/bar'], |
1009 | @@ -88,7 +88,7 @@ | |||
1010 | 88 | def test_rename_dir_with_children_with_children(self): | 88 | def test_rename_dir_with_children_with_children(self): |
1011 | 89 | wt = self.make_branch_and_tree('.') | 89 | wt = self.make_branch_and_tree('.') |
1012 | 90 | wt.lock_write() | 90 | wt.lock_write() |
1014 | 91 | root_id = wt.get_root_id() | 91 | root_id = wt.path2id('') |
1015 | 92 | self.addCleanup(wt.unlock) | 92 | self.addCleanup(wt.unlock) |
1016 | 93 | self.build_tree(['foo/', 'foo/bar/', 'foo/bar/baz']) | 93 | self.build_tree(['foo/', 'foo/bar/', 'foo/bar/baz']) |
1017 | 94 | wt.add(['foo', 'foo/bar', 'foo/bar/baz'], | 94 | wt.add(['foo', 'foo/bar', 'foo/bar/baz'], |
1018 | @@ -118,7 +118,7 @@ | |||
1019 | 118 | """ | 118 | """ |
1020 | 119 | wt = self.make_branch_and_tree('.') | 119 | wt = self.make_branch_and_tree('.') |
1021 | 120 | wt.lock_write() | 120 | wt.lock_write() |
1023 | 121 | root_id = wt.get_root_id() | 121 | root_id = wt.path2id('') |
1024 | 122 | self.addCleanup(wt.unlock) | 122 | self.addCleanup(wt.unlock) |
1025 | 123 | self.build_tree(['foo/', 'foo/bar', 'baz/', 'baz/qux']) | 123 | self.build_tree(['foo/', 'foo/bar', 'baz/', 'baz/qux']) |
1026 | 124 | wt.add(['foo', 'foo/bar', 'baz', 'baz/qux'], | 124 | wt.add(['foo', 'foo/bar', 'baz', 'baz/qux'], |
1027 | @@ -137,7 +137,7 @@ | |||
1028 | 137 | unable to find the child.) | 137 | unable to find the child.) |
1029 | 138 | """ | 138 | """ |
1030 | 139 | wt = self.make_branch_and_tree('.') | 139 | wt = self.make_branch_and_tree('.') |
1032 | 140 | root_id = wt.get_root_id() | 140 | root_id = wt.path2id('') |
1033 | 141 | self.build_tree(['dir/', 'dir/child', 'other/']) | 141 | self.build_tree(['dir/', 'dir/child', 'other/']) |
1034 | 142 | wt.add(['dir', 'dir/child', 'other'], | 142 | wt.add(['dir', 'dir/child', 'other'], |
1035 | 143 | [b'dir-id', b'child-id', b'other-id']) | 143 | [b'dir-id', b'child-id', b'other-id']) |
1036 | @@ -155,7 +155,7 @@ | |||
1037 | 155 | wt.lock_write() | 155 | wt.lock_write() |
1038 | 156 | self.addCleanup(wt.unlock) | 156 | self.addCleanup(wt.unlock) |
1039 | 157 | 157 | ||
1041 | 158 | root_id = wt.get_root_id() | 158 | root_id = wt.path2id('') |
1042 | 159 | wt.apply_inventory_delta([('', None, root_id, None), | 159 | wt.apply_inventory_delta([('', None, root_id, None), |
1043 | 160 | (None, '', b'root-id', | 160 | (None, '', b'root-id', |
1044 | 161 | inventory.InventoryDirectory(b'root-id', '', None))]) | 161 | inventory.InventoryDirectory(b'root-id', '', None))]) |
1045 | 162 | 162 | ||
1046 | === modified file 'breezy/tests/per_workingtree/test_locking.py' | |||
1047 | --- breezy/tests/per_workingtree/test_locking.py 2018-03-25 00:39:16 +0000 | |||
1048 | +++ breezy/tests/per_workingtree/test_locking.py 2019-07-25 23:25:31 +0000 | |||
1049 | @@ -148,23 +148,23 @@ | |||
1050 | 148 | # e.g. mkdir('foo') but all the mutating methods at the | 148 | # e.g. mkdir('foo') but all the mutating methods at the |
1051 | 149 | # moment trigger inventory writes and thus will not | 149 | # moment trigger inventory writes and thus will not |
1052 | 150 | # let us trigger a read-when-dirty situation. | 150 | # let us trigger a read-when-dirty situation. |
1054 | 151 | old_root = tree.get_root_id() | 151 | old_root = tree.path2id('') |
1055 | 152 | tree.add('') | 152 | tree.add('') |
1056 | 153 | # to detect that the inventory is written by unlock, we | 153 | # to detect that the inventory is written by unlock, we |
1057 | 154 | # first check that it was not written yet. | 154 | # first check that it was not written yet. |
1058 | 155 | # TODO: This requires taking a read lock while we are holding the above | 155 | # TODO: This requires taking a read lock while we are holding the above |
1059 | 156 | # write lock, which shouldn't actually be possible | 156 | # write lock, which shouldn't actually be possible |
1060 | 157 | reference_tree = tree.controldir.open_workingtree() | 157 | reference_tree = tree.controldir.open_workingtree() |
1062 | 158 | self.assertEqual(old_root, reference_tree.get_root_id()) | 158 | self.assertEqual(old_root, reference_tree.path2id('')) |
1063 | 159 | # now unlock the second held lock, which should do nothing. | 159 | # now unlock the second held lock, which should do nothing. |
1064 | 160 | tree.unlock() | 160 | tree.unlock() |
1065 | 161 | reference_tree = tree.controldir.open_workingtree() | 161 | reference_tree = tree.controldir.open_workingtree() |
1067 | 162 | self.assertEqual(old_root, reference_tree.get_root_id()) | 162 | self.assertEqual(old_root, reference_tree.path2id('')) |
1068 | 163 | # unlocking the first lock we took will now flush. | 163 | # unlocking the first lock we took will now flush. |
1069 | 164 | tree.unlock() | 164 | tree.unlock() |
1070 | 165 | # and check it was written using another reference tree | 165 | # and check it was written using another reference tree |
1071 | 166 | reference_tree = tree.controldir.open_workingtree() | 166 | reference_tree = tree.controldir.open_workingtree() |
1073 | 167 | self.assertIsNot(None, reference_tree.get_root_id()) | 167 | self.assertIsNot(None, reference_tree.path2id('')) |
1074 | 168 | 168 | ||
1075 | 169 | def test_unlock_from_tree_write_lock_flushes(self): | 169 | def test_unlock_from_tree_write_lock_flushes(self): |
1076 | 170 | self._test_unlock_with_lock_method("lock_tree_write") | 170 | self._test_unlock_with_lock_method("lock_tree_write") |
1077 | 171 | 171 | ||
1078 | === modified file 'breezy/tests/per_workingtree/test_merge_from_branch.py' | |||
1079 | --- breezy/tests/per_workingtree/test_merge_from_branch.py 2019-06-17 19:04:30 +0000 | |||
1080 | +++ breezy/tests/per_workingtree/test_merge_from_branch.py 2019-07-25 23:25:31 +0000 | |||
1081 | @@ -166,7 +166,7 @@ | |||
1082 | 166 | inner, to_revision=revs[0], from_revision=b'null:') | 166 | inner, to_revision=revs[0], from_revision=b'null:') |
1083 | 167 | # retain original root id. | 167 | # retain original root id. |
1084 | 168 | if outer.supports_setting_file_ids(): | 168 | if outer.supports_setting_file_ids(): |
1086 | 169 | outer.set_root_id(outer.basis_tree().get_root_id()) | 169 | outer.set_root_id(outer.basis_tree().path2id('')) |
1087 | 170 | outer.commit('merge inner branch') | 170 | outer.commit('merge inner branch') |
1088 | 171 | outer.mkdir('dir-outer') | 171 | outer.mkdir('dir-outer') |
1089 | 172 | outer.move(['dir', 'file3'], to_dir='dir-outer') | 172 | outer.move(['dir', 'file3'], to_dir='dir-outer') |
1090 | 173 | 173 | ||
1091 | === modified file 'breezy/tests/per_workingtree/test_pull.py' | |||
1092 | --- breezy/tests/per_workingtree/test_pull.py 2018-11-11 04:08:32 +0000 | |||
1093 | +++ breezy/tests/per_workingtree/test_pull.py 2019-07-25 23:25:31 +0000 | |||
1094 | @@ -33,9 +33,9 @@ | |||
1095 | 33 | 33 | ||
1096 | 34 | def test_pull_null(self): | 34 | def test_pull_null(self): |
1097 | 35 | tree_a, tree_b, rev_a = self.get_pullable_trees() | 35 | tree_a, tree_b, rev_a = self.get_pullable_trees() |
1099 | 36 | root_id = tree_a.get_root_id() | 36 | root_id = tree_a.path2id('') |
1100 | 37 | tree_a.pull(tree_b.branch, stop_revision=NULL_REVISION, overwrite=True) | 37 | tree_a.pull(tree_b.branch, stop_revision=NULL_REVISION, overwrite=True) |
1102 | 38 | self.assertEqual(root_id, tree_a.get_root_id()) | 38 | self.assertEqual(root_id, tree_a.path2id('')) |
1103 | 39 | 39 | ||
1104 | 40 | def test_pull(self): | 40 | def test_pull(self): |
1105 | 41 | tree_a, tree_b, rev_a = self.get_pullable_trees() | 41 | tree_a, tree_b, rev_a = self.get_pullable_trees() |
1106 | @@ -66,11 +66,11 @@ | |||
1107 | 66 | tree.add(['file']) | 66 | tree.add(['file']) |
1108 | 67 | tree.commit('first') | 67 | tree.commit('first') |
1109 | 68 | to_tree = tree.controldir.sprout('to').open_workingtree() | 68 | to_tree = tree.controldir.sprout('to').open_workingtree() |
1111 | 69 | self.assertEqual(b'first_root_id', to_tree.get_root_id()) | 69 | self.assertEqual(b'first_root_id', to_tree.path2id('')) |
1112 | 70 | tree.set_root_id(b'second_root_id') | 70 | tree.set_root_id(b'second_root_id') |
1113 | 71 | tree.commit('second') | 71 | tree.commit('second') |
1114 | 72 | to_tree.pull(tree.branch) | 72 | to_tree.pull(tree.branch) |
1116 | 73 | self.assertEqual(b'second_root_id', to_tree.get_root_id()) | 73 | self.assertEqual(b'second_root_id', to_tree.path2id('')) |
1117 | 74 | 74 | ||
1118 | 75 | 75 | ||
1119 | 76 | class TestPullWithOrphans(per_workingtree.TestCaseWithWorkingTree): | 76 | class TestPullWithOrphans(per_workingtree.TestCaseWithWorkingTree): |
1120 | 77 | 77 | ||
1121 | === modified file 'breezy/tests/per_workingtree/test_rename_one.py' | |||
1122 | --- breezy/tests/per_workingtree/test_rename_one.py 2018-11-11 04:08:32 +0000 | |||
1123 | +++ breezy/tests/per_workingtree/test_rename_one.py 2019-07-25 23:25:31 +0000 | |||
1124 | @@ -342,7 +342,6 @@ | |||
1125 | 342 | self.build_tree(['a/', 'a/b', 'c/']) | 342 | self.build_tree(['a/', 'a/b', 'c/']) |
1126 | 343 | tree.add(['a', 'a/b', 'c']) | 343 | tree.add(['a', 'a/b', 'c']) |
1127 | 344 | tree.commit('initial') | 344 | tree.commit('initial') |
1128 | 345 | root_id = tree.get_root_id() | ||
1129 | 346 | 345 | ||
1130 | 347 | tree.rename_one('a/b', 'c/foo') | 346 | tree.rename_one('a/b', 'c/foo') |
1131 | 348 | self.assertPathRelations( | 347 | self.assertPathRelations( |
1132 | 349 | 348 | ||
1133 | === modified file 'breezy/tests/per_workingtree/test_set_root_id.py' | |||
1134 | --- breezy/tests/per_workingtree/test_set_root_id.py 2018-02-18 15:21:06 +0000 | |||
1135 | +++ breezy/tests/per_workingtree/test_set_root_id.py 2019-07-25 23:25:31 +0000 | |||
1136 | @@ -36,25 +36,22 @@ | |||
1137 | 36 | self.skipTest('format does not support setting file ids') | 36 | self.skipTest('format does not support setting file ids') |
1138 | 37 | # setting the root id allows it to be read via get_root_id. | 37 | # setting the root id allows it to be read via get_root_id. |
1139 | 38 | root_id = u'\xe5n-id'.encode('utf8') | 38 | root_id = u'\xe5n-id'.encode('utf8') |
1143 | 39 | tree.lock_write() | 39 | with tree.lock_write(): |
1144 | 40 | try: | 40 | old_id = tree.path2id('') |
1142 | 41 | old_id = tree.get_root_id() | ||
1145 | 42 | tree.set_root_id(root_id) | 41 | tree.set_root_id(root_id) |
1147 | 43 | self.assertEqual(root_id, tree.get_root_id()) | 42 | self.assertEqual(root_id, tree.path2id('')) |
1148 | 44 | # set root id should not have triggered a flush of the tree, | 43 | # set root id should not have triggered a flush of the tree, |
1149 | 45 | # so check a new tree sees the old state. | 44 | # so check a new tree sees the old state. |
1150 | 46 | reference_tree = tree.controldir.open_workingtree() | 45 | reference_tree = tree.controldir.open_workingtree() |
1154 | 47 | self.assertEqual(old_id, reference_tree.get_root_id()) | 46 | self.assertEqual(old_id, reference_tree.path2id('')) |
1152 | 48 | finally: | ||
1153 | 49 | tree.unlock() | ||
1155 | 50 | # having unlocked the tree, the value should have been | 47 | # having unlocked the tree, the value should have been |
1156 | 51 | # preserved into the next lock, which is an implicit read | 48 | # preserved into the next lock, which is an implicit read |
1157 | 52 | # lock around the get_root_id call. | 49 | # lock around the get_root_id call. |
1159 | 53 | self.assertEqual(root_id, tree.get_root_id()) | 50 | self.assertEqual(root_id, tree.path2id('')) |
1160 | 54 | # and if we get a new working tree instance, then the value | 51 | # and if we get a new working tree instance, then the value |
1161 | 55 | # should still be retained | 52 | # should still be retained |
1162 | 56 | tree = tree.controldir.open_workingtree() | 53 | tree = tree.controldir.open_workingtree() |
1164 | 57 | self.assertEqual(root_id, tree.get_root_id()) | 54 | self.assertEqual(root_id, tree.path2id('')) |
1165 | 58 | tree._validate() | 55 | tree._validate() |
1166 | 59 | 56 | ||
1167 | 60 | def test_set_root_id(self): | 57 | def test_set_root_id(self): |
1168 | @@ -63,12 +60,12 @@ | |||
1169 | 63 | self.skipTest('format does not support setting file ids') | 60 | self.skipTest('format does not support setting file ids') |
1170 | 64 | tree.lock_write() | 61 | tree.lock_write() |
1171 | 65 | self.addCleanup(tree.unlock) | 62 | self.addCleanup(tree.unlock) |
1173 | 66 | orig_root_id = tree.get_root_id() | 63 | orig_root_id = tree.path2id('') |
1174 | 67 | self.assertNotEqual(b'custom-root-id', orig_root_id) | 64 | self.assertNotEqual(b'custom-root-id', orig_root_id) |
1175 | 68 | self.assertEqual('', tree.id2path(orig_root_id)) | 65 | self.assertEqual('', tree.id2path(orig_root_id)) |
1176 | 69 | self.assertRaises(errors.NoSuchId, tree.id2path, 'custom-root-id') | 66 | self.assertRaises(errors.NoSuchId, tree.id2path, 'custom-root-id') |
1177 | 70 | tree.set_root_id(b'custom-root-id') | 67 | tree.set_root_id(b'custom-root-id') |
1179 | 71 | self.assertEqual(b'custom-root-id', tree.get_root_id()) | 68 | self.assertEqual(b'custom-root-id', tree.path2id('')) |
1180 | 72 | self.assertEqual(b'custom-root-id', tree.path2id('')) | 69 | self.assertEqual(b'custom-root-id', tree.path2id('')) |
1181 | 73 | self.assertEqual('', tree.id2path(b'custom-root-id')) | 70 | self.assertEqual('', tree.id2path(b'custom-root-id')) |
1182 | 74 | self.assertRaises(errors.NoSuchId, tree.id2path, orig_root_id) | 71 | self.assertRaises(errors.NoSuchId, tree.id2path, orig_root_id) |
1183 | 75 | 72 | ||
1184 | === modified file 'breezy/tests/per_workingtree/test_workingtree.py' | |||
1185 | --- breezy/tests/per_workingtree/test_workingtree.py 2019-06-22 10:30:21 +0000 | |||
1186 | +++ breezy/tests/per_workingtree/test_workingtree.py 2019-07-25 23:25:31 +0000 | |||
1187 | @@ -575,8 +575,8 @@ | |||
1188 | 575 | # and update checkout | 575 | # and update checkout |
1189 | 576 | self.assertEqual(0, checkout.update()) | 576 | self.assertEqual(0, checkout.update()) |
1190 | 577 | self.assertPathExists('checkout/file') | 577 | self.assertPathExists('checkout/file') |
1193 | 578 | self.assertEqual(wt.get_root_id(), checkout.get_root_id()) | 578 | self.assertEqual(wt.path2id(''), checkout.path2id('')) |
1194 | 579 | self.assertNotEqual(None, wt.get_root_id()) | 579 | self.assertNotEqual(None, wt.path2id('')) |
1195 | 580 | 580 | ||
1196 | 581 | def test_update_sets_updated_root_id(self): | 581 | def test_update_sets_updated_root_id(self): |
1197 | 582 | wt = self.make_branch_and_tree('tree') | 582 | wt = self.make_branch_and_tree('tree') |
1198 | @@ -585,16 +585,16 @@ | |||
1199 | 585 | 'first_root_id') | 585 | 'first_root_id') |
1200 | 586 | return | 586 | return |
1201 | 587 | wt.set_root_id(b'first_root_id') | 587 | wt.set_root_id(b'first_root_id') |
1203 | 588 | self.assertEqual(b'first_root_id', wt.get_root_id()) | 588 | self.assertEqual(b'first_root_id', wt.path2id('')) |
1204 | 589 | self.build_tree(['tree/file']) | 589 | self.build_tree(['tree/file']) |
1205 | 590 | wt.add(['file']) | 590 | wt.add(['file']) |
1206 | 591 | wt.commit('first') | 591 | wt.commit('first') |
1207 | 592 | co = wt.branch.create_checkout('checkout') | 592 | co = wt.branch.create_checkout('checkout') |
1208 | 593 | wt.set_root_id(b'second_root_id') | 593 | wt.set_root_id(b'second_root_id') |
1209 | 594 | wt.commit('second') | 594 | wt.commit('second') |
1211 | 595 | self.assertEqual(b'second_root_id', wt.get_root_id()) | 595 | self.assertEqual(b'second_root_id', wt.path2id('')) |
1212 | 596 | self.assertEqual(0, co.update()) | 596 | self.assertEqual(0, co.update()) |
1214 | 597 | self.assertEqual(b'second_root_id', co.get_root_id()) | 597 | self.assertEqual(b'second_root_id', co.path2id('')) |
1215 | 598 | 598 | ||
1216 | 599 | def test_update_returns_conflict_count(self): | 599 | def test_update_returns_conflict_count(self): |
1217 | 600 | # working tree formats from the meta-dir format and newer support | 600 | # working tree formats from the meta-dir format and newer support |
1218 | @@ -920,7 +920,7 @@ | |||
1219 | 920 | # if we write write an inventory then do a walkdirs we should get back | 920 | # if we write write an inventory then do a walkdirs we should get back |
1220 | 921 | # missing entries, and actual, and unknowns as appropriate. | 921 | # missing entries, and actual, and unknowns as appropriate. |
1221 | 922 | self.build_tree(['present', 'unknown']) | 922 | self.build_tree(['present', 'unknown']) |
1223 | 923 | inventory = Inventory(tree.get_root_id()) | 923 | inventory = Inventory(tree.path2id('')) |
1224 | 924 | inventory.add_path('missing', 'file', b'missing-id') | 924 | inventory.add_path('missing', 'file', b'missing-id') |
1225 | 925 | inventory.add_path('present', 'file', b'present-id') | 925 | inventory.add_path('present', 'file', b'present-id') |
1226 | 926 | # there is no point in being able to write an inventory to an unlocked | 926 | # there is no point in being able to write an inventory to an unlocked |
1227 | @@ -932,7 +932,7 @@ | |||
1228 | 932 | present_stat = os.lstat('present') | 932 | present_stat = os.lstat('present') |
1229 | 933 | unknown_stat = os.lstat('unknown') | 933 | unknown_stat = os.lstat('unknown') |
1230 | 934 | expected_results = [ | 934 | expected_results = [ |
1232 | 935 | (('', tree.get_root_id()), | 935 | (('', tree.path2id('')), |
1233 | 936 | [('missing', 'missing', 'unknown', None, b'missing-id', 'file'), | 936 | [('missing', 'missing', 'unknown', None, b'missing-id', 'file'), |
1234 | 937 | ('present', 'present', 'file', | 937 | ('present', 'present', 'file', |
1235 | 938 | present_stat, b'present-id', 'file'), | 938 | present_stat, b'present-id', 'file'), |
1236 | 939 | 939 | ||
1237 | === modified file 'breezy/tests/test__dirstate_helpers.py' | |||
1238 | --- breezy/tests/test__dirstate_helpers.py 2019-06-15 12:04:34 +0000 | |||
1239 | +++ breezy/tests/test__dirstate_helpers.py 2019-07-25 23:25:31 +0000 | |||
1240 | @@ -1326,7 +1326,7 @@ | |||
1241 | 1326 | tree = self.make_branch_and_tree('tree') | 1326 | tree = self.make_branch_and_tree('tree') |
1242 | 1327 | self.build_tree(['tree/file']) | 1327 | self.build_tree(['tree/file']) |
1243 | 1328 | tree.add(['file'], [b'file-id']) | 1328 | tree.add(['file'], [b'file-id']) |
1245 | 1329 | self.assertChangedFileIds([tree.get_root_id(), b'file-id'], tree) | 1329 | self.assertChangedFileIds([tree.path2id(''), b'file-id'], tree) |
1246 | 1330 | tree.commit('one') | 1330 | tree.commit('one') |
1247 | 1331 | self.assertChangedFileIds([], tree) | 1331 | self.assertChangedFileIds([], tree) |
1248 | 1332 | 1332 | ||
1249 | 1333 | 1333 | ||
1250 | === modified file 'breezy/tests/test_commit_merge.py' | |||
1251 | --- breezy/tests/test_commit_merge.py 2018-11-11 04:08:32 +0000 | |||
1252 | +++ breezy/tests/test_commit_merge.py 2019-07-25 23:25:31 +0000 | |||
1253 | @@ -76,7 +76,7 @@ | |||
1254 | 76 | bx = wtx.branch | 76 | bx = wtx.branch |
1255 | 77 | wtx.commit('establish root id') | 77 | wtx.commit('establish root id') |
1256 | 78 | wty = wtx.controldir.sprout('y').open_workingtree() | 78 | wty = wtx.controldir.sprout('y').open_workingtree() |
1258 | 79 | self.assertEqual(wtx.get_root_id(), wty.get_root_id()) | 79 | self.assertEqual(wtx.path2id(''), wty.path2id('')) |
1259 | 80 | by = wty.branch | 80 | by = wty.branch |
1260 | 81 | 81 | ||
1261 | 82 | self.build_tree(['x/ecks', 'y/why']) | 82 | self.build_tree(['x/ecks', 'y/why']) |
1262 | 83 | 83 | ||
1263 | === modified file 'breezy/tests/test_dirstate.py' | |||
1264 | --- breezy/tests/test_dirstate.py 2019-06-03 22:25:41 +0000 | |||
1265 | +++ breezy/tests/test_dirstate.py 2019-07-25 23:25:31 +0000 | |||
1266 | @@ -394,7 +394,7 @@ | |||
1267 | 394 | # There are no files on disk and no parents | 394 | # There are no files on disk and no parents |
1268 | 395 | tree = self.make_branch_and_tree('tree') | 395 | tree = self.make_branch_and_tree('tree') |
1269 | 396 | expected_result = ([], [ | 396 | expected_result = ([], [ |
1271 | 397 | ((b'', b'', tree.get_root_id()), # common details | 397 | ((b'', b'', tree.path2id('')), # common details |
1272 | 398 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree | 398 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree |
1273 | 399 | ])]) | 399 | ])]) |
1274 | 400 | state = dirstate.DirState.from_tree(tree, 'dirstate') | 400 | state = dirstate.DirState.from_tree(tree, 'dirstate') |
1275 | @@ -407,7 +407,7 @@ | |||
1276 | 407 | rev_id = tree.commit('first post') | 407 | rev_id = tree.commit('first post') |
1277 | 408 | root_stat_pack = dirstate.pack_stat(os.stat(tree.basedir)) | 408 | root_stat_pack = dirstate.pack_stat(os.stat(tree.basedir)) |
1278 | 409 | expected_result = ([rev_id], [ | 409 | expected_result = ([rev_id], [ |
1280 | 410 | ((b'', b'', tree.get_root_id()), # common details | 410 | ((b'', b'', tree.path2id('')), # common details |
1281 | 411 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree | 411 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree |
1282 | 412 | (b'd', b'', 0, False, rev_id), # first parent details | 412 | (b'd', b'', 0, False, rev_id), # first parent details |
1283 | 413 | ])]) | 413 | ])]) |
1284 | @@ -427,7 +427,7 @@ | |||
1285 | 427 | rev_id2 = tree2.commit('second post', allow_pointless=True) | 427 | rev_id2 = tree2.commit('second post', allow_pointless=True) |
1286 | 428 | tree.merge_from_branch(tree2.branch) | 428 | tree.merge_from_branch(tree2.branch) |
1287 | 429 | expected_result = ([rev_id, rev_id2], [ | 429 | expected_result = ([rev_id, rev_id2], [ |
1289 | 430 | ((b'', b'', tree.get_root_id()), # common details | 430 | ((b'', b'', tree.path2id('')), # common details |
1290 | 431 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree | 431 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree |
1291 | 432 | (b'd', b'', 0, False, rev_id), # first parent details | 432 | (b'd', b'', 0, False, rev_id), # first parent details |
1292 | 433 | (b'd', b'', 0, False, rev_id), # second parent details | 433 | (b'd', b'', 0, False, rev_id), # second parent details |
1293 | @@ -446,7 +446,7 @@ | |||
1294 | 446 | tree = self.make_branch_and_tree('tree') | 446 | tree = self.make_branch_and_tree('tree') |
1295 | 447 | self.build_tree(['tree/unknown']) | 447 | self.build_tree(['tree/unknown']) |
1296 | 448 | expected_result = ([], [ | 448 | expected_result = ([], [ |
1298 | 449 | ((b'', b'', tree.get_root_id()), # common details | 449 | ((b'', b'', tree.path2id('')), # common details |
1299 | 450 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree | 450 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree |
1300 | 451 | ])]) | 451 | ])]) |
1301 | 452 | state = dirstate.DirState.from_tree(tree, 'dirstate') | 452 | state = dirstate.DirState.from_tree(tree, 'dirstate') |
1302 | @@ -463,7 +463,7 @@ | |||
1303 | 463 | # There are files on disk and no parents | 463 | # There are files on disk and no parents |
1304 | 464 | tree = self.get_tree_with_a_file() | 464 | tree = self.get_tree_with_a_file() |
1305 | 465 | expected_result = ([], [ | 465 | expected_result = ([], [ |
1307 | 466 | ((b'', b'', tree.get_root_id()), # common details | 466 | ((b'', b'', tree.path2id('')), # common details |
1308 | 467 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree | 467 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree |
1309 | 468 | ]), | 468 | ]), |
1310 | 469 | ((b'', b'a file', b'a-file-id'), # common | 469 | ((b'', b'a file', b'a-file-id'), # common |
1311 | @@ -481,7 +481,7 @@ | |||
1312 | 481 | # and length: | 481 | # and length: |
1313 | 482 | self.build_tree_contents([('tree/a file', b'new content\n')]) | 482 | self.build_tree_contents([('tree/a file', b'new content\n')]) |
1314 | 483 | expected_result = ([rev_id], [ | 483 | expected_result = ([rev_id], [ |
1316 | 484 | ((b'', b'', tree.get_root_id()), # common details | 484 | ((b'', b'', tree.path2id('')), # common details |
1317 | 485 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree | 485 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree |
1318 | 486 | (b'd', b'', 0, False, rev_id), # first parent details | 486 | (b'd', b'', 0, False, rev_id), # first parent details |
1319 | 487 | ]), | 487 | ]), |
1320 | @@ -508,7 +508,7 @@ | |||
1321 | 508 | # and length again, giving us three distinct values: | 508 | # and length again, giving us three distinct values: |
1322 | 509 | self.build_tree_contents([('tree/a file', b'new content\n')]) | 509 | self.build_tree_contents([('tree/a file', b'new content\n')]) |
1323 | 510 | expected_result = ([rev_id, rev_id2], [ | 510 | expected_result = ([rev_id, rev_id2], [ |
1325 | 511 | ((b'', b'', tree.get_root_id()), # common details | 511 | ((b'', b'', tree.path2id('')), # common details |
1326 | 512 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree | 512 | [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree |
1327 | 513 | (b'd', b'', 0, False, rev_id), # first parent details | 513 | (b'd', b'', 0, False, rev_id), # first parent details |
1328 | 514 | (b'd', b'', 0, False, rev_id), # second parent details | 514 | (b'd', b'', 0, False, rev_id), # second parent details |
1329 | @@ -573,7 +573,7 @@ | |||
1330 | 573 | # get a state object | 573 | # get a state object |
1331 | 574 | # no parents, default tree content | 574 | # no parents, default tree content |
1332 | 575 | expected_result = ([], [ | 575 | expected_result = ([], [ |
1334 | 576 | ((b'', b'', tree.get_root_id()), # common details | 576 | ((b'', b'', tree.path2id('')), # common details |
1335 | 577 | # current tree details, but new from_tree skips statting, it | 577 | # current tree details, but new from_tree skips statting, it |
1336 | 578 | # uses set_state_from_inventory, and thus depends on the | 578 | # uses set_state_from_inventory, and thus depends on the |
1337 | 579 | # inventory state. | 579 | # inventory state. |
1338 | @@ -899,7 +899,7 @@ | |||
1339 | 899 | tree1.add(['a', 'a/b', 'a-b', 'a/b/foo', 'a-b/bar'], | 899 | tree1.add(['a', 'a/b', 'a-b', 'a/b/foo', 'a-b/bar'], |
1340 | 900 | [b'a-id', b'b-id', b'a-b-id', b'foo-id', b'bar-id']) | 900 | [b'a-id', b'b-id', b'a-b-id', b'foo-id', b'bar-id']) |
1341 | 901 | tree1.commit('rev1', rev_id=b'rev1') | 901 | tree1.commit('rev1', rev_id=b'rev1') |
1343 | 902 | root_id = tree1.get_root_id() | 902 | root_id = tree1.path2id('') |
1344 | 903 | inv = tree1.root_inventory | 903 | inv = tree1.root_inventory |
1345 | 904 | finally: | 904 | finally: |
1346 | 905 | tree1.unlock() | 905 | tree1.unlock() |
1347 | @@ -1045,7 +1045,7 @@ | |||
1348 | 1045 | tree2.lock_write() | 1045 | tree2.lock_write() |
1349 | 1046 | try: | 1046 | try: |
1350 | 1047 | revid2 = tree2.commit('foo') | 1047 | revid2 = tree2.commit('foo') |
1352 | 1048 | root_id = tree2.get_root_id() | 1048 | root_id = tree2.path2id('') |
1353 | 1049 | finally: | 1049 | finally: |
1354 | 1050 | tree2.unlock() | 1050 | tree2.unlock() |
1355 | 1051 | state = dirstate.DirState.initialize('dirstate') | 1051 | state = dirstate.DirState.initialize('dirstate') |
1356 | @@ -1116,7 +1116,7 @@ | |||
1357 | 1116 | try: | 1116 | try: |
1358 | 1117 | tree2.put_file_bytes_non_atomic('a file', b'new file-content') | 1117 | tree2.put_file_bytes_non_atomic('a file', b'new file-content') |
1359 | 1118 | revid2 = tree2.commit('foo') | 1118 | revid2 = tree2.commit('foo') |
1361 | 1119 | root_id = tree2.get_root_id() | 1119 | root_id = tree2.path2id('') |
1362 | 1120 | finally: | 1120 | finally: |
1363 | 1121 | tree2.unlock() | 1121 | tree2.unlock() |
1364 | 1122 | # check the layout in memory | 1122 | # check the layout in memory |
1365 | @@ -1337,10 +1337,9 @@ | |||
1366 | 1337 | # incorrect absent in tree 1, and future changes go to pot. | 1337 | # incorrect absent in tree 1, and future changes go to pot. |
1367 | 1338 | tree1 = self.make_branch_and_tree('tree1') | 1338 | tree1 = self.make_branch_and_tree('tree1') |
1368 | 1339 | self.build_tree(['tree1/b']) | 1339 | self.build_tree(['tree1/b']) |
1371 | 1340 | tree1.lock_write() | 1340 | with tree1.lock_write(): |
1370 | 1341 | try: | ||
1372 | 1342 | tree1.add(['b'], [b'b-id']) | 1341 | tree1.add(['b'], [b'b-id']) |
1374 | 1343 | root_id = tree1.get_root_id() | 1342 | root_id = tree1.path2id('') |
1375 | 1344 | inv = tree1.root_inventory | 1343 | inv = tree1.root_inventory |
1376 | 1345 | state = dirstate.DirState.initialize('dirstate') | 1344 | state = dirstate.DirState.initialize('dirstate') |
1377 | 1346 | try: | 1345 | try: |
1378 | @@ -1358,8 +1357,6 @@ | |||
1379 | 1358 | self.assertEqual(expected_result1, values) | 1357 | self.assertEqual(expected_result1, values) |
1380 | 1359 | finally: | 1358 | finally: |
1381 | 1360 | state.unlock() | 1359 | state.unlock() |
1382 | 1361 | finally: | ||
1383 | 1362 | tree1.unlock() | ||
1384 | 1363 | 1360 | ||
1385 | 1364 | 1361 | ||
1386 | 1365 | class TestDirStateHashUpdates(TestCaseWithDirState): | 1362 | class TestDirStateHashUpdates(TestCaseWithDirState): |
1387 | 1366 | 1363 | ||
1388 | === modified file 'breezy/tests/test_extract.py' | |||
1389 | --- breezy/tests/test_extract.py 2018-11-16 18:33:17 +0000 | |||
1390 | +++ breezy/tests/test_extract.py 2019-07-25 23:25:31 +0000 | |||
1391 | @@ -29,7 +29,7 @@ | |||
1392 | 29 | wt.add(['b', 'b/c', 'd'], [b'b-id', b'c-id', b'd-id']) | 29 | wt.add(['b', 'b/c', 'd'], [b'b-id', b'c-id', b'd-id']) |
1393 | 30 | wt.commit('added files') | 30 | wt.commit('added files') |
1394 | 31 | b_wt = wt.extract('b') | 31 | b_wt = wt.extract('b') |
1396 | 32 | self.assertEqual(b'b-id', b_wt.get_root_id()) | 32 | self.assertEqual(b'b-id', b_wt.path2id('')) |
1397 | 33 | self.assertEqual(b'c-id', b_wt.path2id('c')) | 33 | self.assertEqual(b'c-id', b_wt.path2id('c')) |
1398 | 34 | self.assertEqual('c', b_wt.id2path(b'c-id')) | 34 | self.assertEqual('c', b_wt.id2path(b'c-id')) |
1399 | 35 | self.assertRaises(errors.BzrError, wt.id2path, b'b-id') | 35 | self.assertRaises(errors.BzrError, wt.id2path, b'b-id') |
1400 | 36 | 36 | ||
1401 | === modified file 'breezy/tests/test_fetch.py' | |||
1402 | --- breezy/tests/test_fetch.py 2018-11-11 04:08:32 +0000 | |||
1403 | +++ breezy/tests/test_fetch.py 2019-07-25 23:25:31 +0000 | |||
1404 | @@ -498,7 +498,7 @@ | |||
1405 | 498 | self.tree.add_parent_tree_id(b'not-ghost-parent') | 498 | self.tree.add_parent_tree_id(b'not-ghost-parent') |
1406 | 499 | self.tree.commit('second commit', rev_id=b'second-id') | 499 | self.tree.commit('second commit', rev_id=b'second-id') |
1407 | 500 | self.repo.fetch(self.tree.branch.repository, b'second-id') | 500 | self.repo.fetch(self.tree.branch.repository, b'second-id') |
1409 | 501 | root_id = self.tree.get_root_id() | 501 | root_id = self.tree.path2id('') |
1410 | 502 | self.assertEqual( | 502 | self.assertEqual( |
1411 | 503 | ((root_id, b'left-parent'), (root_id, b'not-ghost-parent')), | 503 | ((root_id, b'left-parent'), (root_id, b'not-ghost-parent')), |
1412 | 504 | self.get_parents(root_id, b'second-id')) | 504 | self.get_parents(root_id, b'second-id')) |
1413 | 505 | 505 | ||
1414 | === modified file 'breezy/tests/test_matchers.py' | |||
1415 | --- breezy/tests/test_matchers.py 2018-11-11 04:08:32 +0000 | |||
1416 | +++ breezy/tests/test_matchers.py 2019-07-25 23:25:31 +0000 | |||
1417 | @@ -122,7 +122,7 @@ | |||
1418 | 122 | t.add(['a', 'b', 'b/c'], [b'a-id', b'b-id', b'c-id']) | 122 | t.add(['a', 'b', 'b/c'], [b'a-id', b'b-id', b'c-id']) |
1419 | 123 | self.assertThat(t, HasLayout(['', 'a', 'b/', 'b/c'])) | 123 | self.assertThat(t, HasLayout(['', 'a', 'b/', 'b/c'])) |
1420 | 124 | self.assertThat(t, HasLayout( | 124 | self.assertThat(t, HasLayout( |
1422 | 125 | [('', t.get_root_id()), | 125 | [('', t.path2id('')), |
1423 | 126 | ('a', b'a-id'), | 126 | ('a', b'a-id'), |
1424 | 127 | ('b/', b'b-id'), | 127 | ('b/', b'b-id'), |
1425 | 128 | ('b/c', b'c-id')])) | 128 | ('b/c', b'c-id')])) |
1426 | 129 | 129 | ||
1427 | === modified file 'breezy/tests/test_memorytree.py' | |||
1428 | --- breezy/tests/test_memorytree.py 2019-02-16 21:12:42 +0000 | |||
1429 | +++ breezy/tests/test_memorytree.py 2019-07-25 23:25:31 +0000 | |||
1430 | @@ -56,7 +56,7 @@ | |||
1431 | 56 | tree = MemoryTree.create_on_branch(branch) | 56 | tree = MemoryTree.create_on_branch(branch) |
1432 | 57 | with tree.lock_write(): | 57 | with tree.lock_write(): |
1433 | 58 | tree.add(['']) | 58 | tree.add(['']) |
1435 | 59 | self.assertIsNot(None, tree.get_root_id()) | 59 | self.assertIsNot(None, tree.path2id('')) |
1436 | 60 | 60 | ||
1437 | 61 | def test_lock_tree_write(self): | 61 | def test_lock_tree_write(self): |
1438 | 62 | """Check we can lock_tree_write and unlock MemoryTrees.""" | 62 | """Check we can lock_tree_write and unlock MemoryTrees.""" |
1439 | 63 | 63 | ||
1440 | === modified file 'breezy/tests/test_merge.py' | |||
1441 | --- breezy/tests/test_merge.py 2019-06-18 00:20:56 +0000 | |||
1442 | +++ breezy/tests/test_merge.py 2019-07-25 23:25:31 +0000 | |||
1443 | @@ -137,7 +137,7 @@ | |||
1444 | 137 | with merger.make_preview_transform() as tt: | 137 | with merger.make_preview_transform() as tt: |
1445 | 138 | self.assertEqual([], tt.find_conflicts()) | 138 | self.assertEqual([], tt.find_conflicts()) |
1446 | 139 | preview = tt.get_preview_tree() | 139 | preview = tt.get_preview_tree() |
1448 | 140 | self.assertEqual(wt.get_root_id(), preview.get_root_id()) | 140 | self.assertEqual(wt.path2id(''), preview.path2id('')) |
1449 | 141 | 141 | ||
1450 | 142 | def test_merge_unrelated_retains_root(self): | 142 | def test_merge_unrelated_retains_root(self): |
1451 | 143 | wt = self.make_branch_and_tree('tree') | 143 | wt = self.make_branch_and_tree('tree') |
1452 | @@ -149,7 +149,7 @@ | |||
1453 | 149 | with transform.TransformPreview(wt) as merger.tt: | 149 | with transform.TransformPreview(wt) as merger.tt: |
1454 | 150 | merger._compute_transform() | 150 | merger._compute_transform() |
1455 | 151 | new_root_id = merger.tt.final_file_id(merger.tt.root) | 151 | new_root_id = merger.tt.final_file_id(merger.tt.root) |
1457 | 152 | self.assertEqual(wt.get_root_id(), new_root_id) | 152 | self.assertEqual(wt.path2id(''), new_root_id) |
1458 | 153 | 153 | ||
1459 | 154 | def test_create_rename(self): | 154 | def test_create_rename(self): |
1460 | 155 | """Rename an inventory entry while creating the file""" | 155 | """Rename an inventory entry while creating the file""" |
1461 | @@ -511,7 +511,7 @@ | |||
1462 | 511 | self.build_tree(['a']) | 511 | self.build_tree(['a']) |
1463 | 512 | tree.add('a') | 512 | tree.add('a') |
1464 | 513 | first_rev = tree.commit("added a") | 513 | first_rev = tree.commit("added a") |
1466 | 514 | old_root_id = tree.get_root_id() | 514 | old_root_id = tree.path2id('') |
1467 | 515 | merger = _mod_merge.Merger.from_revision_ids(tree, | 515 | merger = _mod_merge.Merger.from_revision_ids(tree, |
1468 | 516 | _mod_revision.NULL_REVISION, | 516 | _mod_revision.NULL_REVISION, |
1469 | 517 | first_rev) | 517 | first_rev) |
1470 | 518 | 518 | ||
1471 | === modified file 'breezy/tests/test_revert.py' | |||
1472 | --- breezy/tests/test_revert.py 2019-06-22 10:30:21 +0000 | |||
1473 | +++ breezy/tests/test_revert.py 2019-07-25 23:25:31 +0000 | |||
1474 | @@ -159,6 +159,6 @@ | |||
1475 | 159 | tree.add(['file1']) | 159 | tree.add(['file1']) |
1476 | 160 | tree.commit('first') | 160 | tree.commit('first') |
1477 | 161 | tree.set_root_id(b'temp-root-id') | 161 | tree.set_root_id(b'temp-root-id') |
1479 | 162 | self.assertEqual(b'temp-root-id', tree.get_root_id()) | 162 | self.assertEqual(b'temp-root-id', tree.path2id('')) |
1480 | 163 | tree.revert() | 163 | tree.revert() |
1482 | 164 | self.assertEqual(b'initial-root-id', tree.get_root_id()) | 164 | self.assertEqual(b'initial-root-id', tree.path2id('')) |
1483 | 165 | 165 | ||
1484 | === modified file 'breezy/tests/test_revisiontree.py' | |||
1485 | --- breezy/tests/test_revisiontree.py 2018-11-16 18:33:17 +0000 | |||
1486 | +++ breezy/tests/test_revisiontree.py 2019-07-25 23:25:31 +0000 | |||
1487 | @@ -58,7 +58,7 @@ | |||
1488 | 58 | def test_empty_no_root(self): | 58 | def test_empty_no_root(self): |
1489 | 59 | null_tree = self.t.branch.repository.revision_tree( | 59 | null_tree = self.t.branch.repository.revision_tree( |
1490 | 60 | revision.NULL_REVISION) | 60 | revision.NULL_REVISION) |
1492 | 61 | self.assertIs(None, null_tree.get_root_id()) | 61 | self.assertIs(None, null_tree.path2id('')) |
1493 | 62 | 62 | ||
1494 | 63 | def test_get_file_revision_root(self): | 63 | def test_get_file_revision_root(self): |
1495 | 64 | self.assertEqual(self.rev_id, self.rev_tree.get_file_revision(u'')) | 64 | self.assertEqual(self.rev_id, self.rev_tree.get_file_revision(u'')) |
1496 | 65 | 65 | ||
1497 | === modified file 'breezy/tests/test_shelf_ui.py' | |||
1498 | --- breezy/tests/test_shelf_ui.py 2018-11-12 01:41:38 +0000 | |||
1499 | +++ breezy/tests/test_shelf_ui.py 2019-07-25 23:25:31 +0000 | |||
1500 | @@ -302,14 +302,14 @@ | |||
1501 | 302 | def test_shelve_old_root_preserved(self): | 302 | def test_shelve_old_root_preserved(self): |
1502 | 303 | tree1 = self.make_branch_and_tree('tree1') | 303 | tree1 = self.make_branch_and_tree('tree1') |
1503 | 304 | tree1.commit('add root') | 304 | tree1.commit('add root') |
1505 | 305 | tree1_root_id = tree1.get_root_id() | 305 | tree1_root_id = tree1.path2id('') |
1506 | 306 | tree2 = self.make_branch_and_tree('tree2') | 306 | tree2 = self.make_branch_and_tree('tree2') |
1507 | 307 | rev2 = tree2.commit('add root') | 307 | rev2 = tree2.commit('add root') |
1509 | 308 | self.assertNotEqual(tree1_root_id, tree2.get_root_id()) | 308 | self.assertNotEqual(tree1_root_id, tree2.path2id('')) |
1510 | 309 | tree1.merge_from_branch(tree2.branch, | 309 | tree1.merge_from_branch(tree2.branch, |
1511 | 310 | from_revision=revision.NULL_REVISION) | 310 | from_revision=revision.NULL_REVISION) |
1512 | 311 | tree1.commit('merging in tree2') | 311 | tree1.commit('merging in tree2') |
1514 | 312 | self.assertEqual(tree1_root_id, tree1.get_root_id()) | 312 | self.assertEqual(tree1_root_id, tree1.path2id('')) |
1515 | 313 | # This is essentially assertNotRaises(InconsistentDelta) | 313 | # This is essentially assertNotRaises(InconsistentDelta) |
1516 | 314 | # With testtools 0.9.9, it can be rewritten as: | 314 | # With testtools 0.9.9, it can be rewritten as: |
1517 | 315 | # with ExpectedException(AssertionError, | 315 | # with ExpectedException(AssertionError, |
1518 | 316 | 316 | ||
1519 | === modified file 'breezy/tests/test_smart_add.py' | |||
1520 | --- breezy/tests/test_smart_add.py 2018-11-12 01:41:38 +0000 | |||
1521 | +++ breezy/tests/test_smart_add.py 2019-07-25 23:25:31 +0000 | |||
1522 | @@ -92,7 +92,7 @@ | |||
1523 | 92 | 92 | ||
1524 | 93 | self.build_tree(['new/a', 'new/b', 'new/c', | 93 | self.build_tree(['new/a', 'new/b', 'new/c', |
1525 | 94 | 'new/subdir/', 'new/subdir/b', 'new/subdir/d']) | 94 | 'new/subdir/', 'new/subdir/b', 'new/subdir/d']) |
1527 | 95 | new_tree.set_root_id(self.base_tree.get_root_id()) | 95 | new_tree.set_root_id(self.base_tree.path2id('')) |
1528 | 96 | self.add_helper(self.base_tree, 'dir', new_tree, ['new']) | 96 | self.add_helper(self.base_tree, 'dir', new_tree, ['new']) |
1529 | 97 | 97 | ||
1530 | 98 | # We know 'a' and 'b' exist in the root, and they are being added | 98 | # We know 'a' and 'b' exist in the root, and they are being added |
1531 | 99 | 99 | ||
1532 | === modified file 'breezy/tests/test_subsume.py' | |||
1533 | --- breezy/tests/test_subsume.py 2018-11-16 18:33:17 +0000 | |||
1534 | +++ breezy/tests/test_subsume.py 2019-07-25 23:25:31 +0000 | |||
1535 | @@ -36,7 +36,7 @@ | |||
1536 | 36 | sub_tree = self.make_branch_and_tree('tree/subtree', | 36 | sub_tree = self.make_branch_and_tree('tree/subtree', |
1537 | 37 | format='development-subtree') | 37 | format='development-subtree') |
1538 | 38 | if same_root is True: | 38 | if same_root is True: |
1540 | 39 | sub_tree.set_root_id(base_tree.get_root_id()) | 39 | sub_tree.set_root_id(base_tree.path2id('')) |
1541 | 40 | sub_tree.add('file2', b'file2-id') | 40 | sub_tree.add('file2', b'file2-id') |
1542 | 41 | sub_tree.commit('first commit', rev_id=b'subtree-1') | 41 | sub_tree.commit('first commit', rev_id=b'subtree-1') |
1543 | 42 | return base_tree, sub_tree | 42 | return base_tree, sub_tree |
1544 | @@ -59,8 +59,8 @@ | |||
1545 | 59 | 59 | ||
1546 | 60 | def test_subsume_tree(self): | 60 | def test_subsume_tree(self): |
1547 | 61 | base_tree, sub_tree = self.make_trees() | 61 | base_tree, sub_tree = self.make_trees() |
1550 | 62 | self.assertNotEqual(base_tree.get_root_id(), sub_tree.get_root_id()) | 62 | self.assertNotEqual(base_tree.path2id(''), sub_tree.path2id('')) |
1551 | 63 | sub_root_id = sub_tree.get_root_id() | 63 | sub_root_id = sub_tree.path2id('') |
1552 | 64 | # this test checks the subdir is removed, so it needs to know the | 64 | # this test checks the subdir is removed, so it needs to know the |
1553 | 65 | # control directory; that changes rarely so just hardcode (and check) | 65 | # control directory; that changes rarely so just hardcode (and check) |
1554 | 66 | # it is correct. | 66 | # it is correct. |
1555 | @@ -94,7 +94,7 @@ | |||
1556 | 94 | 94 | ||
1557 | 95 | def test_subsume_failure(self): | 95 | def test_subsume_failure(self): |
1558 | 96 | base_tree, sub_tree = self.make_trees() | 96 | base_tree, sub_tree = self.make_trees() |
1560 | 97 | if base_tree.get_root_id() == sub_tree.get_root_id(): | 97 | if base_tree.path2id('') == sub_tree.path2id(''): |
1561 | 98 | raise tests.TestSkipped('This test requires unique roots') | 98 | raise tests.TestSkipped('This test requires unique roots') |
1562 | 99 | self.assertRaises(errors.BadSubsumeSource, base_tree.subsume, | 99 | self.assertRaises(errors.BadSubsumeSource, base_tree.subsume, |
1563 | 100 | base_tree) | 100 | base_tree) |
1564 | 101 | 101 | ||
1565 | === modified file 'breezy/tests/test_switch.py' | |||
1566 | --- breezy/tests/test_switch.py 2018-11-12 01:41:38 +0000 | |||
1567 | +++ breezy/tests/test_switch.py 2019-07-25 23:25:31 +0000 | |||
1568 | @@ -179,7 +179,7 @@ | |||
1569 | 179 | checkout = tree.branch.create_checkout('checkout', | 179 | checkout = tree.branch.create_checkout('checkout', |
1570 | 180 | lightweight=self.lightweight) | 180 | lightweight=self.lightweight) |
1571 | 181 | switch.switch(checkout.controldir, tree2.branch) | 181 | switch.switch(checkout.controldir, tree2.branch) |
1573 | 182 | self.assertEqual(b'custom-root-id', tree2.get_root_id()) | 182 | self.assertEqual(b'custom-root-id', tree2.path2id('')) |
1574 | 183 | 183 | ||
1575 | 184 | def test_switch_configurable_file_merger(self): | 184 | def test_switch_configurable_file_merger(self): |
1576 | 185 | class DummyMerger(_mod_merge.ConfigurableFileMerger): | 185 | class DummyMerger(_mod_merge.ConfigurableFileMerger): |
1577 | 186 | 186 | ||
1578 | === modified file 'breezy/tests/test_transform.py' | |||
1579 | --- breezy/tests/test_transform.py 2019-06-22 12:07:42 +0000 | |||
1580 | +++ breezy/tests/test_transform.py 2019-07-25 23:25:31 +0000 | |||
1581 | @@ -147,7 +147,7 @@ | |||
1582 | 147 | self.assertEqual(imaginary_id, imaginary_id2) | 147 | self.assertEqual(imaginary_id, imaginary_id2) |
1583 | 148 | self.assertEqual(root, transform.get_tree_parent(imaginary_id)) | 148 | self.assertEqual(root, transform.get_tree_parent(imaginary_id)) |
1584 | 149 | self.assertEqual('directory', transform.final_kind(root)) | 149 | self.assertEqual('directory', transform.final_kind(root)) |
1586 | 150 | self.assertEqual(self.wt.get_root_id(), transform.final_file_id(root)) | 150 | self.assertEqual(self.wt.path2id(''), transform.final_file_id(root)) |
1587 | 151 | trans_id = transform.create_path('name', root) | 151 | trans_id = transform.create_path('name', root) |
1588 | 152 | self.assertIs(transform.final_file_id(trans_id), None) | 152 | self.assertIs(transform.final_file_id(trans_id), None) |
1589 | 153 | self.assertIs(None, transform.final_kind(trans_id)) | 153 | self.assertIs(None, transform.final_kind(trans_id)) |
1590 | @@ -270,17 +270,17 @@ | |||
1591 | 270 | 270 | ||
1592 | 271 | def test_change_root_id(self): | 271 | def test_change_root_id(self): |
1593 | 272 | transform, root = self.get_transform() | 272 | transform, root = self.get_transform() |
1595 | 273 | self.assertNotEqual(b'new-root-id', self.wt.get_root_id()) | 273 | self.assertNotEqual(b'new-root-id', self.wt.path2id('')) |
1596 | 274 | transform.new_directory('', ROOT_PARENT, b'new-root-id') | 274 | transform.new_directory('', ROOT_PARENT, b'new-root-id') |
1597 | 275 | transform.delete_contents(root) | 275 | transform.delete_contents(root) |
1598 | 276 | transform.unversion_file(root) | 276 | transform.unversion_file(root) |
1599 | 277 | transform.fixup_new_roots() | 277 | transform.fixup_new_roots() |
1600 | 278 | transform.apply() | 278 | transform.apply() |
1602 | 279 | self.assertEqual(b'new-root-id', self.wt.get_root_id()) | 279 | self.assertEqual(b'new-root-id', self.wt.path2id('')) |
1603 | 280 | 280 | ||
1604 | 281 | def test_change_root_id_add_files(self): | 281 | def test_change_root_id_add_files(self): |
1605 | 282 | transform, root = self.get_transform() | 282 | transform, root = self.get_transform() |
1607 | 283 | self.assertNotEqual(b'new-root-id', self.wt.get_root_id()) | 283 | self.assertNotEqual(b'new-root-id', self.wt.path2id('')) |
1608 | 284 | new_trans_id = transform.new_directory('', ROOT_PARENT, b'new-root-id') | 284 | new_trans_id = transform.new_directory('', ROOT_PARENT, b'new-root-id') |
1609 | 285 | transform.new_file('file', new_trans_id, [b'new-contents\n'], | 285 | transform.new_file('file', new_trans_id, [b'new-contents\n'], |
1610 | 286 | b'new-file-id') | 286 | b'new-file-id') |
1611 | @@ -288,7 +288,7 @@ | |||
1612 | 288 | transform.unversion_file(root) | 288 | transform.unversion_file(root) |
1613 | 289 | transform.fixup_new_roots() | 289 | transform.fixup_new_roots() |
1614 | 290 | transform.apply() | 290 | transform.apply() |
1616 | 291 | self.assertEqual(b'new-root-id', self.wt.get_root_id()) | 291 | self.assertEqual(b'new-root-id', self.wt.path2id('')) |
1617 | 292 | self.assertEqual(b'new-file-id', self.wt.path2id('file')) | 292 | self.assertEqual(b'new-file-id', self.wt.path2id('file')) |
1618 | 293 | self.assertFileEqual(b'new-contents\n', self.wt.abspath('file')) | 293 | self.assertFileEqual(b'new-contents\n', self.wt.abspath('file')) |
1619 | 294 | 294 | ||
1620 | @@ -321,13 +321,13 @@ | |||
1621 | 321 | 321 | ||
1622 | 322 | def test_remove_root_fixup(self): | 322 | def test_remove_root_fixup(self): |
1623 | 323 | transform, root = self.get_transform() | 323 | transform, root = self.get_transform() |
1625 | 324 | old_root_id = self.wt.get_root_id() | 324 | old_root_id = self.wt.path2id('') |
1626 | 325 | self.assertNotEqual(b'new-root-id', old_root_id) | 325 | self.assertNotEqual(b'new-root-id', old_root_id) |
1627 | 326 | transform.delete_contents(root) | 326 | transform.delete_contents(root) |
1628 | 327 | transform.unversion_file(root) | 327 | transform.unversion_file(root) |
1629 | 328 | transform.fixup_new_roots() | 328 | transform.fixup_new_roots() |
1630 | 329 | transform.apply() | 329 | transform.apply() |
1632 | 330 | self.assertEqual(old_root_id, self.wt.get_root_id()) | 330 | self.assertEqual(old_root_id, self.wt.path2id('')) |
1633 | 331 | 331 | ||
1634 | 332 | transform, root = self.get_transform() | 332 | transform, root = self.get_transform() |
1635 | 333 | transform.new_directory('', ROOT_PARENT, b'new-root-id') | 333 | transform.new_directory('', ROOT_PARENT, b'new-root-id') |
1636 | @@ -358,7 +358,7 @@ | |||
1637 | 358 | old_root_id = transform.tree_file_id(root) | 358 | old_root_id = transform.tree_file_id(root) |
1638 | 359 | transform.unversion_file(root) | 359 | transform.unversion_file(root) |
1639 | 360 | transform.apply() | 360 | transform.apply() |
1641 | 361 | self.assertEqual(old_root_id, self.wt.get_root_id()) | 361 | self.assertEqual(old_root_id, self.wt.path2id('')) |
1642 | 362 | 362 | ||
1643 | 363 | def test_hardlink(self): | 363 | def test_hardlink(self): |
1644 | 364 | self.requireFeature(HardlinkFeature) | 364 | self.requireFeature(HardlinkFeature) |
1645 | @@ -1741,7 +1741,7 @@ | |||
1646 | 1741 | tree.add('foo', b'foo-id') | 1741 | tree.add('foo', b'foo-id') |
1647 | 1742 | with TransformPreview(tree) as tt: | 1742 | with TransformPreview(tree) as tt: |
1648 | 1743 | tt.unversion_file(tt.root) | 1743 | tt.unversion_file(tt.root) |
1650 | 1744 | tt.version_file(tree.get_root_id(), tt.root) | 1744 | tt.version_file(tree.path2id(''), tt.root) |
1651 | 1745 | tt.trans_id_tree_path('foo') | 1745 | tt.trans_id_tree_path('foo') |
1652 | 1746 | self.assertEqual([], tt._inventory_altered()) | 1746 | self.assertEqual([], tt._inventory_altered()) |
1653 | 1747 | 1747 | ||
1654 | @@ -2872,7 +2872,7 @@ | |||
1655 | 2872 | 2872 | ||
1656 | 2873 | def test_iter_changes(self): | 2873 | def test_iter_changes(self): |
1657 | 2874 | revision_tree, preview_tree = self.get_tree_and_preview_tree() | 2874 | revision_tree, preview_tree = self.get_tree_and_preview_tree() |
1659 | 2875 | root = revision_tree.get_root_id() | 2875 | root = revision_tree.path2id('') |
1660 | 2876 | self.assertEqual([(b'a-id', ('a', 'a'), True, (True, True), | 2876 | self.assertEqual([(b'a-id', ('a', 'a'), True, (True, True), |
1661 | 2877 | (root, root), ('a', 'a'), ('file', 'file'), | 2877 | (root, root), ('a', 'a'), ('file', 'file'), |
1662 | 2878 | (False, False))], | 2878 | (False, False))], |
1663 | @@ -2981,7 +2981,7 @@ | |||
1664 | 2981 | preview.unversion_file(c_trans_id) | 2981 | preview.unversion_file(c_trans_id) |
1665 | 2982 | preview.version_file(b'c-id', c_trans_id) | 2982 | preview.version_file(b'c-id', c_trans_id) |
1666 | 2983 | preview_tree = preview.get_preview_tree() | 2983 | preview_tree = preview.get_preview_tree() |
1668 | 2984 | self.assertEqual({b'a-id', b'c-id', tree.get_root_id()}, | 2984 | self.assertEqual({b'a-id', b'c-id', tree.path2id('')}, |
1669 | 2985 | preview_tree.all_file_ids()) | 2985 | preview_tree.all_file_ids()) |
1670 | 2986 | 2986 | ||
1671 | 2987 | def test_path2id_deleted_unchanged(self): | 2987 | def test_path2id_deleted_unchanged(self): |
1672 | @@ -3817,7 +3817,7 @@ | |||
1673 | 3817 | transform, root = self.get_transform() | 3817 | transform, root = self.get_transform() |
1674 | 3818 | old_root_id = transform.tree_file_id(root) | 3818 | old_root_id = transform.tree_file_id(root) |
1675 | 3819 | transform.apply() | 3819 | transform.apply() |
1677 | 3820 | self.assertEqual(old_root_id, self.wt.get_root_id()) | 3820 | self.assertEqual(old_root_id, self.wt.path2id('')) |
1678 | 3821 | self.assertEqual([(self.wt, transform)], calls) | 3821 | self.assertEqual([(self.wt, transform)], calls) |
1679 | 3822 | 3822 | ||
1680 | 3823 | def test_post_commit_hooks(self): | 3823 | def test_post_commit_hooks(self): |
1681 | @@ -3830,7 +3830,7 @@ | |||
1682 | 3830 | transform, root = self.get_transform() | 3830 | transform, root = self.get_transform() |
1683 | 3831 | old_root_id = transform.tree_file_id(root) | 3831 | old_root_id = transform.tree_file_id(root) |
1684 | 3832 | transform.apply() | 3832 | transform.apply() |
1686 | 3833 | self.assertEqual(old_root_id, self.wt.get_root_id()) | 3833 | self.assertEqual(old_root_id, self.wt.path2id('')) |
1687 | 3834 | self.assertEqual([(self.wt, transform)], calls) | 3834 | self.assertEqual([(self.wt, transform)], calls) |
1688 | 3835 | 3835 | ||
1689 | 3836 | 3836 | ||
1690 | 3837 | 3837 | ||
1691 | === modified file 'breezy/tests/test_workingtree_4.py' | |||
1692 | --- breezy/tests/test_workingtree_4.py 2019-06-16 23:54:50 +0000 | |||
1693 | +++ breezy/tests/test_workingtree_4.py 2019-07-25 23:25:31 +0000 | |||
1694 | @@ -538,22 +538,19 @@ | |||
1695 | 538 | format=format_name) | 538 | format=format_name) |
1696 | 539 | tree2 = self.make_branch_and_tree('tree2', | 539 | tree2 = self.make_branch_and_tree('tree2', |
1697 | 540 | format=format_name) | 540 | format=format_name) |
1699 | 541 | self.assertNotEqual(tree1.get_root_id(), tree2.get_root_id()) | 541 | self.assertNotEqual(tree1.path2id(''), tree2.path2id('')) |
1700 | 542 | # when you branch, it inherits the same root id | 542 | # when you branch, it inherits the same root id |
1701 | 543 | tree1.commit('first post') | 543 | tree1.commit('first post') |
1702 | 544 | tree3 = tree1.controldir.sprout('tree3').open_workingtree() | 544 | tree3 = tree1.controldir.sprout('tree3').open_workingtree() |
1704 | 545 | self.assertEqual(tree3.get_root_id(), tree1.get_root_id()) | 545 | self.assertEqual(tree3.path2id(''), tree1.path2id('')) |
1705 | 546 | 546 | ||
1706 | 547 | def test_set_root_id(self): | 547 | def test_set_root_id(self): |
1707 | 548 | # similar to some code that fails in the dirstate-plus-subtree branch | 548 | # similar to some code that fails in the dirstate-plus-subtree branch |
1708 | 549 | # -- setting the root id while adding a parent seems to scramble the | 549 | # -- setting the root id while adding a parent seems to scramble the |
1709 | 550 | # dirstate invariants. -- mbp 20070303 | 550 | # dirstate invariants. -- mbp 20070303 |
1710 | 551 | def validate(): | 551 | def validate(): |
1713 | 552 | wt.lock_read() | 552 | with wt.lock_read(): |
1712 | 553 | try: | ||
1714 | 554 | wt.current_dirstate()._validate() | 553 | wt.current_dirstate()._validate() |
1715 | 555 | finally: | ||
1716 | 556 | wt.unlock() | ||
1717 | 557 | wt = self.make_workingtree('tree') | 554 | wt = self.make_workingtree('tree') |
1718 | 558 | wt.set_root_id(b'TREE-ROOTID') | 555 | wt.set_root_id(b'TREE-ROOTID') |
1719 | 559 | validate() | 556 | validate() |
1720 | @@ -567,10 +564,10 @@ | |||
1721 | 567 | 564 | ||
1722 | 568 | def test_default_root_id(self): | 565 | def test_default_root_id(self): |
1723 | 569 | tree = self.make_branch_and_tree('tag', format='dirstate-tags') | 566 | tree = self.make_branch_and_tree('tag', format='dirstate-tags') |
1725 | 570 | self.assertEqual(inventory.ROOT_ID, tree.get_root_id()) | 567 | self.assertEqual(inventory.ROOT_ID, tree.path2id('')) |
1726 | 571 | tree = self.make_branch_and_tree('subtree', | 568 | tree = self.make_branch_and_tree('subtree', |
1727 | 572 | format='development-subtree') | 569 | format='development-subtree') |
1729 | 573 | self.assertNotEqual(inventory.ROOT_ID, tree.get_root_id()) | 570 | self.assertNotEqual(inventory.ROOT_ID, tree.path2id('')) |
1730 | 574 | 571 | ||
1731 | 575 | def test_non_subtree_with_nested_trees(self): | 572 | def test_non_subtree_with_nested_trees(self): |
1732 | 576 | # prior to dirstate, st/diff/commit ignored nested trees. | 573 | # prior to dirstate, st/diff/commit ignored nested trees. |
1733 | 577 | 574 | ||
1734 | === modified file 'breezy/transform.py' | |||
1735 | --- breezy/transform.py 2019-06-22 12:07:42 +0000 | |||
1736 | +++ breezy/transform.py 2019-07-25 23:25:31 +0000 | |||
1737 | @@ -455,7 +455,7 @@ | |||
1738 | 455 | return None | 455 | return None |
1739 | 456 | # the file is old; the old id is still valid | 456 | # the file is old; the old id is still valid |
1740 | 457 | if self._new_root == trans_id: | 457 | if self._new_root == trans_id: |
1742 | 458 | return self._tree.get_root_id() | 458 | return self._tree.path2id('') |
1743 | 459 | return self._tree.path2id(path) | 459 | return self._tree.path2id(path) |
1744 | 460 | 460 | ||
1745 | 461 | def final_file_id(self, trans_id): | 461 | def final_file_id(self, trans_id): |
1746 | @@ -1823,7 +1823,7 @@ | |||
1747 | 1823 | child_pb.update(gettext('removing file'), | 1823 | child_pb.update(gettext('removing file'), |
1748 | 1824 | num, total_entries) | 1824 | num, total_entries) |
1749 | 1825 | if trans_id == self._new_root: | 1825 | if trans_id == self._new_root: |
1751 | 1826 | file_id = self._tree.get_root_id() | 1826 | file_id = self._tree.path2id('') |
1752 | 1827 | else: | 1827 | else: |
1753 | 1828 | file_id = self.tree_file_id(trans_id) | 1828 | file_id = self.tree_file_id(trans_id) |
1754 | 1829 | # File-id isn't really being deleted, just moved | 1829 | # File-id isn't really being deleted, just moved |
1755 | @@ -2102,9 +2102,6 @@ | |||
1756 | 2102 | """This Tree does not use inventory as its backing data.""" | 2102 | """This Tree does not use inventory as its backing data.""" |
1757 | 2103 | raise NotImplementedError(_PreviewTree.root_inventory) | 2103 | raise NotImplementedError(_PreviewTree.root_inventory) |
1758 | 2104 | 2104 | ||
1759 | 2105 | def get_root_id(self): | ||
1760 | 2106 | return self._transform.final_file_id(self._transform.root) | ||
1761 | 2107 | |||
1762 | 2108 | def all_file_ids(self): | 2105 | def all_file_ids(self): |
1763 | 2109 | tree_ids = set(self._transform._tree.all_file_ids()) | 2106 | tree_ids = set(self._transform._tree.all_file_ids()) |
1764 | 2110 | tree_ids.difference_update(self._transform.tree_file_id(t) | 2107 | tree_ids.difference_update(self._transform.tree_file_id(t) |
1765 | @@ -2288,7 +2285,7 @@ | |||
1766 | 2288 | else: | 2285 | else: |
1767 | 2289 | if from_dir is None and include_root is True: | 2286 | if from_dir is None and include_root is True: |
1768 | 2290 | root_entry = inventory.make_entry( | 2287 | root_entry = inventory.make_entry( |
1770 | 2291 | 'directory', '', ROOT_PARENT, self.get_root_id()) | 2288 | 'directory', '', ROOT_PARENT, self.path2id('')) |
1771 | 2292 | yield '', 'V', 'directory', root_entry | 2289 | yield '', 'V', 'directory', root_entry |
1772 | 2293 | entries = self._iter_entries_for_dir(from_dir or '') | 2290 | entries = self._iter_entries_for_dir(from_dir or '') |
1773 | 2294 | for path, entry in entries: | 2291 | for path, entry in entries: |
1774 | @@ -2620,7 +2617,7 @@ | |||
1775 | 2620 | file_trans_id = {} | 2617 | file_trans_id = {} |
1776 | 2621 | top_pb = ui.ui_factory.nested_progress_bar() | 2618 | top_pb = ui.ui_factory.nested_progress_bar() |
1777 | 2622 | pp = ProgressPhase("Build phase", 2, top_pb) | 2619 | pp = ProgressPhase("Build phase", 2, top_pb) |
1779 | 2623 | if tree.get_root_id() is not None: | 2620 | if tree.path2id('') is not None: |
1780 | 2624 | # This is kind of a hack: we should be altering the root | 2621 | # This is kind of a hack: we should be altering the root |
1781 | 2625 | # as part of the regular tree shape diff logic. | 2622 | # as part of the regular tree shape diff logic. |
1782 | 2626 | # The conditional test here is to avoid doing an | 2623 | # The conditional test here is to avoid doing an |
1783 | @@ -2628,14 +2625,14 @@ | |||
1784 | 2628 | # is set within the tree, nor setting the root and thus | 2625 | # is set within the tree, nor setting the root and thus |
1785 | 2629 | # marking the tree as dirty, because we use two different | 2626 | # marking the tree as dirty, because we use two different |
1786 | 2630 | # idioms here: tree interfaces and inventory interfaces. | 2627 | # idioms here: tree interfaces and inventory interfaces. |
1789 | 2631 | if wt.get_root_id() != tree.get_root_id(): | 2628 | if wt.path2id('') != tree.path2id(''): |
1790 | 2632 | wt.set_root_id(tree.get_root_id()) | 2629 | wt.set_root_id(tree.path2id('')) |
1791 | 2633 | wt.flush() | 2630 | wt.flush() |
1792 | 2634 | tt = wt.get_transform() | 2631 | tt = wt.get_transform() |
1793 | 2635 | divert = set() | 2632 | divert = set() |
1794 | 2636 | try: | 2633 | try: |
1795 | 2637 | pp.next_phase() | 2634 | pp.next_phase() |
1797 | 2638 | file_trans_id[wt.get_root_id()] = tt.trans_id_tree_path('') | 2635 | file_trans_id[wt.path2id('')] = tt.trans_id_tree_path('') |
1798 | 2639 | with ui.ui_factory.nested_progress_bar() as pb: | 2636 | with ui.ui_factory.nested_progress_bar() as pb: |
1799 | 2640 | deferred_contents = [] | 2637 | deferred_contents = [] |
1800 | 2641 | num = 0 | 2638 | num = 0 |
1801 | 2642 | 2639 | ||
1802 | === modified file 'breezy/tree.py' | |||
1803 | --- breezy/tree.py 2019-06-29 12:29:45 +0000 | |||
1804 | +++ breezy/tree.py 2019-07-25 23:25:31 +0000 | |||
1805 | @@ -529,10 +529,6 @@ | |||
1806 | 529 | """ | 529 | """ |
1807 | 530 | raise NotImplementedError(self.get_symlink_target) | 530 | raise NotImplementedError(self.get_symlink_target) |
1808 | 531 | 531 | ||
1809 | 532 | def get_root_id(self): | ||
1810 | 533 | """Return the file_id for the root of this tree.""" | ||
1811 | 534 | raise NotImplementedError(self.get_root_id) | ||
1812 | 535 | |||
1813 | 536 | def annotate_iter(self, path, | 532 | def annotate_iter(self, path, |
1814 | 537 | default_revision=_mod_revision.CURRENT_REVISION): | 533 | default_revision=_mod_revision.CURRENT_REVISION): |
1815 | 538 | """Return an iterator of revision_id, line tuples. | 534 | """Return an iterator of revision_id, line tuples. |
1816 | 539 | 535 | ||
1817 | === modified file 'breezy/workingtree.py' | |||
1818 | --- breezy/workingtree.py 2019-06-18 11:21:15 +0000 | |||
1819 | +++ breezy/workingtree.py 2019-07-25 23:25:31 +0000 | |||
1820 | @@ -398,10 +398,6 @@ | |||
1821 | 398 | parents.append(revision_id) | 398 | parents.append(revision_id) |
1822 | 399 | return parents | 399 | return parents |
1823 | 400 | 400 | ||
1824 | 401 | def get_root_id(self): | ||
1825 | 402 | """Return the id of this trees root""" | ||
1826 | 403 | raise NotImplementedError(self.get_root_id) | ||
1827 | 404 | |||
1828 | 405 | def clone(self, to_controldir, revision_id=None): | 401 | def clone(self, to_controldir, revision_id=None): |
1829 | 406 | """Duplicate this working tree into to_bzr, including all state. | 402 | """Duplicate this working tree into to_bzr, including all state. |
1830 | 407 | 403 | ||
1831 | @@ -424,7 +420,7 @@ | |||
1832 | 424 | def copy_content_into(self, tree, revision_id=None): | 420 | def copy_content_into(self, tree, revision_id=None): |
1833 | 425 | """Copy the current content and user files of this tree into tree.""" | 421 | """Copy the current content and user files of this tree into tree.""" |
1834 | 426 | with self.lock_read(): | 422 | with self.lock_read(): |
1836 | 427 | tree.set_root_id(self.get_root_id()) | 423 | tree.set_root_id(self.path2id('')) |
1837 | 428 | if revision_id is None: | 424 | if revision_id is None: |
1838 | 429 | merge.transform_tree(tree, self) | 425 | merge.transform_tree(tree, self) |
1839 | 430 | else: | 426 | else: |
1840 | @@ -841,8 +837,8 @@ | |||
1841 | 841 | this_tree=self, | 837 | this_tree=self, |
1842 | 842 | change_reporter=change_reporter, | 838 | change_reporter=change_reporter, |
1843 | 843 | show_base=show_base) | 839 | show_base=show_base) |
1846 | 844 | basis_root_id = basis_tree.get_root_id() | 840 | basis_root_id = basis_tree.path2id('') |
1847 | 845 | new_root_id = new_basis_tree.get_root_id() | 841 | new_root_id = new_basis_tree.path2id('') |
1848 | 846 | if new_root_id is not None and basis_root_id != new_root_id: | 842 | if new_root_id is not None and basis_root_id != new_root_id: |
1849 | 847 | self.set_root_id(new_root_id) | 843 | self.set_root_id(new_root_id) |
1850 | 848 | # TODO - dedup parents list with things merged by pull ? | 844 | # TODO - dedup parents list with things merged by pull ? |
1851 | @@ -1170,11 +1166,11 @@ | |||
1852 | 1170 | # the working tree is up to date with the branch | 1166 | # the working tree is up to date with the branch |
1853 | 1171 | # we can merge the specified revision from master | 1167 | # we can merge the specified revision from master |
1854 | 1172 | to_tree = self.branch.repository.revision_tree(revision) | 1168 | to_tree = self.branch.repository.revision_tree(revision) |
1856 | 1173 | to_root_id = to_tree.get_root_id() | 1169 | to_root_id = to_tree.path2id('') |
1857 | 1174 | 1170 | ||
1858 | 1175 | basis = self.basis_tree() | 1171 | basis = self.basis_tree() |
1859 | 1176 | with basis.lock_read(): | 1172 | with basis.lock_read(): |
1861 | 1177 | if (basis.get_root_id() is None or basis.get_root_id() != to_root_id): | 1173 | if (basis.path2id('') is None or basis.path2id('') != to_root_id): |
1862 | 1178 | self.set_root_id(to_root_id) | 1174 | self.set_root_id(to_root_id) |
1863 | 1179 | self.flush() | 1175 | self.flush() |
1864 | 1180 | 1176 | ||
1865 | 1181 | 1177 | ||
1866 | === modified file 'doc/en/release-notes/brz-3.1.txt' | |||
1867 | --- doc/en/release-notes/brz-3.1.txt 2019-07-07 19:36:13 +0000 | |||
1868 | +++ doc/en/release-notes/brz-3.1.txt 2019-07-25 23:25:31 +0000 | |||
1869 | @@ -99,6 +99,9 @@ | |||
1870 | 99 | * New ``Tree.get_transform`` method for getting a ``TreeTransform`` | 99 | * New ``Tree.get_transform`` method for getting a ``TreeTransform`` |
1871 | 100 | object. (Jelmer Vernooij) | 100 | object. (Jelmer Vernooij) |
1872 | 101 | 101 | ||
1873 | 102 | * The ``Tree.get_root_id`` method has been removed. Use | ||
1874 | 103 | ``Tree.path2id('')`` instead. (Jelmer Vernooij) | ||
1875 | 104 | |||
1876 | 102 | * ``Repository.find_branches`` now returns an iterator rather than a | 105 | * ``Repository.find_branches`` now returns an iterator rather than a |
1877 | 103 | list. (Jelmer Vernooij, #413970) | 106 | list. (Jelmer Vernooij, #413970) |
1878 | 104 | 107 |
Fast eyeball of the diff, everything looks sane.