Merge lp:~jelmer/brz/iter-references 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/iter-references
Merge into: lp:brz
Diff against target: 178 lines (+23/-28)
9 files modified
breezy/branch.py (+5/-6)
breezy/bzr/branch.py (+5/-7)
breezy/bzr/bzrdir.py (+2/-2)
breezy/bzr/workingtree_4.py (+1/-1)
breezy/git/branch.py (+4/-5)
breezy/git/tree.py (+2/-2)
breezy/merge.py (+2/-3)
breezy/tests/per_tree/test_tree.py (+1/-1)
breezy/tree.py (+1/-1)
To merge this branch: bzr merge lp:~jelmer/brz/iter-references
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+368977@code.launchpad.net

Commit message

Drop file_id return value from Tree.iter_references.

Description of the change

Drop file_id return value from Tree.iter_references.

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

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/branch.py'
--- breezy/branch.py 2019-03-06 22:05:54 +0000
+++ breezy/branch.py 2019-06-18 13:59:46 +0000
@@ -1409,8 +1409,8 @@
1409 hardlink=hardlink)1409 hardlink=hardlink)
1410 basis_tree = tree.basis_tree()1410 basis_tree = tree.basis_tree()
1411 with basis_tree.lock_read():1411 with basis_tree.lock_read():
1412 for path, file_id in basis_tree.iter_references():1412 for path in basis_tree.iter_references():
1413 reference_parent = self.reference_parent(path, file_id)1413 reference_parent = self.reference_parent(path)
1414 reference_parent.create_checkout(1414 reference_parent.create_checkout(
1415 tree.abspath(path),1415 tree.abspath(path),
1416 basis_tree.get_reference_revision(path), lightweight)1416 basis_tree.get_reference_revision(path), lightweight)
@@ -1423,12 +1423,11 @@
1423 """1423 """
1424 raise NotImplementedError(self.reconcile)1424 raise NotImplementedError(self.reconcile)
14251425
1426 def reference_parent(self, path, file_id=None, possible_transports=None):1426 def reference_parent(self, path, possible_transports=None):
1427 """Return the parent branch for a tree-reference file_id1427 """Return the parent branch for a tree-reference file_id
14281428
1429 :param path: The path of the file_id in the tree1429 :param path: The path of the nested tree in the tree
1430 :param file_id: Optional file_id of the tree reference1430 :return: A branch associated with the nested tree
1431 :return: A branch associated with the file_id
1432 """1431 """
1433 # FIXME should provide multiple branches, based on config1432 # FIXME should provide multiple branches, based on config
1434 return Branch.open(self.controldir.root_transport.clone(path).base,1433 return Branch.open(self.controldir.root_transport.clone(path).base,
14351434
=== modified file 'breezy/bzr/branch.py'
--- breezy/bzr/branch.py 2019-06-14 23:32:21 +0000
+++ breezy/bzr/branch.py 2019-06-18 13:59:46 +0000
@@ -575,17 +575,15 @@
575 """575 """
576 return self._get_all_reference_info().get(path, (None, None))576 return self._get_all_reference_info().get(path, (None, None))
577577
578 def reference_parent(self, path, file_id=None, possible_transports=None):578 def reference_parent(self, path, possible_transports=None):
579 """Return the parent branch for a tree-reference file_id.579 """Return the parent branch for a tree-reference.
580580
581 :param file_id: The file_id of the tree reference581 :param path: The path of the nested tree in the tree
582 :param path: The path of the file_id in the tree582 :return: A branch associated with the nested tree
583 :return: A branch associated with the file_id
584 """583 """
585 branch_location = self.get_reference_info(path)[0]584 branch_location = self.get_reference_info(path)[0]
586 if branch_location is None:585 if branch_location is None:
587 return Branch.reference_parent(self, path, file_id,586 return Branch.reference_parent(self, path, possible_transports)
588 possible_transports)
589 branch_location = urlutils.join(self.user_url, branch_location)587 branch_location = urlutils.join(self.user_url, branch_location)
590 return Branch.open(branch_location,588 return Branch.open(branch_location,
591 possible_transports=possible_transports)589 possible_transports=possible_transports)
592590
=== modified file 'breezy/bzr/bzrdir.py'
--- breezy/bzr/bzrdir.py 2019-06-06 22:22:47 +0000
+++ breezy/bzr/bzrdir.py 2019-06-18 13:59:46 +0000
@@ -474,9 +474,9 @@
474 subtrees = basis.iter_references()474 subtrees = basis.iter_references()
475 else:475 else:
476 subtrees = []476 subtrees = []
477 for path, file_id in subtrees:477 for path in subtrees:
478 target = urlutils.join(url, urlutils.escape(path))478 target = urlutils.join(url, urlutils.escape(path))
479 sublocation = source_branch.reference_parent(path, file_id)479 sublocation = source_branch.reference_parent(path)
480 sublocation.controldir.sprout(480 sublocation.controldir.sprout(
481 target, basis.get_reference_revision(path),481 target, basis.get_reference_revision(path),
482 force_new_repo=force_new_repo, recurse=recurse,482 force_new_repo=force_new_repo, recurse=recurse,
483483
=== modified file 'breezy/bzr/workingtree_4.py'
--- breezy/bzr/workingtree_4.py 2019-06-16 23:54:50 +0000
+++ breezy/bzr/workingtree_4.py 2019-06-18 13:59:46 +0000
@@ -563,7 +563,7 @@
563 relpath = pathjoin(key[0].decode('utf8'), key[1].decode('utf8'))563 relpath = pathjoin(key[0].decode('utf8'), key[1].decode('utf8'))
564 try:564 try:
565 if self.kind(relpath) == 'tree-reference':565 if self.kind(relpath) == 'tree-reference':
566 yield relpath, key[2]566 yield relpath
567 except errors.NoSuchFile:567 except errors.NoSuchFile:
568 # path is missing on disk.568 # path is missing on disk.
569 continue569 continue
570570
=== modified file 'breezy/git/branch.py'
--- breezy/git/branch.py 2019-04-11 02:09:36 +0000
+++ breezy/git/branch.py 2019-06-18 13:59:46 +0000
@@ -790,12 +790,11 @@
790 return GitMemoryTree(self, self.repository._git.object_store,790 return GitMemoryTree(self, self.repository._git.object_store,
791 self.head)791 self.head)
792792
793 def reference_parent(self, path, file_id=None, possible_transports=None):793 def reference_parent(self, path, possible_transports=None):
794 """Return the parent branch for a tree-reference file_id794 """Return the parent branch for a tree-reference.
795795
796 :param path: The path of the file_id in the tree796 :param path: The path of the nested tree in the tree
797 :param file_id: Optional file_id of the tree reference797 :return: A branch associated with the nested tree
798 :return: A branch associated with the file_id
799 """798 """
800 # FIXME should provide multiple branches, based on config799 # FIXME should provide multiple branches, based on config
801 url = urlutils.join(self.user_url, path)800 url = urlutils.join(self.user_url, path)
802801
=== modified file 'breezy/git/tree.py'
--- breezy/git/tree.py 2019-06-15 01:02:49 +0000
+++ breezy/git/tree.py 2019-06-18 13:59:46 +0000
@@ -524,7 +524,7 @@
524 if self.supports_tree_reference():524 if self.supports_tree_reference():
525 for path, entry in self.iter_entries_by_dir():525 for path, entry in self.iter_entries_by_dir():
526 if entry.kind == 'tree-reference':526 if entry.kind == 'tree-reference':
527 yield path, self.mapping.generate_file_id(b'')527 yield path
528528
529 def get_revision_id(self):529 def get_revision_id(self):
530 """See RevisionTree.get_revision_id."""530 """See RevisionTree.get_revision_id."""
@@ -1136,7 +1136,7 @@
1136 # TODO(jelmer): Implement a more efficient version of this1136 # TODO(jelmer): Implement a more efficient version of this
1137 for path, entry in self.iter_entries_by_dir():1137 for path, entry in self.iter_entries_by_dir():
1138 if entry.kind == 'tree-reference':1138 if entry.kind == 'tree-reference':
1139 yield path, self.mapping.generate_file_id(b'')1139 yield path
11401140
1141 def _get_dir_ie(self, path, parent_id):1141 def _get_dir_ie(self, path, parent_id):
1142 file_id = self.path2id(path)1142 file_id = self.path2id(path)
11431143
=== modified file 'breezy/merge.py'
--- breezy/merge.py 2019-06-15 12:04:34 +0000
+++ breezy/merge.py 2019-06-18 13:59:46 +0000
@@ -637,7 +637,7 @@
637 for hook in Merger.hooks['post_merge']:637 for hook in Merger.hooks['post_merge']:
638 hook(merge)638 hook(merge)
639 if self.recurse == 'down':639 if self.recurse == 'down':
640 for relpath, file_id in self.this_tree.iter_references():640 for relpath in self.this_tree.iter_references():
641 sub_tree = self.this_tree.get_nested_tree(relpath)641 sub_tree = self.this_tree.get_nested_tree(relpath)
642 other_revision = self.other_tree.get_reference_revision(642 other_revision = self.other_tree.get_reference_revision(
643 relpath)643 relpath)
@@ -645,8 +645,7 @@
645 continue645 continue
646 sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)646 sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)
647 sub_merge.merge_type = self.merge_type647 sub_merge.merge_type = self.merge_type
648 other_branch = self.other_branch.reference_parent(648 other_branch = self.other_branch.reference_parent(relpath)
649 relpath, file_id)
650 sub_merge.set_other_revision(other_revision, other_branch)649 sub_merge.set_other_revision(other_revision, other_branch)
651 base_tree_path = _mod_tree.find_previous_path(650 base_tree_path = _mod_tree.find_previous_path(
652 self.this_tree, self.base_tree, relpath)651 self.this_tree, self.base_tree, relpath)
653652
=== modified file 'breezy/tests/per_tree/test_tree.py'
--- breezy/tests/per_tree/test_tree.py 2018-11-16 23:21:31 +0000
+++ breezy/tests/per_tree/test_tree.py 2019-06-18 13:59:46 +0000
@@ -108,7 +108,7 @@
108 tree.lock_read()108 tree.lock_read()
109 self.addCleanup(tree.unlock)109 self.addCleanup(tree.unlock)
110 self.assertEqual(110 self.assertEqual(
111 [(u'subtree', subtree.get_root_id())],111 [u'subtree'],
112 list(tree.iter_references()))112 list(tree.iter_references()))
113113
114 def test_get_root_id(self):114 def test_get_root_id(self):
115115
=== modified file 'breezy/tree.py'
--- breezy/tree.py 2019-06-16 02:23:42 +0000
+++ breezy/tree.py 2019-06-18 13:59:46 +0000
@@ -347,7 +347,7 @@
347 if self.supports_tree_reference():347 if self.supports_tree_reference():
348 for path, entry in self.iter_entries_by_dir():348 for path, entry in self.iter_entries_by_dir():
349 if entry.kind == 'tree-reference':349 if entry.kind == 'tree-reference':
350 yield path, entry.file_id350 yield path
351351
352 def kind(self, path):352 def kind(self, path):
353 raise NotImplementedError("Tree subclass %s must implement kind"353 raise NotImplementedError("Tree subclass %s must implement kind"

Subscribers

People subscribed via source and target branches