Merge lp:~jelmer/brz/iter-references into lp:brz

Proposed by Jelmer Vernooij on 2019-06-18
Status: Merged
Approved by: Jelmer Vernooij on 2019-06-21
Approved revision: 7351
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 2019-06-18 Approve on 2019-06-21
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.
Martin Packman (gz) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/branch.py'
2--- breezy/branch.py 2019-03-06 22:05:54 +0000
3+++ breezy/branch.py 2019-06-18 13:59:46 +0000
4@@ -1409,8 +1409,8 @@
5 hardlink=hardlink)
6 basis_tree = tree.basis_tree()
7 with basis_tree.lock_read():
8- for path, file_id in basis_tree.iter_references():
9- reference_parent = self.reference_parent(path, file_id)
10+ for path in basis_tree.iter_references():
11+ reference_parent = self.reference_parent(path)
12 reference_parent.create_checkout(
13 tree.abspath(path),
14 basis_tree.get_reference_revision(path), lightweight)
15@@ -1423,12 +1423,11 @@
16 """
17 raise NotImplementedError(self.reconcile)
18
19- def reference_parent(self, path, file_id=None, possible_transports=None):
20+ def reference_parent(self, path, possible_transports=None):
21 """Return the parent branch for a tree-reference file_id
22
23- :param path: The path of the file_id in the tree
24- :param file_id: Optional file_id of the tree reference
25- :return: A branch associated with the file_id
26+ :param path: The path of the nested tree in the tree
27+ :return: A branch associated with the nested tree
28 """
29 # FIXME should provide multiple branches, based on config
30 return Branch.open(self.controldir.root_transport.clone(path).base,
31
32=== modified file 'breezy/bzr/branch.py'
33--- breezy/bzr/branch.py 2019-06-14 23:32:21 +0000
34+++ breezy/bzr/branch.py 2019-06-18 13:59:46 +0000
35@@ -575,17 +575,15 @@
36 """
37 return self._get_all_reference_info().get(path, (None, None))
38
39- def reference_parent(self, path, file_id=None, possible_transports=None):
40- """Return the parent branch for a tree-reference file_id.
41+ def reference_parent(self, path, possible_transports=None):
42+ """Return the parent branch for a tree-reference.
43
44- :param file_id: The file_id of the tree reference
45- :param path: The path of the file_id in the tree
46- :return: A branch associated with the file_id
47+ :param path: The path of the nested tree in the tree
48+ :return: A branch associated with the nested tree
49 """
50 branch_location = self.get_reference_info(path)[0]
51 if branch_location is None:
52- return Branch.reference_parent(self, path, file_id,
53- possible_transports)
54+ return Branch.reference_parent(self, path, possible_transports)
55 branch_location = urlutils.join(self.user_url, branch_location)
56 return Branch.open(branch_location,
57 possible_transports=possible_transports)
58
59=== modified file 'breezy/bzr/bzrdir.py'
60--- breezy/bzr/bzrdir.py 2019-06-06 22:22:47 +0000
61+++ breezy/bzr/bzrdir.py 2019-06-18 13:59:46 +0000
62@@ -474,9 +474,9 @@
63 subtrees = basis.iter_references()
64 else:
65 subtrees = []
66- for path, file_id in subtrees:
67+ for path in subtrees:
68 target = urlutils.join(url, urlutils.escape(path))
69- sublocation = source_branch.reference_parent(path, file_id)
70+ sublocation = source_branch.reference_parent(path)
71 sublocation.controldir.sprout(
72 target, basis.get_reference_revision(path),
73 force_new_repo=force_new_repo, recurse=recurse,
74
75=== modified file 'breezy/bzr/workingtree_4.py'
76--- breezy/bzr/workingtree_4.py 2019-06-16 23:54:50 +0000
77+++ breezy/bzr/workingtree_4.py 2019-06-18 13:59:46 +0000
78@@ -563,7 +563,7 @@
79 relpath = pathjoin(key[0].decode('utf8'), key[1].decode('utf8'))
80 try:
81 if self.kind(relpath) == 'tree-reference':
82- yield relpath, key[2]
83+ yield relpath
84 except errors.NoSuchFile:
85 # path is missing on disk.
86 continue
87
88=== modified file 'breezy/git/branch.py'
89--- breezy/git/branch.py 2019-04-11 02:09:36 +0000
90+++ breezy/git/branch.py 2019-06-18 13:59:46 +0000
91@@ -790,12 +790,11 @@
92 return GitMemoryTree(self, self.repository._git.object_store,
93 self.head)
94
95- def reference_parent(self, path, file_id=None, possible_transports=None):
96- """Return the parent branch for a tree-reference file_id
97+ def reference_parent(self, path, possible_transports=None):
98+ """Return the parent branch for a tree-reference.
99
100- :param path: The path of the file_id in the tree
101- :param file_id: Optional file_id of the tree reference
102- :return: A branch associated with the file_id
103+ :param path: The path of the nested tree in the tree
104+ :return: A branch associated with the nested tree
105 """
106 # FIXME should provide multiple branches, based on config
107 url = urlutils.join(self.user_url, path)
108
109=== modified file 'breezy/git/tree.py'
110--- breezy/git/tree.py 2019-06-15 01:02:49 +0000
111+++ breezy/git/tree.py 2019-06-18 13:59:46 +0000
112@@ -524,7 +524,7 @@
113 if self.supports_tree_reference():
114 for path, entry in self.iter_entries_by_dir():
115 if entry.kind == 'tree-reference':
116- yield path, self.mapping.generate_file_id(b'')
117+ yield path
118
119 def get_revision_id(self):
120 """See RevisionTree.get_revision_id."""
121@@ -1136,7 +1136,7 @@
122 # TODO(jelmer): Implement a more efficient version of this
123 for path, entry in self.iter_entries_by_dir():
124 if entry.kind == 'tree-reference':
125- yield path, self.mapping.generate_file_id(b'')
126+ yield path
127
128 def _get_dir_ie(self, path, parent_id):
129 file_id = self.path2id(path)
130
131=== modified file 'breezy/merge.py'
132--- breezy/merge.py 2019-06-15 12:04:34 +0000
133+++ breezy/merge.py 2019-06-18 13:59:46 +0000
134@@ -637,7 +637,7 @@
135 for hook in Merger.hooks['post_merge']:
136 hook(merge)
137 if self.recurse == 'down':
138- for relpath, file_id in self.this_tree.iter_references():
139+ for relpath in self.this_tree.iter_references():
140 sub_tree = self.this_tree.get_nested_tree(relpath)
141 other_revision = self.other_tree.get_reference_revision(
142 relpath)
143@@ -645,8 +645,7 @@
144 continue
145 sub_merge = Merger(sub_tree.branch, this_tree=sub_tree)
146 sub_merge.merge_type = self.merge_type
147- other_branch = self.other_branch.reference_parent(
148- relpath, file_id)
149+ other_branch = self.other_branch.reference_parent(relpath)
150 sub_merge.set_other_revision(other_revision, other_branch)
151 base_tree_path = _mod_tree.find_previous_path(
152 self.this_tree, self.base_tree, relpath)
153
154=== modified file 'breezy/tests/per_tree/test_tree.py'
155--- breezy/tests/per_tree/test_tree.py 2018-11-16 23:21:31 +0000
156+++ breezy/tests/per_tree/test_tree.py 2019-06-18 13:59:46 +0000
157@@ -108,7 +108,7 @@
158 tree.lock_read()
159 self.addCleanup(tree.unlock)
160 self.assertEqual(
161- [(u'subtree', subtree.get_root_id())],
162+ [u'subtree'],
163 list(tree.iter_references()))
164
165 def test_get_root_id(self):
166
167=== modified file 'breezy/tree.py'
168--- breezy/tree.py 2019-06-16 02:23:42 +0000
169+++ breezy/tree.py 2019-06-18 13:59:46 +0000
170@@ -347,7 +347,7 @@
171 if self.supports_tree_reference():
172 for path, entry in self.iter_entries_by_dir():
173 if entry.kind == 'tree-reference':
174- yield path, entry.file_id
175+ yield path
176
177 def kind(self, path):
178 raise NotImplementedError("Tree subclass %s must implement kind"

Subscribers

People subscribed via source and target branches