Merge lp:~jelmer/brz/get-root-id into lp:brz

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
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_id()/path2id('')/.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Fast eyeball of the diff, everything looks sane.

review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/bzr/bundle/bundle_data.py'
--- breezy/bzr/bundle/bundle_data.py 2019-06-30 10:50:40 +0000
+++ breezy/bzr/bundle/bundle_data.py 2019-07-25 23:25:31 +0000
@@ -579,9 +579,6 @@
579 return None579 return None
580 return new_path580 return new_path
581581
582 def get_root_id(self):
583 return self.path2id('')
584
585 def path2id(self, path):582 def path2id(self, path):
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."""
587 file_id = self._new_id.get(path)584 file_id = self._new_id.get(path)
@@ -629,7 +626,7 @@
629 file_id = self.path2id(path)626 file_id = self.path2id(path)
630 base_id = self.old_contents_id(file_id)627 base_id = self.old_contents_id(file_id)
631 if (base_id is not None and628 if (base_id is not None and
632 base_id != self.base_tree.get_root_id()):629 base_id != self.base_tree.path2id('')):
633 old_path = self.base_tree.id2path(base_id)630 old_path = self.base_tree.id2path(base_id)
634 patch_original = self.base_tree.get_file(old_path)631 patch_original = self.base_tree.get_file(old_path)
635 else:632 else:
636633
=== modified file 'breezy/bzr/bzrdir.py'
--- breezy/bzr/bzrdir.py 2019-06-21 16:36:04 +0000
+++ breezy/bzr/bzrdir.py 2019-07-25 23:25:31 +0000
@@ -459,7 +459,7 @@
459 with wt.lock_write():459 with wt.lock_write():
460 if not wt.is_versioned(''):460 if not wt.is_versioned(''):
461 try:461 try:
462 wt.set_root_id(self.open_workingtree.get_root_id())462 wt.set_root_id(self.open_workingtree.path2id(''))
463 except errors.NoWorkingTree:463 except errors.NoWorkingTree:
464 pass464 pass
465 else:465 else:
466466
=== modified file 'breezy/bzr/fetch.py'
--- breezy/bzr/fetch.py 2018-11-16 18:33:17 +0000
+++ breezy/bzr/fetch.py 2019-07-25 23:25:31 +0000
@@ -211,7 +211,7 @@
211 def _find_root_ids(self, revs, parent_map, graph):211 def _find_root_ids(self, revs, parent_map, graph):
212 revision_root = {}212 revision_root = {}
213 for tree in self.iter_rev_trees(revs):213 for tree in self.iter_rev_trees(revs):
214 root_id = tree.get_root_id()214 root_id = tree.path2id('')
215 revision_id = tree.get_file_revision(u'')215 revision_id = tree.get_file_revision(u'')
216 revision_root[revision_id] = root_id216 revision_root[revision_id] = root_id
217 # Find out which parents we don't already know root ids for217 # Find out which parents we don't already know root ids for
@@ -221,7 +221,7 @@
221 # Limit to revisions present in the versionedfile221 # Limit to revisions present in the versionedfile
222 parents = graph.get_parent_map(parents)222 parents = graph.get_parent_map(parents)
223 for tree in self.iter_rev_trees(parents):223 for tree in self.iter_rev_trees(parents):
224 root_id = tree.get_root_id()224 root_id = tree.path2id('')
225 revision_root[tree.get_revision_id()] = root_id225 revision_root[tree.get_revision_id()] = root_id
226 return revision_root226 return revision_root
227227
@@ -296,7 +296,7 @@
296 # But set parent_root_id to None since we don't really know296 # But set parent_root_id to None since we don't really know
297 parent_root_id = None297 parent_root_id = None
298 else:298 else:
299 parent_root_id = tree.get_root_id()299 parent_root_id = tree.path2id('')
300 rev_id_to_root_id_map[parent_id] = None300 rev_id_to_root_id_map[parent_id] = None
301 # XXX: why not:301 # XXX: why not:
302 # rev_id_to_root_id_map[parent_id] = parent_root_id302 # rev_id_to_root_id_map[parent_id] = parent_root_id
303303
=== modified file 'breezy/bzr/inventorytree.py'
--- breezy/bzr/inventorytree.py 2019-06-29 12:29:45 +0000
+++ breezy/bzr/inventorytree.py 2019-07-25 23:25:31 +0000
@@ -778,10 +778,6 @@
778 nested_revid = self.get_reference_revision(path)778 nested_revid = self.get_reference_revision(path)
779 raise MissingNestedTree(path)779 raise MissingNestedTree(path)
780780
781 def get_root_id(self):
782 if self.root_inventory.root:
783 return self.root_inventory.root.file_id
784
785 def kind(self, path):781 def kind(self, path):
786 return self._path2ie(path).kind782 return self._path2ie(path).kind
787783
788784
=== modified file 'breezy/bzr/vf_repository.py'
--- breezy/bzr/vf_repository.py 2019-06-30 10:50:40 +0000
+++ breezy/bzr/vf_repository.py 2019-07-25 23:25:31 +0000
@@ -2642,7 +2642,7 @@
2642 current_revision_id, revision.parent_ids))2642 current_revision_id, revision.parent_ids))
2643 if self._converting_to_rich_root:2643 if self._converting_to_rich_root:
2644 self._revision_id_to_root_id[current_revision_id] = \2644 self._revision_id_to_root_id[current_revision_id] = \
2645 tree.get_root_id()2645 tree.path2id('')
2646 # Determine which texts are in present in this revision but not in2646 # Determine which texts are in present in this revision but not in
2647 # any of the available parents.2647 # any of the available parents.
2648 texts_possibly_new_in_tree = set()2648 texts_possibly_new_in_tree = set()
26492649
=== modified file 'breezy/bzr/workingtree.py'
--- breezy/bzr/workingtree.py 2019-06-22 10:30:21 +0000
+++ breezy/bzr/workingtree.py 2019-07-25 23:25:31 +0000
@@ -284,7 +284,7 @@
284 InventoryFile,284 InventoryFile,
285 InventoryLink)285 InventoryLink)
286 with self.lock_tree_write():286 with self.lock_tree_write():
287 inv = Inventory(self.get_root_id())287 inv = Inventory(self.path2id(''))
288 for path, file_id, parent, kind in new_inventory_list:288 for path, file_id, parent, kind in new_inventory_list:
289 name = os.path.basename(path)289 name = os.path.basename(path)
290 if name == "":290 if name == "":
@@ -658,11 +658,6 @@
658 self._set_inventory(result, dirty=False)658 self._set_inventory(result, dirty=False)
659 return result659 return result
660660
661 def get_root_id(self):
662 """Return the id of this trees root"""
663 with self.lock_read():
664 return self._inventory.root.file_id
665
666 def has_id(self, file_id):661 def has_id(self, file_id):
667 # files that have been deleted are excluded662 # files that have been deleted are excluded
668 inv, inv_file_id = self._unpack_file_id(file_id)663 inv, inv_file_id = self._unpack_file_id(file_id)
@@ -672,7 +667,7 @@
672 return osutils.lexists(self.abspath(path))667 return osutils.lexists(self.abspath(path))
673668
674 def has_or_had_id(self, file_id):669 def has_or_had_id(self, file_id):
675 if file_id == self.get_root_id():670 if file_id == self.path2id(''):
676 return True671 return True
677 inv, inv_file_id = self._unpack_file_id(file_id)672 inv, inv_file_id = self._unpack_file_id(file_id)
678 return inv.has_id(inv_file_id)673 return inv.has_id(inv_file_id)
@@ -951,7 +946,7 @@
951 if child_entry.kind == 'directory':946 if child_entry.kind == 'directory':
952 add_children(inventory, child_entry)947 add_children(inventory, child_entry)
953 with self.lock_write():948 with self.lock_write():
954 if other_tree.get_root_id() == self.get_root_id():949 if other_tree.path2id('') == self.path2id(''):
955 raise errors.BadSubsumeSource(self, other_tree,950 raise errors.BadSubsumeSource(self, other_tree,
956 'Trees have the same root')951 'Trees have the same root')
957 try:952 try:
958953
=== modified file 'breezy/bzr/workingtree_3.py'
--- breezy/bzr/workingtree_3.py 2018-12-04 19:22:35 +0000
+++ breezy/bzr/workingtree_3.py 2019-07-25 23:25:31 +0000
@@ -224,8 +224,8 @@
224 try:224 try:
225 basis_tree = branch.repository.revision_tree(revision_id)225 basis_tree = branch.repository.revision_tree(revision_id)
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.
227 if basis_tree.get_root_id() is not None:227 if basis_tree.path2id('') is not None:
228 wt.set_root_id(basis_tree.get_root_id())228 wt.set_root_id(basis_tree.path2id(''))
229 if revision_id == _mod_revision.NULL_REVISION:229 if revision_id == _mod_revision.NULL_REVISION:
230 wt.set_parent_trees([])230 wt.set_parent_trees([])
231 else:231 else:
232232
=== modified file 'breezy/bzr/workingtree_4.py'
--- breezy/bzr/workingtree_4.py 2019-06-29 12:29:45 +0000
+++ breezy/bzr/workingtree_4.py 2019-07-25 23:25:31 +0000
@@ -171,8 +171,8 @@
171 except errors.PathNotChild:171 except errors.PathNotChild:
172 raise BadReferenceTarget(self, sub_tree,172 raise BadReferenceTarget(self, sub_tree,
173 'Target not inside tree.')173 'Target not inside tree.')
174 sub_tree_id = sub_tree.get_root_id()174 sub_tree_id = sub_tree.path2id('')
175 if sub_tree_id == self.get_root_id():175 if sub_tree_id == self.path2id(''):
176 raise BadReferenceTarget(self, sub_tree,176 raise BadReferenceTarget(self, sub_tree,
177 'Trees have the same root id.')177 'Trees have the same root id.')
178 if self.has_id(sub_tree_id):178 if self.has_id(sub_tree_id):
@@ -467,11 +467,6 @@
467 def get_nested_tree(self, path):467 def get_nested_tree(self, path):
468 return WorkingTree.open(self.abspath(path))468 return WorkingTree.open(self.abspath(path))
469469
470 def get_root_id(self):
471 """Return the id of this trees root"""
472 with self.lock_read():
473 return self._get_entry(path='')[0][2]
474
475 def has_id(self, file_id):470 def has_id(self, file_id):
476 state = self.current_dirstate()471 state = self.current_dirstate()
477 row, parents = self._get_entry(file_id=file_id)472 row, parents = self._get_entry(file_id=file_id)
@@ -1549,7 +1544,7 @@
1549 wt.flush()1544 wt.flush()
1550 # if the basis has a root id we have to use that; otherwise we1545 # if the basis has a root id we have to use that; otherwise we
1551 # use a new random one1546 # use a new random one
1552 basis_root_id = basis.get_root_id()1547 basis_root_id = basis.path2id('')
1553 if basis_root_id is not None:1548 if basis_root_id is not None:
1554 wt._set_root_id(basis_root_id)1549 wt._set_root_id(basis_root_id)
1555 wt.flush()1550 wt.flush()
@@ -1748,9 +1743,6 @@
1748 pred = self.has_filename1743 pred = self.has_filename
1749 return set((p for p in paths if not pred(p)))1744 return set((p for p in paths if not pred(p)))
17501745
1751 def get_root_id(self):
1752 return self.path2id('')
1753
1754 def id2path(self, file_id):1746 def id2path(self, file_id):
1755 "Convert a file-id to a path."1747 "Convert a file-id to a path."
1756 entry = self._get_entry(file_id=file_id)1748 entry = self._get_entry(file_id=file_id)
17571749
=== modified file 'breezy/git/object_store.py'
--- breezy/git/object_store.py 2019-07-25 22:52:58 +0000
+++ breezy/git/object_store.py 2019-07-25 23:25:31 +0000
@@ -518,7 +518,7 @@
518 else:518 else:
519 base_sha1 = self._lookup_revision_sha1(rev.parent_ids[0])519 base_sha1 = self._lookup_revision_sha1(rev.parent_ids[0])
520 root_tree = self[self[base_sha1].tree]520 root_tree = self[self[base_sha1].tree]
521 root_key_data = (tree.get_root_id(), tree.get_revision_id())521 root_key_data = (tree.path2id(''), tree.get_revision_id())
522 if add_cache_entry is not None:522 if add_cache_entry is not None:
523 add_cache_entry(root_tree, root_key_data, "")523 add_cache_entry(root_tree, root_key_data, "")
524 yield "", root_tree524 yield "", root_tree
@@ -614,7 +614,7 @@
614 path,614 path,
615 bzr_tree.iter_child_entries(path),615 bzr_tree.iter_child_entries(path),
616 get_ie_sha1, unusual_modes, self.mapping.BZR_DUMMY_FILE,616 get_ie_sha1, unusual_modes, self.mapping.BZR_DUMMY_FILE,
617 bzr_tree.get_root_id() == fileid)617 bzr_tree.path2id('') == fileid)
618 if tree is not None:618 if tree is not None:
619 _check_expected_sha(expected_sha, tree)619 _check_expected_sha(expected_sha, tree)
620 return tree620 return tree
621621
=== modified file 'breezy/git/tests/test_repository.py'
--- breezy/git/tests/test_repository.py 2018-11-21 21:34:30 +0000
+++ breezy/git/tests/test_repository.py 2019-07-25 23:25:31 +0000
@@ -190,7 +190,7 @@
190 repo = self.git_repo190 repo = self.git_repo
191 tree = repo.revision_tree(revision.NULL_REVISION)191 tree = repo.revision_tree(revision.NULL_REVISION)
192 self.assertEqual(tree.get_revision_id(), revision.NULL_REVISION)192 self.assertEqual(tree.get_revision_id(), revision.NULL_REVISION)
193 self.assertIs(None, tree.get_root_id())193 self.assertIs(None, tree.path2id(''))
194194
195 def test_get_parent_map_null(self):195 def test_get_parent_map_null(self):
196 self.assertEqual({revision.NULL_REVISION: ()},196 self.assertEqual({revision.NULL_REVISION: ()},
197197
=== modified file 'breezy/git/tree.py'
--- breezy/git/tree.py 2019-07-25 22:52:58 +0000
+++ breezy/git/tree.py 2019-07-25 23:25:31 +0000
@@ -360,11 +360,6 @@
360 todo.append((store, subpath, hexsha))360 todo.append((store, subpath, hexsha))
361 return ret361 return ret
362362
363 def get_root_id(self):
364 if self.tree is None:
365 return None
366 return self.path2id("")
367
368 def has_or_had_id(self, file_id):363 def has_or_had_id(self, file_id):
369 try:364 try:
370 self.id2path(file_id)365 self.id2path(file_id)
@@ -512,7 +507,7 @@
512 else:507 else:
513 specific_files = set([p.encode('utf-8')508 specific_files = set([p.encode('utf-8')
514 for p in specific_files])509 for p in specific_files])
515 todo = deque([(self.store, b"", self.tree, self.get_root_id())])510 todo = deque([(self.store, b"", self.tree, self.path2id(''))])
516 if specific_files is None or u"" in specific_files:511 if specific_files is None or u"" in specific_files:
517 yield u"", self._get_dir_ie(b"", None)512 yield u"", self._get_dir_ie(b"", None)
518 while todo:513 while todo:
@@ -1016,9 +1011,6 @@
1016 def _set_root_id(self, file_id):1011 def _set_root_id(self, file_id):
1017 raise errors.UnsupportedOperation(self._set_root_id, self)1012 raise errors.UnsupportedOperation(self._set_root_id, self)
10181013
1019 def get_root_id(self):
1020 return self.path2id(u"")
1021
1022 def _add(self, files, ids, kinds):1014 def _add(self, files, ids, kinds):
1023 for (path, file_id, kind) in zip(files, ids, kinds):1015 for (path, file_id, kind) in zip(files, ids, kinds):
1024 if file_id is not None:1016 if file_id is not None:
10251017
=== modified file 'breezy/git/workingtree.py'
--- breezy/git/workingtree.py 2019-06-29 15:50:22 +0000
+++ breezy/git/workingtree.py 2019-07-25 23:25:31 +0000
@@ -1039,7 +1039,7 @@
1039 prefix = prefix.encode('utf-8')1039 prefix = prefix.encode('utf-8')
1040 per_dir = defaultdict(set)1040 per_dir = defaultdict(set)
1041 if prefix == b"":1041 if prefix == b"":
1042 per_dir[(u'', self.get_root_id())] = set()1042 per_dir[(u'', self.path2id(''))] = set()
10431043
1044 def add_entry(path, kind):1044 def add_entry(path, kind):
1045 if path == b'' or not path.startswith(prefix):1045 if path == b'' or not path.startswith(prefix):
10461046
=== modified file 'breezy/memorytree.py'
--- breezy/memorytree.py 2019-03-04 00:19:25 +0000
+++ breezy/memorytree.py 2019-07-25 23:25:31 +0000
@@ -106,9 +106,6 @@
106 stream = self._file_transport.get(path)106 stream = self._file_transport.get(path)
107 return sha_file(stream)107 return sha_file(stream)
108108
109 def get_root_id(self):
110 return self.path2id('')
111
112 def _comparison_data(self, entry, path):109 def _comparison_data(self, entry, path):
113 """See Tree._comparison_data."""110 """See Tree._comparison_data."""
114 if entry is None:111 if entry is None:
115112
=== modified file 'breezy/merge.py'
--- breezy/merge.py 2019-06-22 13:51:23 +0000
+++ breezy/merge.py 2019-07-25 23:25:31 +0000
@@ -1563,7 +1563,7 @@
1563 if other_parent is None or other_name is None:1563 if other_parent is None or other_name is None:
1564 other_path = '<deleted>'1564 other_path = '<deleted>'
1565 else:1565 else:
1566 if other_parent == self.other_tree.get_root_id():1566 if other_parent == self.other_tree.path2id(''):
1567 # The tree transform doesn't know about the other root,1567 # The tree transform doesn't know about the other root,
1568 # so we special case here to avoid a NoFinalPath1568 # so we special case here to avoid a NoFinalPath
1569 # exception1569 # exception
15701570
=== modified file 'breezy/plugins/weave_fmt/workingtree.py'
--- breezy/plugins/weave_fmt/workingtree.py 2018-11-21 03:20:30 +0000
+++ breezy/plugins/weave_fmt/workingtree.py 2019-07-25 23:25:31 +0000
@@ -111,8 +111,8 @@
111 _controldir=a_controldir,111 _controldir=a_controldir,
112 _control_files=branch.control_files)112 _control_files=branch.control_files)
113 basis_tree = branch.repository.revision_tree(revision_id)113 basis_tree = branch.repository.revision_tree(revision_id)
114 if basis_tree.get_root_id() is not None:114 if basis_tree.path2id('') is not None:
115 wt.set_root_id(basis_tree.get_root_id())115 wt.set_root_id(basis_tree.path2id(''))
116 # set the parent list and cache the basis tree.116 # set the parent list and cache the basis tree.
117 if _mod_revision.is_null(revision_id):117 if _mod_revision.is_null(revision_id):
118 parent_trees = []118 parent_trees = []
119119
=== modified file 'breezy/tests/blackbox/test_join.py'
--- breezy/tests/blackbox/test_join.py 2018-11-11 04:08:32 +0000
+++ breezy/tests/blackbox/test_join.py 2019-07-25 23:25:31 +0000
@@ -67,7 +67,7 @@
67 def test_join_reference(self):67 def test_join_reference(self):
68 """Join can add a reference if --reference is supplied"""68 """Join can add a reference if --reference is supplied"""
69 base_tree, sub_tree = self.make_trees()69 base_tree, sub_tree = self.make_trees()
70 subtree_root_id = sub_tree.get_root_id()70 subtree_root_id = sub_tree.path2id('')
71 self.run_bzr('join . --reference', working_dir='tree/subtree')71 self.run_bzr('join . --reference', working_dir='tree/subtree')
72 sub_tree.lock_read()72 sub_tree.lock_read()
73 self.addCleanup(sub_tree.unlock)73 self.addCleanup(sub_tree.unlock)
7474
=== modified file 'breezy/tests/per_intertree/test_compare.py'
--- breezy/tests/per_intertree/test_compare.py 2019-06-17 23:01:58 +0000
+++ breezy/tests/per_intertree/test_compare.py 2019-07-25 23:25:31 +0000
@@ -73,7 +73,7 @@
73 def test_compare_empty_trees(self):73 def test_compare_empty_trees(self):
74 tree1 = self.make_branch_and_tree('1')74 tree1 = self.make_branch_and_tree('1')
75 tree2 = self.make_to_branch_and_tree('2')75 tree2 = self.make_to_branch_and_tree('2')
76 tree2.set_root_id(tree1.get_root_id())76 tree2.set_root_id(tree1.path2id(''))
77 tree1 = self.get_tree_no_parents_no_content(tree1)77 tree1 = self.get_tree_no_parents_no_content(tree1)
78 tree2 = self.get_tree_no_parents_no_content(tree2)78 tree2 = self.get_tree_no_parents_no_content(tree2)
79 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)79 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
@@ -87,7 +87,7 @@
87 def test_empty_to_abc_content(self):87 def test_empty_to_abc_content(self):
88 tree1 = self.make_branch_and_tree('1')88 tree1 = self.make_branch_and_tree('1')
89 tree2 = self.make_to_branch_and_tree('2')89 tree2 = self.make_to_branch_and_tree('2')
90 tree2.set_root_id(tree1.get_root_id())90 tree2.set_root_id(tree1.path2id(''))
91 tree1 = self.get_tree_no_parents_no_content(tree1)91 tree1 = self.get_tree_no_parents_no_content(tree1)
92 tree2 = self.get_tree_no_parents_abc_content(tree2)92 tree2 = self.get_tree_no_parents_abc_content(tree2)
93 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)93 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
@@ -109,7 +109,7 @@
109 # the test.109 # the test.
110 tree1 = self.make_branch_and_tree('1')110 tree1 = self.make_branch_and_tree('1')
111 tree2 = self.make_to_branch_and_tree('2')111 tree2 = self.make_to_branch_and_tree('2')
112 tree2.set_root_id(tree1.get_root_id())112 tree2.set_root_id(tree1.path2id(''))
113 self.build_tree(['2/a'])113 self.build_tree(['2/a'])
114 tree2.add('a')114 tree2.add('a')
115 os.unlink('2/a')115 os.unlink('2/a')
@@ -131,7 +131,7 @@
131 def test_abc_content_to_empty(self):131 def test_abc_content_to_empty(self):
132 tree1 = self.make_branch_and_tree('1')132 tree1 = self.make_branch_and_tree('1')
133 tree2 = self.make_to_branch_and_tree('2')133 tree2 = self.make_to_branch_and_tree('2')
134 tree2.set_root_id(tree1.get_root_id())134 tree2.set_root_id(tree1.path2id(''))
135 tree1 = self.get_tree_no_parents_abc_content(tree1)135 tree1 = self.get_tree_no_parents_abc_content(tree1)
136 tree2 = self.get_tree_no_parents_no_content(tree2)136 tree2 = self.get_tree_no_parents_no_content(tree2)
137 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)137 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
@@ -148,7 +148,7 @@
148 def test_content_modification(self):148 def test_content_modification(self):
149 tree1 = self.make_branch_and_tree('1')149 tree1 = self.make_branch_and_tree('1')
150 tree2 = self.make_to_branch_and_tree('2')150 tree2 = self.make_to_branch_and_tree('2')
151 tree2.set_root_id(tree1.get_root_id())151 tree2.set_root_id(tree1.path2id(''))
152 tree1 = self.get_tree_no_parents_abc_content(tree1)152 tree1 = self.get_tree_no_parents_abc_content(tree1)
153 tree2 = self.get_tree_no_parents_abc_content_2(tree2)153 tree2 = self.get_tree_no_parents_abc_content_2(tree2)
154 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)154 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
@@ -163,7 +163,7 @@
163 def test_meta_modification(self):163 def test_meta_modification(self):
164 tree1 = self.make_branch_and_tree('1')164 tree1 = self.make_branch_and_tree('1')
165 tree2 = self.make_to_branch_and_tree('2')165 tree2 = self.make_to_branch_and_tree('2')
166 tree2.set_root_id(tree1.get_root_id())166 tree2.set_root_id(tree1.path2id(''))
167 tree1 = self.get_tree_no_parents_abc_content(tree1)167 tree1 = self.get_tree_no_parents_abc_content(tree1)
168 tree2 = self.get_tree_no_parents_abc_content_3(tree2)168 tree2 = self.get_tree_no_parents_abc_content_3(tree2)
169 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)169 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
@@ -178,7 +178,7 @@
178 def test_file_rename(self):178 def test_file_rename(self):
179 tree1 = self.make_branch_and_tree('1')179 tree1 = self.make_branch_and_tree('1')
180 tree2 = self.make_to_branch_and_tree('2')180 tree2 = self.make_to_branch_and_tree('2')
181 tree2.set_root_id(tree1.get_root_id())181 tree2.set_root_id(tree1.path2id(''))
182 tree1 = self.get_tree_no_parents_abc_content(tree1)182 tree1 = self.get_tree_no_parents_abc_content(tree1)
183 tree2 = self.get_tree_no_parents_abc_content_4(tree2)183 tree2 = self.get_tree_no_parents_abc_content_4(tree2)
184 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)184 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
@@ -193,7 +193,7 @@
193 def test_file_rename_and_modification(self):193 def test_file_rename_and_modification(self):
194 tree1 = self.make_branch_and_tree('1')194 tree1 = self.make_branch_and_tree('1')
195 tree2 = self.make_to_branch_and_tree('2')195 tree2 = self.make_to_branch_and_tree('2')
196 tree2.set_root_id(tree1.get_root_id())196 tree2.set_root_id(tree1.path2id(''))
197 tree1 = self.get_tree_no_parents_abc_content(tree1)197 tree1 = self.get_tree_no_parents_abc_content(tree1)
198 tree2 = self.get_tree_no_parents_abc_content_5(tree2)198 tree2 = self.get_tree_no_parents_abc_content_5(tree2)
199 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)199 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
@@ -208,7 +208,7 @@
208 def test_file_rename_and_meta_modification(self):208 def test_file_rename_and_meta_modification(self):
209 tree1 = self.make_branch_and_tree('1')209 tree1 = self.make_branch_and_tree('1')
210 tree2 = self.make_to_branch_and_tree('2')210 tree2 = self.make_to_branch_and_tree('2')
211 tree2.set_root_id(tree1.get_root_id())211 tree2.set_root_id(tree1.path2id(''))
212 tree1 = self.get_tree_no_parents_abc_content(tree1)212 tree1 = self.get_tree_no_parents_abc_content(tree1)
213 tree2 = self.get_tree_no_parents_abc_content_6(tree2)213 tree2 = self.get_tree_no_parents_abc_content_6(tree2)
214 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)214 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
@@ -223,7 +223,7 @@
223 def test_empty_to_abc_content_a_only(self):223 def test_empty_to_abc_content_a_only(self):
224 tree1 = self.make_branch_and_tree('1')224 tree1 = self.make_branch_and_tree('1')
225 tree2 = self.make_to_branch_and_tree('2')225 tree2 = self.make_to_branch_and_tree('2')
226 tree2.set_root_id(tree1.get_root_id())226 tree2.set_root_id(tree1.path2id(''))
227 tree1 = self.get_tree_no_parents_no_content(tree1)227 tree1 = self.get_tree_no_parents_no_content(tree1)
228 tree2 = self.get_tree_no_parents_abc_content(tree2)228 tree2 = self.get_tree_no_parents_abc_content(tree2)
229 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)229 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
@@ -349,7 +349,7 @@
349 def test_default_ignores_unversioned_files(self):349 def test_default_ignores_unversioned_files(self):
350 tree1 = self.make_branch_and_tree('tree1')350 tree1 = self.make_branch_and_tree('tree1')
351 tree2 = self.make_to_branch_and_tree('tree2')351 tree2 = self.make_to_branch_and_tree('tree2')
352 tree2.set_root_id(tree1.get_root_id())352 tree2.set_root_id(tree1.path2id(''))
353 self.build_tree(['tree1/a', 'tree1/c',353 self.build_tree(['tree1/a', 'tree1/c',
354 'tree2/a', 'tree2/b', 'tree2/c'])354 'tree2/a', 'tree2/b', 'tree2/c'])
355 tree1.add(['a', 'c'], [b'a-id', b'c-id'])355 tree1.add(['a', 'c'], [b'a-id', b'c-id'])
@@ -368,7 +368,7 @@
368 def test_unversioned_paths_in_tree(self):368 def test_unversioned_paths_in_tree(self):
369 tree1 = self.make_branch_and_tree('tree1')369 tree1 = self.make_branch_and_tree('tree1')
370 tree2 = self.make_to_branch_and_tree('tree2')370 tree2 = self.make_to_branch_and_tree('tree2')
371 tree2.set_root_id(tree1.get_root_id())371 tree2.set_root_id(tree1.path2id(''))
372 self.build_tree(['tree2/file', 'tree2/dir/'])372 self.build_tree(['tree2/file', 'tree2/dir/'])
373 if has_symlinks():373 if has_symlinks():
374 os.symlink('target', 'tree2/link')374 os.symlink('target', 'tree2/link')
@@ -495,7 +495,7 @@
495 """Create a tree with filenames chosen to exercise the walk order."""495 """Create a tree with filenames chosen to exercise the walk order."""
496 tree1 = self.make_branch_and_tree('tree1')496 tree1 = self.make_branch_and_tree('tree1')
497 tree2 = self.make_to_branch_and_tree('tree2')497 tree2 = self.make_to_branch_and_tree('tree2')
498 tree2.set_root_id(tree1.get_root_id())498 tree2.set_root_id(tree1.path2id(''))
499 paths, path_ids = self._create_special_names(tree2, 'tree2')499 paths, path_ids = self._create_special_names(tree2, 'tree2')
500 tree2.commit('initial', rev_id=b'rev-1')500 tree2.commit('initial', rev_id=b'rev-1')
501 tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)501 tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
@@ -508,7 +508,7 @@
508 """508 """
509 tree1 = self.make_branch_and_tree('tree1')509 tree1 = self.make_branch_and_tree('tree1')
510 tree2 = self.make_to_branch_and_tree('tree2')510 tree2 = self.make_to_branch_and_tree('tree2')
511 tree2.set_root_id(tree1.get_root_id())511 tree2.set_root_id(tree1.path2id(''))
512 paths, path_ids = self._create_special_names(tree1, 'tree1')512 paths, path_ids = self._create_special_names(tree1, 'tree1')
513 paths, path_ids = self._create_special_names(tree2, 'tree2')513 paths, path_ids = self._create_special_names(tree2, 'tree2')
514 tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)514 tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
@@ -808,7 +808,7 @@
808 tree1.put_file_bytes_non_atomic(808 tree1.put_file_bytes_non_atomic(
809 'changing/unchanging/file', b'a file')809 'changing/unchanging/file', b'a file')
810 tree2 = self.make_to_branch_and_tree('2')810 tree2 = self.make_to_branch_and_tree('2')
811 tree2.set_root_id(tree1.get_root_id())811 tree2.set_root_id(tree1.path2id(''))
812 tree2.mkdir('changed', b'parent-id')812 tree2.mkdir('changed', b'parent-id')
813 tree2.mkdir('changed/unchanging', b'mid-id')813 tree2.mkdir('changed/unchanging', b'mid-id')
814 tree2.add(['changed/unchanging/file'], [b'file-id'], ['file'])814 tree2.add(['changed/unchanging/file'], [b'file-id'], ['file'])
@@ -887,7 +887,7 @@
887 tree1.add(['a'], [b'a-id'], ['file'])887 tree1.add(['a'], [b'a-id'], ['file'])
888 tree1.put_file_bytes_non_atomic('a', b'a file')888 tree1.put_file_bytes_non_atomic('a', b'a file')
889 tree2 = self.make_to_branch_and_tree('2')889 tree2 = self.make_to_branch_and_tree('2')
890 tree2.set_root_id(tree1.get_root_id())890 tree2.set_root_id(tree1.path2id(''))
891 tree2.mkdir('a', b'b-id')891 tree2.mkdir('a', b'b-id')
892 tree2.add(['a/c'], [b'c-id'], ['file'])892 tree2.add(['a/c'], [b'c-id'], ['file'])
893 tree2.put_file_bytes_non_atomic('a/c', b'another file')893 tree2.put_file_bytes_non_atomic('a/c', b'another file')
@@ -907,7 +907,7 @@
907 tree1.mkdir('a/reparented', b'reparented-id')907 tree1.mkdir('a/reparented', b'reparented-id')
908 tree1.mkdir('a/deleted', b'deleted-id')908 tree1.mkdir('a/deleted', b'deleted-id')
909 tree2 = self.make_to_branch_and_tree('2')909 tree2 = self.make_to_branch_and_tree('2')
910 tree2.set_root_id(tree1.get_root_id())910 tree2.set_root_id(tree1.path2id(''))
911 tree2.mkdir('a', b'a-new-id')911 tree2.mkdir('a', b'a-new-id')
912 tree2.mkdir('a/reparented', b'reparented-id')912 tree2.mkdir('a/reparented', b'reparented-id')
913 tree2.add(['b'], [b'a-old-id'], ['file'])913 tree2.add(['b'], [b'a-old-id'], ['file'])
@@ -931,7 +931,7 @@
931 tree1.mkdir('a/reparented', b'reparented-id')931 tree1.mkdir('a/reparented', b'reparented-id')
932 tree1.mkdir('a/deleted', b'deleted-id')932 tree1.mkdir('a/deleted', b'deleted-id')
933 tree2 = self.make_to_branch_and_tree('2')933 tree2 = self.make_to_branch_and_tree('2')
934 tree2.set_root_id(tree1.get_root_id())934 tree2.set_root_id(tree1.path2id(''))
935 tree2.mkdir('a', b'a-new-id')935 tree2.mkdir('a', b'a-new-id')
936 tree2.mkdir('a/reparented', b'reparented-id')936 tree2.mkdir('a/reparented', b'reparented-id')
937 tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)937 tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
@@ -955,7 +955,7 @@
955 tree1.mkdir('a/reparented', b'reparented-id')955 tree1.mkdir('a/reparented', b'reparented-id')
956 tree1.mkdir('collides', b'collides-id')956 tree1.mkdir('collides', b'collides-id')
957 tree2 = self.make_to_branch_and_tree('2')957 tree2 = self.make_to_branch_and_tree('2')
958 tree2.set_root_id(tree1.get_root_id())958 tree2.set_root_id(tree1.path2id(''))
959 tree2.mkdir('a', b'a-new-id')959 tree2.mkdir('a', b'a-new-id')
960 tree2.mkdir('a/selected', b'selected-id')960 tree2.mkdir('a/selected', b'selected-id')
961 tree2.mkdir('collides', b'reparented-id')961 tree2.mkdir('collides', b'reparented-id')
@@ -984,7 +984,7 @@
984 tree1.mkdir('a/deleted/reparented', b'reparented-id-2')984 tree1.mkdir('a/deleted/reparented', b'reparented-id-2')
985 tree1.mkdir('a/deleted/deleted', b'deleted-id-2')985 tree1.mkdir('a/deleted/deleted', b'deleted-id-2')
986 tree2 = self.make_to_branch_and_tree('2')986 tree2 = self.make_to_branch_and_tree('2')
987 tree2.set_root_id(tree1.get_root_id())987 tree2.set_root_id(tree1.path2id(''))
988 tree2.mkdir('a', b'a-new-id')988 tree2.mkdir('a', b'a-new-id')
989 tree2.mkdir('a/reparented', b'reparented-id-1')989 tree2.mkdir('a/reparented', b'reparented-id-1')
990 tree2.mkdir('reparented', b'reparented-id-2')990 tree2.mkdir('reparented', b'reparented-id-2')
@@ -1068,7 +1068,7 @@
1068 def test_missing_and_renamed(self):1068 def test_missing_and_renamed(self):
1069 tree1 = self.make_branch_and_tree('tree1')1069 tree1 = self.make_branch_and_tree('tree1')
1070 tree2 = self.make_to_branch_and_tree('tree2')1070 tree2 = self.make_to_branch_and_tree('tree2')
1071 tree2.set_root_id(tree1.get_root_id())1071 tree2.set_root_id(tree1.path2id(''))
1072 self.build_tree(['tree1/file'])1072 self.build_tree(['tree1/file'])
1073 tree1.add(['file'], [b'file-id'])1073 tree1.add(['file'], [b'file-id'])
1074 self.build_tree(['tree2/directory/'])1074 self.build_tree(['tree2/directory/'])
@@ -1086,7 +1086,7 @@
1086 def test_only_in_source_and_missing(self):1086 def test_only_in_source_and_missing(self):
1087 tree1 = self.make_branch_and_tree('tree1')1087 tree1 = self.make_branch_and_tree('tree1')
1088 tree2 = self.make_to_branch_and_tree('tree2')1088 tree2 = self.make_to_branch_and_tree('tree2')
1089 tree2.set_root_id(tree1.get_root_id())1089 tree2.set_root_id(tree1.path2id(''))
1090 self.build_tree(['tree1/file'])1090 self.build_tree(['tree1/file'])
1091 tree1.add(['file'], [b'file-id'])1091 tree1.add(['file'], [b'file-id'])
1092 os.unlink('tree1/file')1092 os.unlink('tree1/file')
@@ -1101,7 +1101,7 @@
1101 def test_only_in_target_and_missing(self):1101 def test_only_in_target_and_missing(self):
1102 tree1 = self.make_branch_and_tree('tree1')1102 tree1 = self.make_branch_and_tree('tree1')
1103 tree2 = self.make_to_branch_and_tree('tree2')1103 tree2 = self.make_to_branch_and_tree('tree2')
1104 tree2.set_root_id(tree1.get_root_id())1104 tree2.set_root_id(tree1.path2id(''))
1105 self.build_tree(['tree2/file'])1105 self.build_tree(['tree2/file'])
1106 tree2.add(['file'], [b'file-id'])1106 tree2.add(['file'], [b'file-id'])
1107 os.unlink('tree2/file')1107 os.unlink('tree2/file')
@@ -1116,7 +1116,7 @@
1116 def test_only_in_target_missing_subtree_specific_bug_367632(self):1116 def test_only_in_target_missing_subtree_specific_bug_367632(self):
1117 tree1 = self.make_branch_and_tree('tree1')1117 tree1 = self.make_branch_and_tree('tree1')
1118 tree2 = self.make_to_branch_and_tree('tree2')1118 tree2 = self.make_to_branch_and_tree('tree2')
1119 tree2.set_root_id(tree1.get_root_id())1119 tree2.set_root_id(tree1.path2id(''))
1120 self.build_tree(['tree2/a-dir/', 'tree2/a-dir/a-file'])1120 self.build_tree(['tree2/a-dir/', 'tree2/a-dir/a-file'])
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'])
1122 os.unlink('tree2/a-dir/a-file')1122 os.unlink('tree2/a-dir/a-file')
@@ -1226,7 +1226,7 @@
1226 def test_default_ignores_unversioned_files(self):1226 def test_default_ignores_unversioned_files(self):
1227 tree1 = self.make_branch_and_tree('tree1')1227 tree1 = self.make_branch_and_tree('tree1')
1228 tree2 = self.make_to_branch_and_tree('tree2')1228 tree2 = self.make_to_branch_and_tree('tree2')
1229 tree2.set_root_id(tree1.get_root_id())1229 tree2.set_root_id(tree1.path2id(''))
1230 self.build_tree(['tree1/a', 'tree1/c',1230 self.build_tree(['tree1/a', 'tree1/c',
1231 'tree2/a', 'tree2/b', 'tree2/c'])1231 'tree2/a', 'tree2/b', 'tree2/c'])
1232 tree1.add(['a', 'c'], [b'a-id', b'c-id'])1232 tree1.add(['a', 'c'], [b'a-id', b'c-id'])
@@ -1246,7 +1246,7 @@
1246 def test_unversioned_paths_in_tree(self):1246 def test_unversioned_paths_in_tree(self):
1247 tree1 = self.make_branch_and_tree('tree1')1247 tree1 = self.make_branch_and_tree('tree1')
1248 tree2 = self.make_to_branch_and_tree('tree2')1248 tree2 = self.make_to_branch_and_tree('tree2')
1249 tree2.set_root_id(tree1.get_root_id())1249 tree2.set_root_id(tree1.path2id(''))
1250 self.build_tree(['tree2/file', 'tree2/dir/'])1250 self.build_tree(['tree2/file', 'tree2/dir/'])
1251 if has_symlinks():1251 if has_symlinks():
1252 os.symlink('target', 'tree2/link')1252 os.symlink('target', 'tree2/link')
@@ -1299,7 +1299,7 @@
1299 # both foo and bar.1299 # both foo and bar.
1300 tree1 = self.make_branch_and_tree('tree1')1300 tree1 = self.make_branch_and_tree('tree1')
1301 tree2 = self.make_to_branch_and_tree('tree2')1301 tree2 = self.make_to_branch_and_tree('tree2')
1302 tree2.set_root_id(tree1.get_root_id())1302 tree2.set_root_id(tree1.path2id(''))
1303 self.build_tree(['tree2/file', 'tree2/dir/',1303 self.build_tree(['tree2/file', 'tree2/dir/',
1304 'tree1/file', 'tree2/movedfile',1304 'tree1/file', 'tree2/movedfile',
1305 'tree1/dir/', 'tree2/moveddir/'])1305 'tree1/dir/', 'tree2/moveddir/'])
@@ -1343,7 +1343,7 @@
1343 """Test when we have a few files with similar names."""1343 """Test when we have a few files with similar names."""
1344 tree1 = self.make_branch_and_tree('tree1')1344 tree1 = self.make_branch_and_tree('tree1')
1345 tree2 = self.make_branch_and_tree('tree2')1345 tree2 = self.make_branch_and_tree('tree2')
1346 tree2.set_root_id(tree1.get_root_id())1346 tree2.set_root_id(tree1.path2id(''))
13471347
1348 # The trees are actually identical, but they happen to contain1348 # The trees are actually identical, but they happen to contain
1349 # similarly named files.1349 # similarly named files.
@@ -1371,7 +1371,7 @@
1371 self.assertEqual([], self.do_iter_changes(tree1, tree2,1371 self.assertEqual([], self.do_iter_changes(tree1, tree2,
1372 want_unversioned=True))1372 want_unversioned=True))
1373 expected = self.sorted([1373 expected = self.sorted([
1374 self.unchanged(tree2, tree2.get_root_id()),1374 self.unchanged(tree2, tree2.path2id('')),
1375 self.unchanged(tree2, b'a-id'),1375 self.unchanged(tree2, b'a-id'),
1376 self.unchanged(tree2, b'b-id'),1376 self.unchanged(tree2, b'b-id'),
1377 self.unchanged(tree2, b'c-id'),1377 self.unchanged(tree2, b'c-id'),
@@ -1387,7 +1387,7 @@
1387 def test_unversioned_subtree_only_emits_root(self):1387 def test_unversioned_subtree_only_emits_root(self):
1388 tree1 = self.make_branch_and_tree('tree1')1388 tree1 = self.make_branch_and_tree('tree1')
1389 tree2 = self.make_to_branch_and_tree('tree2')1389 tree2 = self.make_to_branch_and_tree('tree2')
1390 tree2.set_root_id(tree1.get_root_id())1390 tree2.set_root_id(tree1.path2id(''))
1391 self.build_tree(['tree2/dir/', 'tree2/dir/file'])1391 self.build_tree(['tree2/dir/', 'tree2/dir/file'])
1392 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)1392 tree1, tree2 = self.mutable_trees_to_test_trees(self, tree1, tree2)
1393 self.not_applicable_if_cannot_represent_unversioned(tree2)1393 self.not_applicable_if_cannot_represent_unversioned(tree2)
@@ -1400,7 +1400,7 @@
1400 def make_trees_with_symlinks(self):1400 def make_trees_with_symlinks(self):
1401 tree1 = self.make_branch_and_tree('tree1')1401 tree1 = self.make_branch_and_tree('tree1')
1402 tree2 = self.make_to_branch_and_tree('tree2')1402 tree2 = self.make_to_branch_and_tree('tree2')
1403 tree2.set_root_id(tree1.get_root_id())1403 tree2.set_root_id(tree1.path2id(''))
1404 self.build_tree(['tree1/fromfile', 'tree1/fromdir/'])1404 self.build_tree(['tree1/fromfile', 'tree1/fromdir/'])
1405 self.build_tree(['tree2/tofile', 'tree2/todir/', 'tree2/unknown'])1405 self.build_tree(['tree2/tofile', 'tree2/todir/', 'tree2/unknown'])
1406 os.symlink('original', 'tree1/changed')1406 os.symlink('original', 'tree1/changed')
@@ -1500,7 +1500,7 @@
1500 def test_trees_with_deleted_dir(self):1500 def test_trees_with_deleted_dir(self):
1501 tree1 = self.make_branch_and_tree('tree1')1501 tree1 = self.make_branch_and_tree('tree1')
1502 tree2 = self.make_to_branch_and_tree('tree2')1502 tree2 = self.make_to_branch_and_tree('tree2')
1503 tree2.set_root_id(tree1.get_root_id())1503 tree2.set_root_id(tree1.path2id(''))
1504 self.build_tree(['tree1/a', 'tree1/b/', 'tree1/b/c',1504 self.build_tree(['tree1/a', 'tree1/b/', 'tree1/b/c',
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',
1506 'tree2/a', 'tree2/f/', 'tree2/f/g'])1506 'tree2/a', 'tree2/f/', 'tree2/f/g'])
@@ -1525,7 +1525,7 @@
1525 def test_added_unicode(self):1525 def test_added_unicode(self):
1526 tree1 = self.make_branch_and_tree('tree1')1526 tree1 = self.make_branch_and_tree('tree1')
1527 tree2 = self.make_to_branch_and_tree('tree2')1527 tree2 = self.make_to_branch_and_tree('tree2')
1528 root_id = tree1.get_root_id()1528 root_id = tree1.path2id('')
1529 tree2.set_root_id(root_id)1529 tree2.set_root_id(root_id)
15301530
1531 # u'\u03b1' == GREEK SMALL LETTER ALPHA1531 # u'\u03b1' == GREEK SMALL LETTER ALPHA
@@ -1554,7 +1554,7 @@
1554 def test_deleted_unicode(self):1554 def test_deleted_unicode(self):
1555 tree1 = self.make_branch_and_tree('tree1')1555 tree1 = self.make_branch_and_tree('tree1')
1556 tree2 = self.make_to_branch_and_tree('tree2')1556 tree2 = self.make_to_branch_and_tree('tree2')
1557 root_id = tree1.get_root_id()1557 root_id = tree1.path2id('')
1558 tree2.set_root_id(root_id)1558 tree2.set_root_id(root_id)
15591559
1560 # u'\u03b1' == GREEK SMALL LETTER ALPHA1560 # u'\u03b1' == GREEK SMALL LETTER ALPHA
@@ -1583,7 +1583,7 @@
1583 def test_modified_unicode(self):1583 def test_modified_unicode(self):
1584 tree1 = self.make_branch_and_tree('tree1')1584 tree1 = self.make_branch_and_tree('tree1')
1585 tree2 = self.make_to_branch_and_tree('tree2')1585 tree2 = self.make_to_branch_and_tree('tree2')
1586 root_id = tree1.get_root_id()1586 root_id = tree1.path2id('')
1587 tree2.set_root_id(root_id)1587 tree2.set_root_id(root_id)
15881588
1589 # u'\u03b1' == GREEK SMALL LETTER ALPHA1589 # u'\u03b1' == GREEK SMALL LETTER ALPHA
@@ -1613,7 +1613,7 @@
1613 def test_renamed_unicode(self):1613 def test_renamed_unicode(self):
1614 tree1 = self.make_branch_and_tree('tree1')1614 tree1 = self.make_branch_and_tree('tree1')
1615 tree2 = self.make_to_branch_and_tree('tree2')1615 tree2 = self.make_to_branch_and_tree('tree2')
1616 root_id = tree1.get_root_id()1616 root_id = tree1.path2id('')
1617 tree2.set_root_id(root_id)1617 tree2.set_root_id(root_id)
16181618
1619 # u'\u03b1' == GREEK SMALL LETTER ALPHA1619 # u'\u03b1' == GREEK SMALL LETTER ALPHA
@@ -1644,7 +1644,7 @@
1644 def test_unchanged_unicode(self):1644 def test_unchanged_unicode(self):
1645 tree1 = self.make_branch_and_tree('tree1')1645 tree1 = self.make_branch_and_tree('tree1')
1646 tree2 = self.make_to_branch_and_tree('tree2')1646 tree2 = self.make_to_branch_and_tree('tree2')
1647 root_id = tree1.get_root_id()1647 root_id = tree1.path2id('')
1648 tree2.set_root_id(root_id)1648 tree2.set_root_id(root_id)
1649 # u'\u03b1' == GREEK SMALL LETTER ALPHA1649 # u'\u03b1' == GREEK SMALL LETTER ALPHA
1650 # u'\u03c9' == GREEK SMALL LETTER OMEGA1650 # u'\u03c9' == GREEK SMALL LETTER OMEGA
@@ -1692,7 +1692,7 @@
1692 def test_unknown_unicode(self):1692 def test_unknown_unicode(self):
1693 tree1 = self.make_branch_and_tree('tree1')1693 tree1 = self.make_branch_and_tree('tree1')
1694 tree2 = self.make_to_branch_and_tree('tree2')1694 tree2 = self.make_to_branch_and_tree('tree2')
1695 root_id = tree1.get_root_id()1695 root_id = tree1.path2id('')
1696 tree2.set_root_id(root_id)1696 tree2.set_root_id(root_id)
1697 # u'\u03b1' == GREEK SMALL LETTER ALPHA1697 # u'\u03b1' == GREEK SMALL LETTER ALPHA
1698 # u'\u03c9' == GREEK SMALL LETTER OMEGA1698 # u'\u03c9' == GREEK SMALL LETTER OMEGA
@@ -1746,7 +1746,7 @@
1746 def test_unknown_empty_dir(self):1746 def test_unknown_empty_dir(self):
1747 tree1 = self.make_branch_and_tree('tree1')1747 tree1 = self.make_branch_and_tree('tree1')
1748 tree2 = self.make_to_branch_and_tree('tree2')1748 tree2 = self.make_to_branch_and_tree('tree2')
1749 root_id = tree1.get_root_id()1749 root_id = tree1.path2id('')
1750 tree2.set_root_id(root_id)1750 tree2.set_root_id(root_id)
17511751
1752 # Start with 2 identical trees1752 # Start with 2 identical trees
@@ -1788,7 +1788,7 @@
1788 def test_rename_over_deleted(self):1788 def test_rename_over_deleted(self):
1789 tree1 = self.make_branch_and_tree('tree1')1789 tree1 = self.make_branch_and_tree('tree1')
1790 tree2 = self.make_to_branch_and_tree('tree2')1790 tree2 = self.make_to_branch_and_tree('tree2')
1791 root_id = tree1.get_root_id()1791 root_id = tree1.path2id('')
1792 tree2.set_root_id(root_id)1792 tree2.set_root_id(root_id)
17931793
1794 # The final changes should be:1794 # The final changes should be:
@@ -1825,7 +1825,7 @@
1825 """Test a file marked removed, but still present on disk."""1825 """Test a file marked removed, but still present on disk."""
1826 tree1 = self.make_branch_and_tree('tree1')1826 tree1 = self.make_branch_and_tree('tree1')
1827 tree2 = self.make_to_branch_and_tree('tree2')1827 tree2 = self.make_to_branch_and_tree('tree2')
1828 root_id = tree1.get_root_id()1828 root_id = tree1.path2id('')
1829 tree2.set_root_id(root_id)1829 tree2.set_root_id(root_id)
18301830
1831 # The final changes should be:1831 # The final changes should be:
@@ -1863,7 +1863,7 @@
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."""
1864 tree1 = self.make_branch_and_tree('tree1')1864 tree1 = self.make_branch_and_tree('tree1')
1865 tree2 = self.make_to_branch_and_tree('tree2')1865 tree2 = self.make_to_branch_and_tree('tree2')
1866 root_id = tree1.get_root_id()1866 root_id = tree1.path2id('')
1867 tree2.set_root_id(root_id)1867 tree2.set_root_id(root_id)
18681868
1869 # The final changes are:1869 # The final changes are:
@@ -1900,7 +1900,7 @@
1900 """A file was moved on the filesystem, but not in bzr."""1900 """A file was moved on the filesystem, but not in bzr."""
1901 tree1 = self.make_branch_and_tree('tree1')1901 tree1 = self.make_branch_and_tree('tree1')
1902 tree2 = self.make_to_branch_and_tree('tree2')1902 tree2 = self.make_to_branch_and_tree('tree2')
1903 root_id = tree1.get_root_id()1903 root_id = tree1.path2id('')
1904 tree2.set_root_id(root_id)1904 tree2.set_root_id(root_id)
19051905
1906 # The final changes are:1906 # The final changes are:
@@ -1921,7 +1921,7 @@
1921 self.not_applicable_if_missing_in('a', tree2)1921 self.not_applicable_if_missing_in('a', tree2)
19221922
1923 expected = self.sorted([1923 expected = self.sorted([
1924 self.missing(b'a-id', 'a', 'a', tree2.get_root_id(), 'file'),1924 self.missing(b'a-id', 'a', 'a', tree2.path2id(''), 'file'),
1925 self.unversioned(tree2, 'a2'),1925 self.unversioned(tree2, 'a2'),
1926 ])1926 ])
1927 self.assertEqual(expected,1927 self.assertEqual(expected,
19281928
=== modified file 'breezy/tests/per_repository/test_commit_builder.py'
--- breezy/tests/per_repository/test_commit_builder.py 2019-06-16 17:36:59 +0000
+++ breezy/tests/per_repository/test_commit_builder.py 2019-07-25 23:25:31 +0000
@@ -176,7 +176,7 @@
176 builder.finish_inventory()176 builder.finish_inventory()
177 builder.commit('rev')177 builder.commit('rev')
178 builder_tree = builder.revision_tree()178 builder_tree = builder.revision_tree()
179 new_root_id = builder_tree.get_root_id()179 new_root_id = builder_tree.path2id('')
180 new_root_revision = builder_tree.get_file_revision(u'')180 new_root_revision = builder_tree.get_file_revision(u'')
181 if tree.branch.repository.supports_rich_root():181 if tree.branch.repository.supports_rich_root():
182 # We should not have seen a new root revision182 # We should not have seen a new root revision
@@ -332,7 +332,7 @@
332 try:332 try:
333 tree.add_reference(subtree)333 tree.add_reference(subtree)
334 self._commit_check_unchanged(tree, 'reference',334 self._commit_check_unchanged(tree, 'reference',
335 subtree.get_root_id())335 subtree.path2id(''))
336 except errors.UnsupportedOperation:336 except errors.UnsupportedOperation:
337 return337 return
338338
339339
=== modified file 'breezy/tests/per_repository/test_repository.py'
--- breezy/tests/per_repository/test_repository.py 2019-06-26 23:12:10 +0000
+++ breezy/tests/per_repository/test_repository.py 2019-07-25 23:25:31 +0000
@@ -485,7 +485,6 @@
485 rev_tree = tree.branch.repository.revision_tree(tree.last_revision())485 rev_tree = tree.branch.repository.revision_tree(tree.last_revision())
486 rev_tree.lock_read()486 rev_tree.lock_read()
487 self.addCleanup(rev_tree.unlock)487 self.addCleanup(rev_tree.unlock)
488 root_id = rev_tree.get_root_id()
489 self.assertEqual(revid, rev_tree.get_file_revision(u''))488 self.assertEqual(revid, rev_tree.get_file_revision(u''))
490489
491 def test_pointless_commit(self):490 def test_pointless_commit(self):
492491
=== modified file 'breezy/tests/per_repository_vf/test_fileid_involved.py'
--- breezy/tests/per_repository_vf/test_fileid_involved.py 2019-06-17 23:01:58 +0000
+++ breezy/tests/per_repository_vf/test_fileid_involved.py 2019-07-25 23:25:31 +0000
@@ -277,7 +277,7 @@
277 def fileids_altered_by_revision_ids(self, revision_ids):277 def fileids_altered_by_revision_ids(self, revision_ids):
278 """This is a wrapper to strip TREE_ROOT if it occurs"""278 """This is a wrapper to strip TREE_ROOT if it occurs"""
279 repo = self.branch.repository279 repo = self.branch.repository
280 root_id = self.branch.basis_tree().get_root_id()280 root_id = self.branch.basis_tree().path2id('')
281 result = repo.fileids_altered_by_revision_ids(revision_ids)281 result = repo.fileids_altered_by_revision_ids(revision_ids)
282 if root_id in result:282 if root_id in result:
283 del result[root_id]283 del result[root_id]
@@ -352,7 +352,7 @@
352 repo.lock_read()352 repo.lock_read()
353 self.addCleanup(repo.unlock)353 self.addCleanup(repo.unlock)
354 file_ids = repo.fileids_altered_by_revision_ids([revision_id])354 file_ids = repo.fileids_altered_by_revision_ids([revision_id])
355 root_id = main_wt.basis_tree().get_root_id()355 root_id = main_wt.basis_tree().path2id('')
356 if root_id in file_ids:356 if root_id in file_ids:
357 self.assertEqual({file_id: {revision_id},357 self.assertEqual({file_id: {revision_id},
358 root_id: {revision_id}358 root_id: {revision_id}
359359
=== modified file 'breezy/tests/per_repository_vf/test_repository.py'
--- breezy/tests/per_repository_vf/test_repository.py 2019-05-29 03:22:34 +0000
+++ breezy/tests/per_repository_vf/test_repository.py 2019-07-25 23:25:31 +0000
@@ -280,7 +280,7 @@
280 'file_id %r cannot be stored on this'280 'file_id %r cannot be stored on this'
281 ' platform for this repo format' % (file_id,))281 ' platform for this repo format' % (file_id,))
282 if repo._format.rich_root_data:282 if repo._format.rich_root_data:
283 root_commit = (tree.get_root_id(),) + rev_key283 root_commit = (tree.path2id(''),) + rev_key
284 keys = {root_commit}284 keys = {root_commit}
285 parents = {root_commit: ()}285 parents = {root_commit: ()}
286 else:286 else:
287287
=== modified file 'breezy/tests/per_tree/test_get_root_id.py'
--- breezy/tests/per_tree/test_get_root_id.py 2018-11-11 04:08:32 +0000
+++ breezy/tests/per_tree/test_get_root_id.py 2019-07-25 23:25:31 +0000
@@ -14,7 +14,7 @@
14# along with this program; if not, write to the Free Software14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA15# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1616
17"""Tests for Tree.get_root_id()"""17"""Tests for Tree.path2id('')"""
1818
19from breezy.tests.per_tree import TestCaseWithTree19from breezy.tests.per_tree import TestCaseWithTree
2020
@@ -40,9 +40,9 @@
40 def test_get_root_id_default(self):40 def test_get_root_id_default(self):
41 tree = self.make_tree_with_default_root_id()41 tree = self.make_tree_with_default_root_id()
42 with tree.lock_read():42 with tree.lock_read():
43 self.assertIsNot(None, tree.get_root_id())43 self.assertIsNot(None, tree.path2id(''))
4444
45 def test_get_root_id_fixed(self):45 def test_get_root_id_fixed(self):
46 tree = self.make_tree_with_fixed_root_id()46 tree = self.make_tree_with_fixed_root_id()
47 with tree.lock_read():47 with tree.lock_read():
48 self.assertEqual(b'custom-tree-root-id', tree.get_root_id())48 self.assertEqual(b'custom-tree-root-id', tree.path2id(''))
4949
=== modified file 'breezy/tests/per_tree/test_ids.py'
--- breezy/tests/per_tree/test_ids.py 2018-11-11 04:08:32 +0000
+++ breezy/tests/per_tree/test_ids.py 2019-07-25 23:25:31 +0000
@@ -43,7 +43,7 @@
43 self.assertEqual(b'bla-id', self.tree_a.path2id(['bla']))43 self.assertEqual(b'bla-id', self.tree_a.path2id(['bla']))
44 self.assertEqual(b'dir-id', self.tree_a.path2id(['dir']))44 self.assertEqual(b'dir-id', self.tree_a.path2id(['dir']))
45 self.assertEqual(b'file-id', self.tree_a.path2id(['dir', 'file']))45 self.assertEqual(b'file-id', self.tree_a.path2id(['dir', 'file']))
46 self.assertEqual(self.tree_a.get_root_id(),46 self.assertEqual(self.tree_a.path2id(''),
47 self.tree_a.path2id([]))47 self.tree_a.path2id([]))
48 self.assertIs(None, self.tree_a.path2id(['idontexist']))48 self.assertIs(None, self.tree_a.path2id(['idontexist']))
49 self.assertIs(None, self.tree_a.path2id(['dir', 'idontexist']))49 self.assertIs(None, self.tree_a.path2id(['dir', 'idontexist']))
5050
=== modified file 'breezy/tests/per_tree/test_test_trees.py'
--- breezy/tests/per_tree/test_test_trees.py 2018-11-19 23:04:59 +0000
+++ breezy/tests/per_tree/test_test_trees.py 2019-07-25 23:25:31 +0000
@@ -273,7 +273,7 @@
273 b'ba\xe2\x82\xacz-id',273 b'ba\xe2\x82\xacz-id',
274 ]274 ]
275 self.build_tree(paths[1:])275 self.build_tree(paths[1:])
276 if tree.get_root_id() is None:276 if tree.path2id('') is None:
277 # Some trees do not have a root yet.277 # Some trees do not have a root yet.
278 tree.add(paths, file_ids)278 tree.add(paths, file_ids)
279 else:279 else:
280280
=== modified file 'breezy/tests/per_tree/test_tree.py'
--- breezy/tests/per_tree/test_tree.py 2019-06-29 12:29:45 +0000
+++ breezy/tests/per_tree/test_tree.py 2019-07-25 23:25:31 +0000
@@ -120,7 +120,7 @@
120 def test_get_root_id(self):120 def test_get_root_id(self):
121 # trees should return some kind of root id; it can be none121 # trees should return some kind of root id; it can be none
122 tree = self.make_branch_and_tree('tree')122 tree = self.make_branch_and_tree('tree')
123 root_id = tree.get_root_id()123 root_id = tree.path2id('')
124 if root_id is not None:124 if root_id is not None:
125 self.assertIsInstance(root_id, bytes)125 self.assertIsInstance(root_id, bytes)
126126
127127
=== modified file 'breezy/tests/per_workingtree/test_add.py'
--- breezy/tests/per_workingtree/test_add.py 2018-11-11 04:08:32 +0000
+++ breezy/tests/per_workingtree/test_add.py 2019-07-25 23:25:31 +0000
@@ -103,7 +103,7 @@
103 tree.add(['dir'], [b'dir-id'])103 tree.add(['dir'], [b'dir-id'])
104 tree.add(['dir/subdir'], [b'subdir-id'])104 tree.add(['dir/subdir'], [b'subdir-id'])
105 tree.add(['dir/subdir/foo'], [b'foo-id'])105 tree.add(['dir/subdir/foo'], [b'foo-id'])
106 root_id = tree.get_root_id()106 root_id = tree.path2id('')
107107
108 self.assertTreeLayout([('', root_id), ('dir/', b'dir-id'),108 self.assertTreeLayout([('', root_id), ('dir/', b'dir-id'),
109 ('dir/subdir/', b'subdir-id'),109 ('dir/subdir/', b'subdir-id'),
@@ -136,7 +136,7 @@
136 tree.add(['a', 'b', 'dir', 'dir/subdir', 'dir/subdir/foo'],136 tree.add(['a', 'b', 'dir', 'dir/subdir', 'dir/subdir/foo'],
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'])
138138
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'),
140 ('dir/', b'dir-id'), ('dir/subdir/', b'subdir-id'),140 ('dir/', b'dir-id'), ('dir/subdir/', b'subdir-id'),
141 ('dir/subdir/foo', b'foo-id')], tree)141 ('dir/subdir/foo', b'foo-id')], tree)
142142
143143
=== modified file 'breezy/tests/per_workingtree/test_add_reference.py'
--- breezy/tests/per_workingtree/test_add_reference.py 2018-11-16 18:33:17 +0000
+++ breezy/tests/per_workingtree/test_add_reference.py 2019-07-25 23:25:31 +0000
@@ -49,7 +49,7 @@
4949
50 def test_add_reference(self):50 def test_add_reference(self):
51 tree, sub_tree = self.make_nested_trees()51 tree, sub_tree = self.make_nested_trees()
52 sub_tree_root_id = sub_tree.get_root_id()52 sub_tree_root_id = sub_tree.path2id('')
53 with tree.lock_write():53 with tree.lock_write():
54 if tree.supports_setting_file_ids():54 if tree.supports_setting_file_ids():
55 self.assertEqual(tree.path2id('sub-tree'), sub_tree_root_id)55 self.assertEqual(tree.path2id('sub-tree'), sub_tree_root_id)
@@ -101,7 +101,7 @@
101101
102 def test_get_nested_tree(self):102 def test_get_nested_tree(self):
103 tree, sub_tree = self.make_nested_trees()103 tree, sub_tree = self.make_nested_trees()
104 sub_tree_root_id = sub_tree.get_root_id()104 sub_tree_root_id = sub_tree.path2id('')
105 with tree.lock_read():105 with tree.lock_read():
106 sub_tree2 = tree.get_nested_tree('sub-tree')106 sub_tree2 = tree.get_nested_tree('sub-tree')
107 self.assertEqual(sub_tree.basedir, sub_tree2.basedir)107 self.assertEqual(sub_tree.basedir, sub_tree2.basedir)
108108
=== modified file 'breezy/tests/per_workingtree/test_commit.py'
--- breezy/tests/per_workingtree/test_commit.py 2018-11-11 04:08:32 +0000
+++ breezy/tests/per_workingtree/test_commit.py 2019-07-25 23:25:31 +0000
@@ -53,13 +53,10 @@
53 osutils.rmtree('a/dir')53 osutils.rmtree('a/dir')
54 tree_a.commit('autoremoved')54 tree_a.commit('autoremoved')
5555
56 tree_a.lock_read()56 with tree_a.lock_read():
57 try:57 root_id = tree_a.path2id('')
58 root_id = tree_a.get_root_id()
59 paths = [(path, ie.file_id)58 paths = [(path, ie.file_id)
60 for path, ie in tree_a.iter_entries_by_dir()]59 for path, ie in tree_a.iter_entries_by_dir()]
61 finally:
62 tree_a.unlock()
63 # The only paths left should be the root60 # The only paths left should be the root
64 self.assertEqual([('', root_id)], paths)61 self.assertEqual([('', root_id)], paths)
6562
6663
=== modified file 'breezy/tests/per_workingtree/test_flush.py'
--- breezy/tests/per_workingtree/test_flush.py 2018-03-25 00:39:16 +0000
+++ breezy/tests/per_workingtree/test_flush.py 2019-07-25 23:25:31 +0000
@@ -26,11 +26,8 @@
2626
27 def test_flush_fresh_tree(self):27 def test_flush_fresh_tree(self):
28 tree = self.make_branch_and_tree('t1')28 tree = self.make_branch_and_tree('t1')
29 tree.lock_write()29 with tree.lock_write():
30 try:
31 tree.flush()30 tree.flush()
32 finally:
33 tree.unlock()
3431
35 def test_flush_when_inventory_is_modified(self):32 def test_flush_when_inventory_is_modified(self):
36 if sys.platform == "win32":33 if sys.platform == "win32":
@@ -49,30 +46,24 @@
49 tree = self.make_branch_and_tree('tree')46 tree = self.make_branch_and_tree('tree')
50 # prepare for a series of changes that will modify the47 # prepare for a series of changes that will modify the
51 # inventory48 # inventory
52 tree.lock_write()49 with tree.lock_write():
53 try:50 old_root = tree.path2id('')
54 old_root = tree.get_root_id()
55 tree.add('')51 tree.add('')
56 # to detect that the inventory is written by flush, we52 # to detect that the inventory is written by flush, we
57 # first check that it was not written yet.53 # first check that it was not written yet.
58 reference_tree = tree.controldir.open_workingtree()54 reference_tree = tree.controldir.open_workingtree()
59 self.assertEqual(old_root, reference_tree.get_root_id())55 self.assertEqual(old_root, reference_tree.path2id(''))
60 # now flush the tree which should write the inventory.56 # now flush the tree which should write the inventory.
61 tree.flush()57 tree.flush()
62 # and check it was written using another reference tree58 # and check it was written using another reference tree
63 reference_tree = tree.controldir.open_workingtree()59 reference_tree = tree.controldir.open_workingtree()
64 self.assertIsNot(None, reference_tree.get_root_id())60 self.assertIsNot(None, reference_tree.path2id(''))
65 finally:
66 tree.unlock()
6761
68 def test_flush_with_read_lock_fails(self):62 def test_flush_with_read_lock_fails(self):
69 """Flush cannot be used during a read lock."""63 """Flush cannot be used during a read lock."""
70 tree = self.make_branch_and_tree('t1')64 tree = self.make_branch_and_tree('t1')
71 tree.lock_read()65 with tree.lock_read():
72 try:
73 self.assertRaises(errors.NotWriteLocked, tree.flush)66 self.assertRaises(errors.NotWriteLocked, tree.flush)
74 finally:
75 tree.unlock()
7667
77 def test_flush_with_no_lock_fails(self):68 def test_flush_with_no_lock_fails(self):
78 tree = self.make_branch_and_tree('t1')69 tree = self.make_branch_and_tree('t1')
7970
=== modified file 'breezy/tests/per_workingtree/test_inv.py'
--- breezy/tests/per_workingtree/test_inv.py 2018-11-11 04:08:32 +0000
+++ breezy/tests/per_workingtree/test_inv.py 2019-07-25 23:25:31 +0000
@@ -53,7 +53,7 @@
53 wt = self.make_branch_and_tree('.')53 wt = self.make_branch_and_tree('.')
54 wt.lock_write()54 wt.lock_write()
55 self.addCleanup(wt.unlock)55 self.addCleanup(wt.unlock)
56 root_id = wt.get_root_id()56 root_id = wt.path2id('')
57 wt.apply_inventory_delta([(None, 'bar/foo', b'foo-id',57 wt.apply_inventory_delta([(None, 'bar/foo', b'foo-id',
58 inventory.InventoryFile(b'foo-id', 'foo', parent_id=b'bar-id')),58 inventory.InventoryFile(b'foo-id', 'foo', parent_id=b'bar-id')),
59 (None, 'bar', b'bar-id', inventory.InventoryDirectory(b'bar-id',59 (None, 'bar', b'bar-id', inventory.InventoryDirectory(b'bar-id',
@@ -74,7 +74,7 @@
74 def test_rename_dir_with_children(self):74 def test_rename_dir_with_children(self):
75 wt = self.make_branch_and_tree('.')75 wt = self.make_branch_and_tree('.')
76 wt.lock_write()76 wt.lock_write()
77 root_id = wt.get_root_id()77 root_id = wt.path2id('')
78 self.addCleanup(wt.unlock)78 self.addCleanup(wt.unlock)
79 self.build_tree(['foo/', 'foo/bar'])79 self.build_tree(['foo/', 'foo/bar'])
80 wt.add(['foo', 'foo/bar'],80 wt.add(['foo', 'foo/bar'],
@@ -88,7 +88,7 @@
88 def test_rename_dir_with_children_with_children(self):88 def test_rename_dir_with_children_with_children(self):
89 wt = self.make_branch_and_tree('.')89 wt = self.make_branch_and_tree('.')
90 wt.lock_write()90 wt.lock_write()
91 root_id = wt.get_root_id()91 root_id = wt.path2id('')
92 self.addCleanup(wt.unlock)92 self.addCleanup(wt.unlock)
93 self.build_tree(['foo/', 'foo/bar/', 'foo/bar/baz'])93 self.build_tree(['foo/', 'foo/bar/', 'foo/bar/baz'])
94 wt.add(['foo', 'foo/bar', 'foo/bar/baz'],94 wt.add(['foo', 'foo/bar', 'foo/bar/baz'],
@@ -118,7 +118,7 @@
118 """118 """
119 wt = self.make_branch_and_tree('.')119 wt = self.make_branch_and_tree('.')
120 wt.lock_write()120 wt.lock_write()
121 root_id = wt.get_root_id()121 root_id = wt.path2id('')
122 self.addCleanup(wt.unlock)122 self.addCleanup(wt.unlock)
123 self.build_tree(['foo/', 'foo/bar', 'baz/', 'baz/qux'])123 self.build_tree(['foo/', 'foo/bar', 'baz/', 'baz/qux'])
124 wt.add(['foo', 'foo/bar', 'baz', 'baz/qux'],124 wt.add(['foo', 'foo/bar', 'baz', 'baz/qux'],
@@ -137,7 +137,7 @@
137 unable to find the child.)137 unable to find the child.)
138 """138 """
139 wt = self.make_branch_and_tree('.')139 wt = self.make_branch_and_tree('.')
140 root_id = wt.get_root_id()140 root_id = wt.path2id('')
141 self.build_tree(['dir/', 'dir/child', 'other/'])141 self.build_tree(['dir/', 'dir/child', 'other/'])
142 wt.add(['dir', 'dir/child', 'other'],142 wt.add(['dir', 'dir/child', 'other'],
143 [b'dir-id', b'child-id', b'other-id'])143 [b'dir-id', b'child-id', b'other-id'])
@@ -155,7 +155,7 @@
155 wt.lock_write()155 wt.lock_write()
156 self.addCleanup(wt.unlock)156 self.addCleanup(wt.unlock)
157157
158 root_id = wt.get_root_id()158 root_id = wt.path2id('')
159 wt.apply_inventory_delta([('', None, root_id, None),159 wt.apply_inventory_delta([('', None, root_id, None),
160 (None, '', b'root-id',160 (None, '', b'root-id',
161 inventory.InventoryDirectory(b'root-id', '', None))])161 inventory.InventoryDirectory(b'root-id', '', None))])
162162
=== modified file 'breezy/tests/per_workingtree/test_locking.py'
--- breezy/tests/per_workingtree/test_locking.py 2018-03-25 00:39:16 +0000
+++ breezy/tests/per_workingtree/test_locking.py 2019-07-25 23:25:31 +0000
@@ -148,23 +148,23 @@
148 # e.g. mkdir('foo') but all the mutating methods at the148 # e.g. mkdir('foo') but all the mutating methods at the
149 # moment trigger inventory writes and thus will not149 # moment trigger inventory writes and thus will not
150 # let us trigger a read-when-dirty situation.150 # let us trigger a read-when-dirty situation.
151 old_root = tree.get_root_id()151 old_root = tree.path2id('')
152 tree.add('')152 tree.add('')
153 # to detect that the inventory is written by unlock, we153 # to detect that the inventory is written by unlock, we
154 # first check that it was not written yet.154 # first check that it was not written yet.
155 # TODO: This requires taking a read lock while we are holding the above155 # TODO: This requires taking a read lock while we are holding the above
156 # write lock, which shouldn't actually be possible156 # write lock, which shouldn't actually be possible
157 reference_tree = tree.controldir.open_workingtree()157 reference_tree = tree.controldir.open_workingtree()
158 self.assertEqual(old_root, reference_tree.get_root_id())158 self.assertEqual(old_root, reference_tree.path2id(''))
159 # now unlock the second held lock, which should do nothing.159 # now unlock the second held lock, which should do nothing.
160 tree.unlock()160 tree.unlock()
161 reference_tree = tree.controldir.open_workingtree()161 reference_tree = tree.controldir.open_workingtree()
162 self.assertEqual(old_root, reference_tree.get_root_id())162 self.assertEqual(old_root, reference_tree.path2id(''))
163 # unlocking the first lock we took will now flush.163 # unlocking the first lock we took will now flush.
164 tree.unlock()164 tree.unlock()
165 # and check it was written using another reference tree165 # and check it was written using another reference tree
166 reference_tree = tree.controldir.open_workingtree()166 reference_tree = tree.controldir.open_workingtree()
167 self.assertIsNot(None, reference_tree.get_root_id())167 self.assertIsNot(None, reference_tree.path2id(''))
168168
169 def test_unlock_from_tree_write_lock_flushes(self):169 def test_unlock_from_tree_write_lock_flushes(self):
170 self._test_unlock_with_lock_method("lock_tree_write")170 self._test_unlock_with_lock_method("lock_tree_write")
171171
=== modified file 'breezy/tests/per_workingtree/test_merge_from_branch.py'
--- breezy/tests/per_workingtree/test_merge_from_branch.py 2019-06-17 19:04:30 +0000
+++ breezy/tests/per_workingtree/test_merge_from_branch.py 2019-07-25 23:25:31 +0000
@@ -166,7 +166,7 @@
166 inner, to_revision=revs[0], from_revision=b'null:')166 inner, to_revision=revs[0], from_revision=b'null:')
167 # retain original root id.167 # retain original root id.
168 if outer.supports_setting_file_ids():168 if outer.supports_setting_file_ids():
169 outer.set_root_id(outer.basis_tree().get_root_id())169 outer.set_root_id(outer.basis_tree().path2id(''))
170 outer.commit('merge inner branch')170 outer.commit('merge inner branch')
171 outer.mkdir('dir-outer')171 outer.mkdir('dir-outer')
172 outer.move(['dir', 'file3'], to_dir='dir-outer')172 outer.move(['dir', 'file3'], to_dir='dir-outer')
173173
=== modified file 'breezy/tests/per_workingtree/test_pull.py'
--- breezy/tests/per_workingtree/test_pull.py 2018-11-11 04:08:32 +0000
+++ breezy/tests/per_workingtree/test_pull.py 2019-07-25 23:25:31 +0000
@@ -33,9 +33,9 @@
3333
34 def test_pull_null(self):34 def test_pull_null(self):
35 tree_a, tree_b, rev_a = self.get_pullable_trees()35 tree_a, tree_b, rev_a = self.get_pullable_trees()
36 root_id = tree_a.get_root_id()36 root_id = tree_a.path2id('')
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)
38 self.assertEqual(root_id, tree_a.get_root_id())38 self.assertEqual(root_id, tree_a.path2id(''))
3939
40 def test_pull(self):40 def test_pull(self):
41 tree_a, tree_b, rev_a = self.get_pullable_trees()41 tree_a, tree_b, rev_a = self.get_pullable_trees()
@@ -66,11 +66,11 @@
66 tree.add(['file'])66 tree.add(['file'])
67 tree.commit('first')67 tree.commit('first')
68 to_tree = tree.controldir.sprout('to').open_workingtree()68 to_tree = tree.controldir.sprout('to').open_workingtree()
69 self.assertEqual(b'first_root_id', to_tree.get_root_id())69 self.assertEqual(b'first_root_id', to_tree.path2id(''))
70 tree.set_root_id(b'second_root_id')70 tree.set_root_id(b'second_root_id')
71 tree.commit('second')71 tree.commit('second')
72 to_tree.pull(tree.branch)72 to_tree.pull(tree.branch)
73 self.assertEqual(b'second_root_id', to_tree.get_root_id())73 self.assertEqual(b'second_root_id', to_tree.path2id(''))
7474
7575
76class TestPullWithOrphans(per_workingtree.TestCaseWithWorkingTree):76class TestPullWithOrphans(per_workingtree.TestCaseWithWorkingTree):
7777
=== modified file 'breezy/tests/per_workingtree/test_rename_one.py'
--- breezy/tests/per_workingtree/test_rename_one.py 2018-11-11 04:08:32 +0000
+++ breezy/tests/per_workingtree/test_rename_one.py 2019-07-25 23:25:31 +0000
@@ -342,7 +342,6 @@
342 self.build_tree(['a/', 'a/b', 'c/'])342 self.build_tree(['a/', 'a/b', 'c/'])
343 tree.add(['a', 'a/b', 'c'])343 tree.add(['a', 'a/b', 'c'])
344 tree.commit('initial')344 tree.commit('initial')
345 root_id = tree.get_root_id()
346345
347 tree.rename_one('a/b', 'c/foo')346 tree.rename_one('a/b', 'c/foo')
348 self.assertPathRelations(347 self.assertPathRelations(
349348
=== modified file 'breezy/tests/per_workingtree/test_set_root_id.py'
--- breezy/tests/per_workingtree/test_set_root_id.py 2018-02-18 15:21:06 +0000
+++ breezy/tests/per_workingtree/test_set_root_id.py 2019-07-25 23:25:31 +0000
@@ -36,25 +36,22 @@
36 self.skipTest('format does not support setting file ids')36 self.skipTest('format does not support setting file ids')
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.
38 root_id = u'\xe5n-id'.encode('utf8')38 root_id = u'\xe5n-id'.encode('utf8')
39 tree.lock_write()39 with tree.lock_write():
40 try:40 old_id = tree.path2id('')
41 old_id = tree.get_root_id()
42 tree.set_root_id(root_id)41 tree.set_root_id(root_id)
43 self.assertEqual(root_id, tree.get_root_id())42 self.assertEqual(root_id, tree.path2id(''))
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,
45 # so check a new tree sees the old state.44 # so check a new tree sees the old state.
46 reference_tree = tree.controldir.open_workingtree()45 reference_tree = tree.controldir.open_workingtree()
47 self.assertEqual(old_id, reference_tree.get_root_id())46 self.assertEqual(old_id, reference_tree.path2id(''))
48 finally:
49 tree.unlock()
50 # having unlocked the tree, the value should have been47 # having unlocked the tree, the value should have been
51 # preserved into the next lock, which is an implicit read48 # preserved into the next lock, which is an implicit read
52 # lock around the get_root_id call.49 # lock around the get_root_id call.
53 self.assertEqual(root_id, tree.get_root_id())50 self.assertEqual(root_id, tree.path2id(''))
54 # and if we get a new working tree instance, then the value51 # and if we get a new working tree instance, then the value
55 # should still be retained52 # should still be retained
56 tree = tree.controldir.open_workingtree()53 tree = tree.controldir.open_workingtree()
57 self.assertEqual(root_id, tree.get_root_id())54 self.assertEqual(root_id, tree.path2id(''))
58 tree._validate()55 tree._validate()
5956
60 def test_set_root_id(self):57 def test_set_root_id(self):
@@ -63,12 +60,12 @@
63 self.skipTest('format does not support setting file ids')60 self.skipTest('format does not support setting file ids')
64 tree.lock_write()61 tree.lock_write()
65 self.addCleanup(tree.unlock)62 self.addCleanup(tree.unlock)
66 orig_root_id = tree.get_root_id()63 orig_root_id = tree.path2id('')
67 self.assertNotEqual(b'custom-root-id', orig_root_id)64 self.assertNotEqual(b'custom-root-id', orig_root_id)
68 self.assertEqual('', tree.id2path(orig_root_id))65 self.assertEqual('', tree.id2path(orig_root_id))
69 self.assertRaises(errors.NoSuchId, tree.id2path, 'custom-root-id')66 self.assertRaises(errors.NoSuchId, tree.id2path, 'custom-root-id')
70 tree.set_root_id(b'custom-root-id')67 tree.set_root_id(b'custom-root-id')
71 self.assertEqual(b'custom-root-id', tree.get_root_id())68 self.assertEqual(b'custom-root-id', tree.path2id(''))
72 self.assertEqual(b'custom-root-id', tree.path2id(''))69 self.assertEqual(b'custom-root-id', tree.path2id(''))
73 self.assertEqual('', tree.id2path(b'custom-root-id'))70 self.assertEqual('', tree.id2path(b'custom-root-id'))
74 self.assertRaises(errors.NoSuchId, tree.id2path, orig_root_id)71 self.assertRaises(errors.NoSuchId, tree.id2path, orig_root_id)
7572
=== modified file 'breezy/tests/per_workingtree/test_workingtree.py'
--- breezy/tests/per_workingtree/test_workingtree.py 2019-06-22 10:30:21 +0000
+++ breezy/tests/per_workingtree/test_workingtree.py 2019-07-25 23:25:31 +0000
@@ -575,8 +575,8 @@
575 # and update checkout575 # and update checkout
576 self.assertEqual(0, checkout.update())576 self.assertEqual(0, checkout.update())
577 self.assertPathExists('checkout/file')577 self.assertPathExists('checkout/file')
578 self.assertEqual(wt.get_root_id(), checkout.get_root_id())578 self.assertEqual(wt.path2id(''), checkout.path2id(''))
579 self.assertNotEqual(None, wt.get_root_id())579 self.assertNotEqual(None, wt.path2id(''))
580580
581 def test_update_sets_updated_root_id(self):581 def test_update_sets_updated_root_id(self):
582 wt = self.make_branch_and_tree('tree')582 wt = self.make_branch_and_tree('tree')
@@ -585,16 +585,16 @@
585 'first_root_id')585 'first_root_id')
586 return586 return
587 wt.set_root_id(b'first_root_id')587 wt.set_root_id(b'first_root_id')
588 self.assertEqual(b'first_root_id', wt.get_root_id())588 self.assertEqual(b'first_root_id', wt.path2id(''))
589 self.build_tree(['tree/file'])589 self.build_tree(['tree/file'])
590 wt.add(['file'])590 wt.add(['file'])
591 wt.commit('first')591 wt.commit('first')
592 co = wt.branch.create_checkout('checkout')592 co = wt.branch.create_checkout('checkout')
593 wt.set_root_id(b'second_root_id')593 wt.set_root_id(b'second_root_id')
594 wt.commit('second')594 wt.commit('second')
595 self.assertEqual(b'second_root_id', wt.get_root_id())595 self.assertEqual(b'second_root_id', wt.path2id(''))
596 self.assertEqual(0, co.update())596 self.assertEqual(0, co.update())
597 self.assertEqual(b'second_root_id', co.get_root_id())597 self.assertEqual(b'second_root_id', co.path2id(''))
598598
599 def test_update_returns_conflict_count(self):599 def test_update_returns_conflict_count(self):
600 # working tree formats from the meta-dir format and newer support600 # working tree formats from the meta-dir format and newer support
@@ -920,7 +920,7 @@
920 # if we write write an inventory then do a walkdirs we should get back920 # if we write write an inventory then do a walkdirs we should get back
921 # missing entries, and actual, and unknowns as appropriate.921 # missing entries, and actual, and unknowns as appropriate.
922 self.build_tree(['present', 'unknown'])922 self.build_tree(['present', 'unknown'])
923 inventory = Inventory(tree.get_root_id())923 inventory = Inventory(tree.path2id(''))
924 inventory.add_path('missing', 'file', b'missing-id')924 inventory.add_path('missing', 'file', b'missing-id')
925 inventory.add_path('present', 'file', b'present-id')925 inventory.add_path('present', 'file', b'present-id')
926 # there is no point in being able to write an inventory to an unlocked926 # there is no point in being able to write an inventory to an unlocked
@@ -932,7 +932,7 @@
932 present_stat = os.lstat('present')932 present_stat = os.lstat('present')
933 unknown_stat = os.lstat('unknown')933 unknown_stat = os.lstat('unknown')
934 expected_results = [934 expected_results = [
935 (('', tree.get_root_id()),935 (('', tree.path2id('')),
936 [('missing', 'missing', 'unknown', None, b'missing-id', 'file'),936 [('missing', 'missing', 'unknown', None, b'missing-id', 'file'),
937 ('present', 'present', 'file',937 ('present', 'present', 'file',
938 present_stat, b'present-id', 'file'),938 present_stat, b'present-id', 'file'),
939939
=== modified file 'breezy/tests/test__dirstate_helpers.py'
--- breezy/tests/test__dirstate_helpers.py 2019-06-15 12:04:34 +0000
+++ breezy/tests/test__dirstate_helpers.py 2019-07-25 23:25:31 +0000
@@ -1326,7 +1326,7 @@
1326 tree = self.make_branch_and_tree('tree')1326 tree = self.make_branch_and_tree('tree')
1327 self.build_tree(['tree/file'])1327 self.build_tree(['tree/file'])
1328 tree.add(['file'], [b'file-id'])1328 tree.add(['file'], [b'file-id'])
1329 self.assertChangedFileIds([tree.get_root_id(), b'file-id'], tree)1329 self.assertChangedFileIds([tree.path2id(''), b'file-id'], tree)
1330 tree.commit('one')1330 tree.commit('one')
1331 self.assertChangedFileIds([], tree)1331 self.assertChangedFileIds([], tree)
13321332
13331333
=== modified file 'breezy/tests/test_commit_merge.py'
--- breezy/tests/test_commit_merge.py 2018-11-11 04:08:32 +0000
+++ breezy/tests/test_commit_merge.py 2019-07-25 23:25:31 +0000
@@ -76,7 +76,7 @@
76 bx = wtx.branch76 bx = wtx.branch
77 wtx.commit('establish root id')77 wtx.commit('establish root id')
78 wty = wtx.controldir.sprout('y').open_workingtree()78 wty = wtx.controldir.sprout('y').open_workingtree()
79 self.assertEqual(wtx.get_root_id(), wty.get_root_id())79 self.assertEqual(wtx.path2id(''), wty.path2id(''))
80 by = wty.branch80 by = wty.branch
8181
82 self.build_tree(['x/ecks', 'y/why'])82 self.build_tree(['x/ecks', 'y/why'])
8383
=== modified file 'breezy/tests/test_dirstate.py'
--- breezy/tests/test_dirstate.py 2019-06-03 22:25:41 +0000
+++ breezy/tests/test_dirstate.py 2019-07-25 23:25:31 +0000
@@ -394,7 +394,7 @@
394 # There are no files on disk and no parents394 # There are no files on disk and no parents
395 tree = self.make_branch_and_tree('tree')395 tree = self.make_branch_and_tree('tree')
396 expected_result = ([], [396 expected_result = ([], [
397 ((b'', b'', tree.get_root_id()), # common details397 ((b'', b'', tree.path2id('')), # common details
398 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree398 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree
399 ])])399 ])])
400 state = dirstate.DirState.from_tree(tree, 'dirstate')400 state = dirstate.DirState.from_tree(tree, 'dirstate')
@@ -407,7 +407,7 @@
407 rev_id = tree.commit('first post')407 rev_id = tree.commit('first post')
408 root_stat_pack = dirstate.pack_stat(os.stat(tree.basedir))408 root_stat_pack = dirstate.pack_stat(os.stat(tree.basedir))
409 expected_result = ([rev_id], [409 expected_result = ([rev_id], [
410 ((b'', b'', tree.get_root_id()), # common details410 ((b'', b'', tree.path2id('')), # common details
411 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree411 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree
412 (b'd', b'', 0, False, rev_id), # first parent details412 (b'd', b'', 0, False, rev_id), # first parent details
413 ])])413 ])])
@@ -427,7 +427,7 @@
427 rev_id2 = tree2.commit('second post', allow_pointless=True)427 rev_id2 = tree2.commit('second post', allow_pointless=True)
428 tree.merge_from_branch(tree2.branch)428 tree.merge_from_branch(tree2.branch)
429 expected_result = ([rev_id, rev_id2], [429 expected_result = ([rev_id, rev_id2], [
430 ((b'', b'', tree.get_root_id()), # common details430 ((b'', b'', tree.path2id('')), # common details
431 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree431 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree
432 (b'd', b'', 0, False, rev_id), # first parent details432 (b'd', b'', 0, False, rev_id), # first parent details
433 (b'd', b'', 0, False, rev_id), # second parent details433 (b'd', b'', 0, False, rev_id), # second parent details
@@ -446,7 +446,7 @@
446 tree = self.make_branch_and_tree('tree')446 tree = self.make_branch_and_tree('tree')
447 self.build_tree(['tree/unknown'])447 self.build_tree(['tree/unknown'])
448 expected_result = ([], [448 expected_result = ([], [
449 ((b'', b'', tree.get_root_id()), # common details449 ((b'', b'', tree.path2id('')), # common details
450 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree450 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree
451 ])])451 ])])
452 state = dirstate.DirState.from_tree(tree, 'dirstate')452 state = dirstate.DirState.from_tree(tree, 'dirstate')
@@ -463,7 +463,7 @@
463 # There are files on disk and no parents463 # There are files on disk and no parents
464 tree = self.get_tree_with_a_file()464 tree = self.get_tree_with_a_file()
465 expected_result = ([], [465 expected_result = ([], [
466 ((b'', b'', tree.get_root_id()), # common details466 ((b'', b'', tree.path2id('')), # common details
467 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree467 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree
468 ]),468 ]),
469 ((b'', b'a file', b'a-file-id'), # common469 ((b'', b'a file', b'a-file-id'), # common
@@ -481,7 +481,7 @@
481 # and length:481 # and length:
482 self.build_tree_contents([('tree/a file', b'new content\n')])482 self.build_tree_contents([('tree/a file', b'new content\n')])
483 expected_result = ([rev_id], [483 expected_result = ([rev_id], [
484 ((b'', b'', tree.get_root_id()), # common details484 ((b'', b'', tree.path2id('')), # common details
485 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree485 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree
486 (b'd', b'', 0, False, rev_id), # first parent details486 (b'd', b'', 0, False, rev_id), # first parent details
487 ]),487 ]),
@@ -508,7 +508,7 @@
508 # and length again, giving us three distinct values:508 # and length again, giving us three distinct values:
509 self.build_tree_contents([('tree/a file', b'new content\n')])509 self.build_tree_contents([('tree/a file', b'new content\n')])
510 expected_result = ([rev_id, rev_id2], [510 expected_result = ([rev_id, rev_id2], [
511 ((b'', b'', tree.get_root_id()), # common details511 ((b'', b'', tree.path2id('')), # common details
512 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree512 [(b'd', b'', 0, False, dirstate.DirState.NULLSTAT), # current tree
513 (b'd', b'', 0, False, rev_id), # first parent details513 (b'd', b'', 0, False, rev_id), # first parent details
514 (b'd', b'', 0, False, rev_id), # second parent details514 (b'd', b'', 0, False, rev_id), # second parent details
@@ -573,7 +573,7 @@
573 # get a state object573 # get a state object
574 # no parents, default tree content574 # no parents, default tree content
575 expected_result = ([], [575 expected_result = ([], [
576 ((b'', b'', tree.get_root_id()), # common details576 ((b'', b'', tree.path2id('')), # common details
577 # current tree details, but new from_tree skips statting, it577 # current tree details, but new from_tree skips statting, it
578 # uses set_state_from_inventory, and thus depends on the578 # uses set_state_from_inventory, and thus depends on the
579 # inventory state.579 # inventory state.
@@ -899,7 +899,7 @@
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'],
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'])
901 tree1.commit('rev1', rev_id=b'rev1')901 tree1.commit('rev1', rev_id=b'rev1')
902 root_id = tree1.get_root_id()902 root_id = tree1.path2id('')
903 inv = tree1.root_inventory903 inv = tree1.root_inventory
904 finally:904 finally:
905 tree1.unlock()905 tree1.unlock()
@@ -1045,7 +1045,7 @@
1045 tree2.lock_write()1045 tree2.lock_write()
1046 try:1046 try:
1047 revid2 = tree2.commit('foo')1047 revid2 = tree2.commit('foo')
1048 root_id = tree2.get_root_id()1048 root_id = tree2.path2id('')
1049 finally:1049 finally:
1050 tree2.unlock()1050 tree2.unlock()
1051 state = dirstate.DirState.initialize('dirstate')1051 state = dirstate.DirState.initialize('dirstate')
@@ -1116,7 +1116,7 @@
1116 try:1116 try:
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')
1118 revid2 = tree2.commit('foo')1118 revid2 = tree2.commit('foo')
1119 root_id = tree2.get_root_id()1119 root_id = tree2.path2id('')
1120 finally:1120 finally:
1121 tree2.unlock()1121 tree2.unlock()
1122 # check the layout in memory1122 # check the layout in memory
@@ -1337,10 +1337,9 @@
1337 # incorrect absent in tree 1, and future changes go to pot.1337 # incorrect absent in tree 1, and future changes go to pot.
1338 tree1 = self.make_branch_and_tree('tree1')1338 tree1 = self.make_branch_and_tree('tree1')
1339 self.build_tree(['tree1/b'])1339 self.build_tree(['tree1/b'])
1340 tree1.lock_write()1340 with tree1.lock_write():
1341 try:
1342 tree1.add(['b'], [b'b-id'])1341 tree1.add(['b'], [b'b-id'])
1343 root_id = tree1.get_root_id()1342 root_id = tree1.path2id('')
1344 inv = tree1.root_inventory1343 inv = tree1.root_inventory
1345 state = dirstate.DirState.initialize('dirstate')1344 state = dirstate.DirState.initialize('dirstate')
1346 try:1345 try:
@@ -1358,8 +1357,6 @@
1358 self.assertEqual(expected_result1, values)1357 self.assertEqual(expected_result1, values)
1359 finally:1358 finally:
1360 state.unlock()1359 state.unlock()
1361 finally:
1362 tree1.unlock()
13631360
13641361
1365class TestDirStateHashUpdates(TestCaseWithDirState):1362class TestDirStateHashUpdates(TestCaseWithDirState):
13661363
=== modified file 'breezy/tests/test_extract.py'
--- breezy/tests/test_extract.py 2018-11-16 18:33:17 +0000
+++ breezy/tests/test_extract.py 2019-07-25 23:25:31 +0000
@@ -29,7 +29,7 @@
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'])
30 wt.commit('added files')30 wt.commit('added files')
31 b_wt = wt.extract('b')31 b_wt = wt.extract('b')
32 self.assertEqual(b'b-id', b_wt.get_root_id())32 self.assertEqual(b'b-id', b_wt.path2id(''))
33 self.assertEqual(b'c-id', b_wt.path2id('c'))33 self.assertEqual(b'c-id', b_wt.path2id('c'))
34 self.assertEqual('c', b_wt.id2path(b'c-id'))34 self.assertEqual('c', b_wt.id2path(b'c-id'))
35 self.assertRaises(errors.BzrError, wt.id2path, b'b-id')35 self.assertRaises(errors.BzrError, wt.id2path, b'b-id')
3636
=== modified file 'breezy/tests/test_fetch.py'
--- breezy/tests/test_fetch.py 2018-11-11 04:08:32 +0000
+++ breezy/tests/test_fetch.py 2019-07-25 23:25:31 +0000
@@ -498,7 +498,7 @@
498 self.tree.add_parent_tree_id(b'not-ghost-parent')498 self.tree.add_parent_tree_id(b'not-ghost-parent')
499 self.tree.commit('second commit', rev_id=b'second-id')499 self.tree.commit('second commit', rev_id=b'second-id')
500 self.repo.fetch(self.tree.branch.repository, b'second-id')500 self.repo.fetch(self.tree.branch.repository, b'second-id')
501 root_id = self.tree.get_root_id()501 root_id = self.tree.path2id('')
502 self.assertEqual(502 self.assertEqual(
503 ((root_id, b'left-parent'), (root_id, b'not-ghost-parent')),503 ((root_id, b'left-parent'), (root_id, b'not-ghost-parent')),
504 self.get_parents(root_id, b'second-id'))504 self.get_parents(root_id, b'second-id'))
505505
=== modified file 'breezy/tests/test_matchers.py'
--- breezy/tests/test_matchers.py 2018-11-11 04:08:32 +0000
+++ breezy/tests/test_matchers.py 2019-07-25 23:25:31 +0000
@@ -122,7 +122,7 @@
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'])
123 self.assertThat(t, HasLayout(['', 'a', 'b/', 'b/c']))123 self.assertThat(t, HasLayout(['', 'a', 'b/', 'b/c']))
124 self.assertThat(t, HasLayout(124 self.assertThat(t, HasLayout(
125 [('', t.get_root_id()),125 [('', t.path2id('')),
126 ('a', b'a-id'),126 ('a', b'a-id'),
127 ('b/', b'b-id'),127 ('b/', b'b-id'),
128 ('b/c', b'c-id')]))128 ('b/c', b'c-id')]))
129129
=== modified file 'breezy/tests/test_memorytree.py'
--- breezy/tests/test_memorytree.py 2019-02-16 21:12:42 +0000
+++ breezy/tests/test_memorytree.py 2019-07-25 23:25:31 +0000
@@ -56,7 +56,7 @@
56 tree = MemoryTree.create_on_branch(branch)56 tree = MemoryTree.create_on_branch(branch)
57 with tree.lock_write():57 with tree.lock_write():
58 tree.add([''])58 tree.add([''])
59 self.assertIsNot(None, tree.get_root_id())59 self.assertIsNot(None, tree.path2id(''))
6060
61 def test_lock_tree_write(self):61 def test_lock_tree_write(self):
62 """Check we can lock_tree_write and unlock MemoryTrees."""62 """Check we can lock_tree_write and unlock MemoryTrees."""
6363
=== modified file 'breezy/tests/test_merge.py'
--- breezy/tests/test_merge.py 2019-06-18 00:20:56 +0000
+++ breezy/tests/test_merge.py 2019-07-25 23:25:31 +0000
@@ -137,7 +137,7 @@
137 with merger.make_preview_transform() as tt:137 with merger.make_preview_transform() as tt:
138 self.assertEqual([], tt.find_conflicts())138 self.assertEqual([], tt.find_conflicts())
139 preview = tt.get_preview_tree()139 preview = tt.get_preview_tree()
140 self.assertEqual(wt.get_root_id(), preview.get_root_id())140 self.assertEqual(wt.path2id(''), preview.path2id(''))
141141
142 def test_merge_unrelated_retains_root(self):142 def test_merge_unrelated_retains_root(self):
143 wt = self.make_branch_and_tree('tree')143 wt = self.make_branch_and_tree('tree')
@@ -149,7 +149,7 @@
149 with transform.TransformPreview(wt) as merger.tt:149 with transform.TransformPreview(wt) as merger.tt:
150 merger._compute_transform()150 merger._compute_transform()
151 new_root_id = merger.tt.final_file_id(merger.tt.root)151 new_root_id = merger.tt.final_file_id(merger.tt.root)
152 self.assertEqual(wt.get_root_id(), new_root_id)152 self.assertEqual(wt.path2id(''), new_root_id)
153153
154 def test_create_rename(self):154 def test_create_rename(self):
155 """Rename an inventory entry while creating the file"""155 """Rename an inventory entry while creating the file"""
@@ -511,7 +511,7 @@
511 self.build_tree(['a'])511 self.build_tree(['a'])
512 tree.add('a')512 tree.add('a')
513 first_rev = tree.commit("added a")513 first_rev = tree.commit("added a")
514 old_root_id = tree.get_root_id()514 old_root_id = tree.path2id('')
515 merger = _mod_merge.Merger.from_revision_ids(tree,515 merger = _mod_merge.Merger.from_revision_ids(tree,
516 _mod_revision.NULL_REVISION,516 _mod_revision.NULL_REVISION,
517 first_rev)517 first_rev)
518518
=== modified file 'breezy/tests/test_revert.py'
--- breezy/tests/test_revert.py 2019-06-22 10:30:21 +0000
+++ breezy/tests/test_revert.py 2019-07-25 23:25:31 +0000
@@ -159,6 +159,6 @@
159 tree.add(['file1'])159 tree.add(['file1'])
160 tree.commit('first')160 tree.commit('first')
161 tree.set_root_id(b'temp-root-id')161 tree.set_root_id(b'temp-root-id')
162 self.assertEqual(b'temp-root-id', tree.get_root_id())162 self.assertEqual(b'temp-root-id', tree.path2id(''))
163 tree.revert()163 tree.revert()
164 self.assertEqual(b'initial-root-id', tree.get_root_id())164 self.assertEqual(b'initial-root-id', tree.path2id(''))
165165
=== modified file 'breezy/tests/test_revisiontree.py'
--- breezy/tests/test_revisiontree.py 2018-11-16 18:33:17 +0000
+++ breezy/tests/test_revisiontree.py 2019-07-25 23:25:31 +0000
@@ -58,7 +58,7 @@
58 def test_empty_no_root(self):58 def test_empty_no_root(self):
59 null_tree = self.t.branch.repository.revision_tree(59 null_tree = self.t.branch.repository.revision_tree(
60 revision.NULL_REVISION)60 revision.NULL_REVISION)
61 self.assertIs(None, null_tree.get_root_id())61 self.assertIs(None, null_tree.path2id(''))
6262
63 def test_get_file_revision_root(self):63 def test_get_file_revision_root(self):
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''))
6565
=== modified file 'breezy/tests/test_shelf_ui.py'
--- breezy/tests/test_shelf_ui.py 2018-11-12 01:41:38 +0000
+++ breezy/tests/test_shelf_ui.py 2019-07-25 23:25:31 +0000
@@ -302,14 +302,14 @@
302 def test_shelve_old_root_preserved(self):302 def test_shelve_old_root_preserved(self):
303 tree1 = self.make_branch_and_tree('tree1')303 tree1 = self.make_branch_and_tree('tree1')
304 tree1.commit('add root')304 tree1.commit('add root')
305 tree1_root_id = tree1.get_root_id()305 tree1_root_id = tree1.path2id('')
306 tree2 = self.make_branch_and_tree('tree2')306 tree2 = self.make_branch_and_tree('tree2')
307 rev2 = tree2.commit('add root')307 rev2 = tree2.commit('add root')
308 self.assertNotEqual(tree1_root_id, tree2.get_root_id())308 self.assertNotEqual(tree1_root_id, tree2.path2id(''))
309 tree1.merge_from_branch(tree2.branch,309 tree1.merge_from_branch(tree2.branch,
310 from_revision=revision.NULL_REVISION)310 from_revision=revision.NULL_REVISION)
311 tree1.commit('merging in tree2')311 tree1.commit('merging in tree2')
312 self.assertEqual(tree1_root_id, tree1.get_root_id())312 self.assertEqual(tree1_root_id, tree1.path2id(''))
313 # This is essentially assertNotRaises(InconsistentDelta)313 # This is essentially assertNotRaises(InconsistentDelta)
314 # With testtools 0.9.9, it can be rewritten as:314 # With testtools 0.9.9, it can be rewritten as:
315 # with ExpectedException(AssertionError,315 # with ExpectedException(AssertionError,
316316
=== modified file 'breezy/tests/test_smart_add.py'
--- breezy/tests/test_smart_add.py 2018-11-12 01:41:38 +0000
+++ breezy/tests/test_smart_add.py 2019-07-25 23:25:31 +0000
@@ -92,7 +92,7 @@
9292
93 self.build_tree(['new/a', 'new/b', 'new/c',93 self.build_tree(['new/a', 'new/b', 'new/c',
94 'new/subdir/', 'new/subdir/b', 'new/subdir/d'])94 'new/subdir/', 'new/subdir/b', 'new/subdir/d'])
95 new_tree.set_root_id(self.base_tree.get_root_id())95 new_tree.set_root_id(self.base_tree.path2id(''))
96 self.add_helper(self.base_tree, 'dir', new_tree, ['new'])96 self.add_helper(self.base_tree, 'dir', new_tree, ['new'])
9797
98 # We know 'a' and 'b' exist in the root, and they are being added98 # We know 'a' and 'b' exist in the root, and they are being added
9999
=== modified file 'breezy/tests/test_subsume.py'
--- breezy/tests/test_subsume.py 2018-11-16 18:33:17 +0000
+++ breezy/tests/test_subsume.py 2019-07-25 23:25:31 +0000
@@ -36,7 +36,7 @@
36 sub_tree = self.make_branch_and_tree('tree/subtree',36 sub_tree = self.make_branch_and_tree('tree/subtree',
37 format='development-subtree')37 format='development-subtree')
38 if same_root is True:38 if same_root is True:
39 sub_tree.set_root_id(base_tree.get_root_id())39 sub_tree.set_root_id(base_tree.path2id(''))
40 sub_tree.add('file2', b'file2-id')40 sub_tree.add('file2', b'file2-id')
41 sub_tree.commit('first commit', rev_id=b'subtree-1')41 sub_tree.commit('first commit', rev_id=b'subtree-1')
42 return base_tree, sub_tree42 return base_tree, sub_tree
@@ -59,8 +59,8 @@
5959
60 def test_subsume_tree(self):60 def test_subsume_tree(self):
61 base_tree, sub_tree = self.make_trees()61 base_tree, sub_tree = self.make_trees()
62 self.assertNotEqual(base_tree.get_root_id(), sub_tree.get_root_id())62 self.assertNotEqual(base_tree.path2id(''), sub_tree.path2id(''))
63 sub_root_id = sub_tree.get_root_id()63 sub_root_id = sub_tree.path2id('')
64 # this test checks the subdir is removed, so it needs to know the64 # this test checks the subdir is removed, so it needs to know the
65 # control directory; that changes rarely so just hardcode (and check)65 # control directory; that changes rarely so just hardcode (and check)
66 # it is correct.66 # it is correct.
@@ -94,7 +94,7 @@
9494
95 def test_subsume_failure(self):95 def test_subsume_failure(self):
96 base_tree, sub_tree = self.make_trees()96 base_tree, sub_tree = self.make_trees()
97 if base_tree.get_root_id() == sub_tree.get_root_id():97 if base_tree.path2id('') == sub_tree.path2id(''):
98 raise tests.TestSkipped('This test requires unique roots')98 raise tests.TestSkipped('This test requires unique roots')
99 self.assertRaises(errors.BadSubsumeSource, base_tree.subsume,99 self.assertRaises(errors.BadSubsumeSource, base_tree.subsume,
100 base_tree)100 base_tree)
101101
=== modified file 'breezy/tests/test_switch.py'
--- breezy/tests/test_switch.py 2018-11-12 01:41:38 +0000
+++ breezy/tests/test_switch.py 2019-07-25 23:25:31 +0000
@@ -179,7 +179,7 @@
179 checkout = tree.branch.create_checkout('checkout',179 checkout = tree.branch.create_checkout('checkout',
180 lightweight=self.lightweight)180 lightweight=self.lightweight)
181 switch.switch(checkout.controldir, tree2.branch)181 switch.switch(checkout.controldir, tree2.branch)
182 self.assertEqual(b'custom-root-id', tree2.get_root_id())182 self.assertEqual(b'custom-root-id', tree2.path2id(''))
183183
184 def test_switch_configurable_file_merger(self):184 def test_switch_configurable_file_merger(self):
185 class DummyMerger(_mod_merge.ConfigurableFileMerger):185 class DummyMerger(_mod_merge.ConfigurableFileMerger):
186186
=== modified file 'breezy/tests/test_transform.py'
--- breezy/tests/test_transform.py 2019-06-22 12:07:42 +0000
+++ breezy/tests/test_transform.py 2019-07-25 23:25:31 +0000
@@ -147,7 +147,7 @@
147 self.assertEqual(imaginary_id, imaginary_id2)147 self.assertEqual(imaginary_id, imaginary_id2)
148 self.assertEqual(root, transform.get_tree_parent(imaginary_id))148 self.assertEqual(root, transform.get_tree_parent(imaginary_id))
149 self.assertEqual('directory', transform.final_kind(root))149 self.assertEqual('directory', transform.final_kind(root))
150 self.assertEqual(self.wt.get_root_id(), transform.final_file_id(root))150 self.assertEqual(self.wt.path2id(''), transform.final_file_id(root))
151 trans_id = transform.create_path('name', root)151 trans_id = transform.create_path('name', root)
152 self.assertIs(transform.final_file_id(trans_id), None)152 self.assertIs(transform.final_file_id(trans_id), None)
153 self.assertIs(None, transform.final_kind(trans_id))153 self.assertIs(None, transform.final_kind(trans_id))
@@ -270,17 +270,17 @@
270270
271 def test_change_root_id(self):271 def test_change_root_id(self):
272 transform, root = self.get_transform()272 transform, root = self.get_transform()
273 self.assertNotEqual(b'new-root-id', self.wt.get_root_id())273 self.assertNotEqual(b'new-root-id', self.wt.path2id(''))
274 transform.new_directory('', ROOT_PARENT, b'new-root-id')274 transform.new_directory('', ROOT_PARENT, b'new-root-id')
275 transform.delete_contents(root)275 transform.delete_contents(root)
276 transform.unversion_file(root)276 transform.unversion_file(root)
277 transform.fixup_new_roots()277 transform.fixup_new_roots()
278 transform.apply()278 transform.apply()
279 self.assertEqual(b'new-root-id', self.wt.get_root_id())279 self.assertEqual(b'new-root-id', self.wt.path2id(''))
280280
281 def test_change_root_id_add_files(self):281 def test_change_root_id_add_files(self):
282 transform, root = self.get_transform()282 transform, root = self.get_transform()
283 self.assertNotEqual(b'new-root-id', self.wt.get_root_id())283 self.assertNotEqual(b'new-root-id', self.wt.path2id(''))
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')
285 transform.new_file('file', new_trans_id, [b'new-contents\n'],285 transform.new_file('file', new_trans_id, [b'new-contents\n'],
286 b'new-file-id')286 b'new-file-id')
@@ -288,7 +288,7 @@
288 transform.unversion_file(root)288 transform.unversion_file(root)
289 transform.fixup_new_roots()289 transform.fixup_new_roots()
290 transform.apply()290 transform.apply()
291 self.assertEqual(b'new-root-id', self.wt.get_root_id())291 self.assertEqual(b'new-root-id', self.wt.path2id(''))
292 self.assertEqual(b'new-file-id', self.wt.path2id('file'))292 self.assertEqual(b'new-file-id', self.wt.path2id('file'))
293 self.assertFileEqual(b'new-contents\n', self.wt.abspath('file'))293 self.assertFileEqual(b'new-contents\n', self.wt.abspath('file'))
294294
@@ -321,13 +321,13 @@
321321
322 def test_remove_root_fixup(self):322 def test_remove_root_fixup(self):
323 transform, root = self.get_transform()323 transform, root = self.get_transform()
324 old_root_id = self.wt.get_root_id()324 old_root_id = self.wt.path2id('')
325 self.assertNotEqual(b'new-root-id', old_root_id)325 self.assertNotEqual(b'new-root-id', old_root_id)
326 transform.delete_contents(root)326 transform.delete_contents(root)
327 transform.unversion_file(root)327 transform.unversion_file(root)
328 transform.fixup_new_roots()328 transform.fixup_new_roots()
329 transform.apply()329 transform.apply()
330 self.assertEqual(old_root_id, self.wt.get_root_id())330 self.assertEqual(old_root_id, self.wt.path2id(''))
331331
332 transform, root = self.get_transform()332 transform, root = self.get_transform()
333 transform.new_directory('', ROOT_PARENT, b'new-root-id')333 transform.new_directory('', ROOT_PARENT, b'new-root-id')
@@ -358,7 +358,7 @@
358 old_root_id = transform.tree_file_id(root)358 old_root_id = transform.tree_file_id(root)
359 transform.unversion_file(root)359 transform.unversion_file(root)
360 transform.apply()360 transform.apply()
361 self.assertEqual(old_root_id, self.wt.get_root_id())361 self.assertEqual(old_root_id, self.wt.path2id(''))
362362
363 def test_hardlink(self):363 def test_hardlink(self):
364 self.requireFeature(HardlinkFeature)364 self.requireFeature(HardlinkFeature)
@@ -1741,7 +1741,7 @@
1741 tree.add('foo', b'foo-id')1741 tree.add('foo', b'foo-id')
1742 with TransformPreview(tree) as tt:1742 with TransformPreview(tree) as tt:
1743 tt.unversion_file(tt.root)1743 tt.unversion_file(tt.root)
1744 tt.version_file(tree.get_root_id(), tt.root)1744 tt.version_file(tree.path2id(''), tt.root)
1745 tt.trans_id_tree_path('foo')1745 tt.trans_id_tree_path('foo')
1746 self.assertEqual([], tt._inventory_altered())1746 self.assertEqual([], tt._inventory_altered())
17471747
@@ -2872,7 +2872,7 @@
28722872
2873 def test_iter_changes(self):2873 def test_iter_changes(self):
2874 revision_tree, preview_tree = self.get_tree_and_preview_tree()2874 revision_tree, preview_tree = self.get_tree_and_preview_tree()
2875 root = revision_tree.get_root_id()2875 root = revision_tree.path2id('')
2876 self.assertEqual([(b'a-id', ('a', 'a'), True, (True, True),2876 self.assertEqual([(b'a-id', ('a', 'a'), True, (True, True),
2877 (root, root), ('a', 'a'), ('file', 'file'),2877 (root, root), ('a', 'a'), ('file', 'file'),
2878 (False, False))],2878 (False, False))],
@@ -2981,7 +2981,7 @@
2981 preview.unversion_file(c_trans_id)2981 preview.unversion_file(c_trans_id)
2982 preview.version_file(b'c-id', c_trans_id)2982 preview.version_file(b'c-id', c_trans_id)
2983 preview_tree = preview.get_preview_tree()2983 preview_tree = preview.get_preview_tree()
2984 self.assertEqual({b'a-id', b'c-id', tree.get_root_id()},2984 self.assertEqual({b'a-id', b'c-id', tree.path2id('')},
2985 preview_tree.all_file_ids())2985 preview_tree.all_file_ids())
29862986
2987 def test_path2id_deleted_unchanged(self):2987 def test_path2id_deleted_unchanged(self):
@@ -3817,7 +3817,7 @@
3817 transform, root = self.get_transform()3817 transform, root = self.get_transform()
3818 old_root_id = transform.tree_file_id(root)3818 old_root_id = transform.tree_file_id(root)
3819 transform.apply()3819 transform.apply()
3820 self.assertEqual(old_root_id, self.wt.get_root_id())3820 self.assertEqual(old_root_id, self.wt.path2id(''))
3821 self.assertEqual([(self.wt, transform)], calls)3821 self.assertEqual([(self.wt, transform)], calls)
38223822
3823 def test_post_commit_hooks(self):3823 def test_post_commit_hooks(self):
@@ -3830,7 +3830,7 @@
3830 transform, root = self.get_transform()3830 transform, root = self.get_transform()
3831 old_root_id = transform.tree_file_id(root)3831 old_root_id = transform.tree_file_id(root)
3832 transform.apply()3832 transform.apply()
3833 self.assertEqual(old_root_id, self.wt.get_root_id())3833 self.assertEqual(old_root_id, self.wt.path2id(''))
3834 self.assertEqual([(self.wt, transform)], calls)3834 self.assertEqual([(self.wt, transform)], calls)
38353835
38363836
38373837
=== modified file 'breezy/tests/test_workingtree_4.py'
--- breezy/tests/test_workingtree_4.py 2019-06-16 23:54:50 +0000
+++ breezy/tests/test_workingtree_4.py 2019-07-25 23:25:31 +0000
@@ -538,22 +538,19 @@
538 format=format_name)538 format=format_name)
539 tree2 = self.make_branch_and_tree('tree2',539 tree2 = self.make_branch_and_tree('tree2',
540 format=format_name)540 format=format_name)
541 self.assertNotEqual(tree1.get_root_id(), tree2.get_root_id())541 self.assertNotEqual(tree1.path2id(''), tree2.path2id(''))
542 # when you branch, it inherits the same root id542 # when you branch, it inherits the same root id
543 tree1.commit('first post')543 tree1.commit('first post')
544 tree3 = tree1.controldir.sprout('tree3').open_workingtree()544 tree3 = tree1.controldir.sprout('tree3').open_workingtree()
545 self.assertEqual(tree3.get_root_id(), tree1.get_root_id())545 self.assertEqual(tree3.path2id(''), tree1.path2id(''))
546546
547 def test_set_root_id(self):547 def test_set_root_id(self):
548 # similar to some code that fails in the dirstate-plus-subtree branch548 # similar to some code that fails in the dirstate-plus-subtree branch
549 # -- setting the root id while adding a parent seems to scramble the549 # -- setting the root id while adding a parent seems to scramble the
550 # dirstate invariants. -- mbp 20070303550 # dirstate invariants. -- mbp 20070303
551 def validate():551 def validate():
552 wt.lock_read()552 with wt.lock_read():
553 try:
554 wt.current_dirstate()._validate()553 wt.current_dirstate()._validate()
555 finally:
556 wt.unlock()
557 wt = self.make_workingtree('tree')554 wt = self.make_workingtree('tree')
558 wt.set_root_id(b'TREE-ROOTID')555 wt.set_root_id(b'TREE-ROOTID')
559 validate()556 validate()
@@ -567,10 +564,10 @@
567564
568 def test_default_root_id(self):565 def test_default_root_id(self):
569 tree = self.make_branch_and_tree('tag', format='dirstate-tags')566 tree = self.make_branch_and_tree('tag', format='dirstate-tags')
570 self.assertEqual(inventory.ROOT_ID, tree.get_root_id())567 self.assertEqual(inventory.ROOT_ID, tree.path2id(''))
571 tree = self.make_branch_and_tree('subtree',568 tree = self.make_branch_and_tree('subtree',
572 format='development-subtree')569 format='development-subtree')
573 self.assertNotEqual(inventory.ROOT_ID, tree.get_root_id())570 self.assertNotEqual(inventory.ROOT_ID, tree.path2id(''))
574571
575 def test_non_subtree_with_nested_trees(self):572 def test_non_subtree_with_nested_trees(self):
576 # prior to dirstate, st/diff/commit ignored nested trees.573 # prior to dirstate, st/diff/commit ignored nested trees.
577574
=== modified file 'breezy/transform.py'
--- breezy/transform.py 2019-06-22 12:07:42 +0000
+++ breezy/transform.py 2019-07-25 23:25:31 +0000
@@ -455,7 +455,7 @@
455 return None455 return None
456 # the file is old; the old id is still valid456 # the file is old; the old id is still valid
457 if self._new_root == trans_id:457 if self._new_root == trans_id:
458 return self._tree.get_root_id()458 return self._tree.path2id('')
459 return self._tree.path2id(path)459 return self._tree.path2id(path)
460460
461 def final_file_id(self, trans_id):461 def final_file_id(self, trans_id):
@@ -1823,7 +1823,7 @@
1823 child_pb.update(gettext('removing file'),1823 child_pb.update(gettext('removing file'),
1824 num, total_entries)1824 num, total_entries)
1825 if trans_id == self._new_root:1825 if trans_id == self._new_root:
1826 file_id = self._tree.get_root_id()1826 file_id = self._tree.path2id('')
1827 else:1827 else:
1828 file_id = self.tree_file_id(trans_id)1828 file_id = self.tree_file_id(trans_id)
1829 # File-id isn't really being deleted, just moved1829 # File-id isn't really being deleted, just moved
@@ -2102,9 +2102,6 @@
2102 """This Tree does not use inventory as its backing data."""2102 """This Tree does not use inventory as its backing data."""
2103 raise NotImplementedError(_PreviewTree.root_inventory)2103 raise NotImplementedError(_PreviewTree.root_inventory)
21042104
2105 def get_root_id(self):
2106 return self._transform.final_file_id(self._transform.root)
2107
2108 def all_file_ids(self):2105 def all_file_ids(self):
2109 tree_ids = set(self._transform._tree.all_file_ids())2106 tree_ids = set(self._transform._tree.all_file_ids())
2110 tree_ids.difference_update(self._transform.tree_file_id(t)2107 tree_ids.difference_update(self._transform.tree_file_id(t)
@@ -2288,7 +2285,7 @@
2288 else:2285 else:
2289 if from_dir is None and include_root is True:2286 if from_dir is None and include_root is True:
2290 root_entry = inventory.make_entry(2287 root_entry = inventory.make_entry(
2291 'directory', '', ROOT_PARENT, self.get_root_id())2288 'directory', '', ROOT_PARENT, self.path2id(''))
2292 yield '', 'V', 'directory', root_entry2289 yield '', 'V', 'directory', root_entry
2293 entries = self._iter_entries_for_dir(from_dir or '')2290 entries = self._iter_entries_for_dir(from_dir or '')
2294 for path, entry in entries:2291 for path, entry in entries:
@@ -2620,7 +2617,7 @@
2620 file_trans_id = {}2617 file_trans_id = {}
2621 top_pb = ui.ui_factory.nested_progress_bar()2618 top_pb = ui.ui_factory.nested_progress_bar()
2622 pp = ProgressPhase("Build phase", 2, top_pb)2619 pp = ProgressPhase("Build phase", 2, top_pb)
2623 if tree.get_root_id() is not None:2620 if tree.path2id('') is not None:
2624 # This is kind of a hack: we should be altering the root2621 # This is kind of a hack: we should be altering the root
2625 # as part of the regular tree shape diff logic.2622 # as part of the regular tree shape diff logic.
2626 # The conditional test here is to avoid doing an2623 # The conditional test here is to avoid doing an
@@ -2628,14 +2625,14 @@
2628 # is set within the tree, nor setting the root and thus2625 # is set within the tree, nor setting the root and thus
2629 # marking the tree as dirty, because we use two different2626 # marking the tree as dirty, because we use two different
2630 # idioms here: tree interfaces and inventory interfaces.2627 # idioms here: tree interfaces and inventory interfaces.
2631 if wt.get_root_id() != tree.get_root_id():2628 if wt.path2id('') != tree.path2id(''):
2632 wt.set_root_id(tree.get_root_id())2629 wt.set_root_id(tree.path2id(''))
2633 wt.flush()2630 wt.flush()
2634 tt = wt.get_transform()2631 tt = wt.get_transform()
2635 divert = set()2632 divert = set()
2636 try:2633 try:
2637 pp.next_phase()2634 pp.next_phase()
2638 file_trans_id[wt.get_root_id()] = tt.trans_id_tree_path('')2635 file_trans_id[wt.path2id('')] = tt.trans_id_tree_path('')
2639 with ui.ui_factory.nested_progress_bar() as pb:2636 with ui.ui_factory.nested_progress_bar() as pb:
2640 deferred_contents = []2637 deferred_contents = []
2641 num = 02638 num = 0
26422639
=== modified file 'breezy/tree.py'
--- breezy/tree.py 2019-06-29 12:29:45 +0000
+++ breezy/tree.py 2019-07-25 23:25:31 +0000
@@ -529,10 +529,6 @@
529 """529 """
530 raise NotImplementedError(self.get_symlink_target)530 raise NotImplementedError(self.get_symlink_target)
531531
532 def get_root_id(self):
533 """Return the file_id for the root of this tree."""
534 raise NotImplementedError(self.get_root_id)
535
536 def annotate_iter(self, path,532 def annotate_iter(self, path,
537 default_revision=_mod_revision.CURRENT_REVISION):533 default_revision=_mod_revision.CURRENT_REVISION):
538 """Return an iterator of revision_id, line tuples.534 """Return an iterator of revision_id, line tuples.
539535
=== modified file 'breezy/workingtree.py'
--- breezy/workingtree.py 2019-06-18 11:21:15 +0000
+++ breezy/workingtree.py 2019-07-25 23:25:31 +0000
@@ -398,10 +398,6 @@
398 parents.append(revision_id)398 parents.append(revision_id)
399 return parents399 return parents
400400
401 def get_root_id(self):
402 """Return the id of this trees root"""
403 raise NotImplementedError(self.get_root_id)
404
405 def clone(self, to_controldir, revision_id=None):401 def clone(self, to_controldir, revision_id=None):
406 """Duplicate this working tree into to_bzr, including all state.402 """Duplicate this working tree into to_bzr, including all state.
407403
@@ -424,7 +420,7 @@
424 def copy_content_into(self, tree, revision_id=None):420 def copy_content_into(self, tree, revision_id=None):
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."""
426 with self.lock_read():422 with self.lock_read():
427 tree.set_root_id(self.get_root_id())423 tree.set_root_id(self.path2id(''))
428 if revision_id is None:424 if revision_id is None:
429 merge.transform_tree(tree, self)425 merge.transform_tree(tree, self)
430 else:426 else:
@@ -841,8 +837,8 @@
841 this_tree=self,837 this_tree=self,
842 change_reporter=change_reporter,838 change_reporter=change_reporter,
843 show_base=show_base)839 show_base=show_base)
844 basis_root_id = basis_tree.get_root_id()840 basis_root_id = basis_tree.path2id('')
845 new_root_id = new_basis_tree.get_root_id()841 new_root_id = new_basis_tree.path2id('')
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:
847 self.set_root_id(new_root_id)843 self.set_root_id(new_root_id)
848 # TODO - dedup parents list with things merged by pull ?844 # TODO - dedup parents list with things merged by pull ?
@@ -1170,11 +1166,11 @@
1170 # the working tree is up to date with the branch1166 # the working tree is up to date with the branch
1171 # we can merge the specified revision from master1167 # we can merge the specified revision from master
1172 to_tree = self.branch.repository.revision_tree(revision)1168 to_tree = self.branch.repository.revision_tree(revision)
1173 to_root_id = to_tree.get_root_id()1169 to_root_id = to_tree.path2id('')
11741170
1175 basis = self.basis_tree()1171 basis = self.basis_tree()
1176 with basis.lock_read():1172 with basis.lock_read():
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):
1178 self.set_root_id(to_root_id)1174 self.set_root_id(to_root_id)
1179 self.flush()1175 self.flush()
11801176
11811177
=== modified file 'doc/en/release-notes/brz-3.1.txt'
--- doc/en/release-notes/brz-3.1.txt 2019-07-07 19:36:13 +0000
+++ doc/en/release-notes/brz-3.1.txt 2019-07-25 23:25:31 +0000
@@ -99,6 +99,9 @@
99* New ``Tree.get_transform`` method for getting a ``TreeTransform``99* New ``Tree.get_transform`` method for getting a ``TreeTransform``
100 object. (Jelmer Vernooij)100 object. (Jelmer Vernooij)
101101
102* The ``Tree.get_root_id`` method has been removed. Use
103 ``Tree.path2id('')`` instead. (Jelmer Vernooij)
104
102* ``Repository.find_branches`` now returns an iterator rather than a105* ``Repository.find_branches`` now returns an iterator rather than a
103 list. (Jelmer Vernooij, #413970)106 list. (Jelmer Vernooij, #413970)
104107

Subscribers

People subscribed via source and target branches