Merge lp:~jelmer/brz/branch-reference-remote into lp:brz
- branch-reference-remote
- Merge into trunk
Proposed by
Jelmer Vernooij
Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | no longer in the source branch. |
Merge reported by: | The Breezy Bot |
Merged at revision: | not available |
Proposed branch: | lp:~jelmer/brz/branch-reference-remote |
Merge into: | lp:brz |
Diff against target: |
508 lines (+163/-64) 15 files modified
breezy/branch.py (+7/-3) breezy/bzr/branch.py (+15/-25) breezy/bzr/fullhistory.py (+2/-0) breezy/bzr/remote.py (+50/-15) breezy/bzr/smart/branch.py (+14/-0) breezy/bzr/smart/request.py (+3/-0) breezy/git/branch.py (+2/-0) breezy/plugins/weave_fmt/branch.py (+2/-0) breezy/tests/blackbox/test_branch.py (+8/-7) breezy/tests/blackbox/test_checkout.py (+1/-1) breezy/tests/blackbox/test_pull.py (+1/-1) breezy/tests/per_workingtree/test_workingtree.py (+20/-12) breezy/tests/test_remote.py (+20/-0) breezy/tests/test_smart.py (+15/-0) doc/en/release-notes/brz-3.1.txt (+3/-0) |
To merge this branch: | bzr merge lp:~jelmer/brz/branch-reference-remote |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+377806@code.launchpad.net |
Commit message
Support fetching / pushing reference information to remote branches.
Description of the change
Support fetching / pushing reference information to remote branches.
To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) : | # |
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
1 | === modified file 'breezy/branch.py' | |||
2 | --- breezy/branch.py 2020-01-19 03:22:04 +0000 | |||
3 | +++ breezy/branch.py 2020-01-19 15:24:24 +0000 | |||
4 | @@ -1271,7 +1271,7 @@ | |||
5 | 1271 | revision_id=revision_id) | 1271 | revision_id=revision_id) |
6 | 1272 | 1272 | ||
7 | 1273 | def update_references(self, target): | 1273 | def update_references(self, target): |
9 | 1274 | if not getattr(self._format, 'supports_reference_locations', False): | 1274 | if not self._format.supports_reference_locations: |
10 | 1275 | return | 1275 | return |
11 | 1276 | return InterBranch.get(self, target).update_references() | 1276 | return InterBranch.get(self, target).update_references() |
12 | 1277 | 1277 | ||
13 | @@ -2391,8 +2391,12 @@ | |||
14 | 2391 | new_base = self.target.base | 2391 | new_base = self.target.base |
15 | 2392 | target_reference_dict = self.target._get_all_reference_info() | 2392 | target_reference_dict = self.target._get_all_reference_info() |
16 | 2393 | for tree_path, (branch_location, file_id) in viewitems(reference_dict): | 2393 | for tree_path, (branch_location, file_id) in viewitems(reference_dict): |
19 | 2394 | branch_location = urlutils.rebase_url(branch_location, | 2394 | try: |
20 | 2395 | old_base, new_base) | 2395 | branch_location = urlutils.rebase_url(branch_location, |
21 | 2396 | old_base, new_base) | ||
22 | 2397 | except urlutils.InvalidRebaseURLs: | ||
23 | 2398 | # Fall back to absolute URL | ||
24 | 2399 | branch_location = urlutils.join(old_base, branch_location) | ||
25 | 2396 | target_reference_dict.setdefault( | 2400 | target_reference_dict.setdefault( |
26 | 2397 | tree_path, (branch_location, file_id)) | 2401 | tree_path, (branch_location, file_id)) |
27 | 2398 | self.target._set_all_reference_info(target_reference_dict) | 2402 | self.target._set_all_reference_info(target_reference_dict) |
28 | 2399 | 2403 | ||
29 | === modified file 'breezy/bzr/branch.py' | |||
30 | --- breezy/bzr/branch.py 2020-01-19 03:22:04 +0000 | |||
31 | +++ breezy/bzr/branch.py 2020-01-19 15:24:24 +0000 | |||
32 | @@ -465,11 +465,20 @@ | |||
33 | 465 | :return: A branch associated with the nested tree | 465 | :return: A branch associated with the nested tree |
34 | 466 | """ | 466 | """ |
35 | 467 | try: | 467 | try: |
41 | 468 | return Branch.open_from_transport( | 468 | branch_location = self.get_reference_info(file_id)[0] |
42 | 469 | self.controldir.root_transport.clone(path), | 469 | except errors.UnsupportedOperation: |
43 | 470 | possible_transports=possible_transports) | 470 | branch_location = None |
44 | 471 | except errors.NotBranchError: | 471 | if branch_location is None: |
45 | 472 | return None | 472 | try: |
46 | 473 | return Branch.open_from_transport( | ||
47 | 474 | self.controldir.root_transport.clone(path), | ||
48 | 475 | possible_transports=possible_transports) | ||
49 | 476 | except errors.NotBranchError: | ||
50 | 477 | return None | ||
51 | 478 | return Branch.open( | ||
52 | 479 | urlutils.join( | ||
53 | 480 | urlutils.strip_segment_parameters(self.user_url), branch_location), | ||
54 | 481 | possible_transports=possible_transports) | ||
55 | 473 | 482 | ||
56 | 474 | 483 | ||
57 | 475 | class BzrBranch8(BzrBranch): | 484 | class BzrBranch8(BzrBranch): |
58 | @@ -565,7 +574,7 @@ | |||
59 | 565 | with self._transport.get('references') as rio_file: | 574 | with self._transport.get('references') as rio_file: |
60 | 566 | stanzas = rio.read_stanzas(rio_file) | 575 | stanzas = rio.read_stanzas(rio_file) |
61 | 567 | info_dict = { | 576 | info_dict = { |
63 | 568 | s['file_id'].encode('ascii'): ( | 577 | s['file_id'].encode('utf-8'): ( |
64 | 569 | s['branch_location'], | 578 | s['branch_location'], |
65 | 570 | s['tree_path'] if 'tree_path' in s else None) | 579 | s['tree_path'] if 'tree_path' in s else None) |
66 | 571 | for s in stanzas} | 580 | for s in stanzas} |
67 | @@ -595,25 +604,6 @@ | |||
68 | 595 | """ | 604 | """ |
69 | 596 | return self._get_all_reference_info().get(file_id, (None, None)) | 605 | return self._get_all_reference_info().get(file_id, (None, None)) |
70 | 597 | 606 | ||
71 | 598 | def reference_parent(self, file_id, path, possible_transports=None): | ||
72 | 599 | """Return the parent branch for a tree-reference. | ||
73 | 600 | |||
74 | 601 | :param path: The path of the nested tree in the tree | ||
75 | 602 | :return: A branch associated with the nested tree | ||
76 | 603 | """ | ||
77 | 604 | branch_location = self.get_reference_info(file_id)[0] | ||
78 | 605 | if branch_location is None: | ||
79 | 606 | try: | ||
80 | 607 | return Branch.open_from_transport( | ||
81 | 608 | self.controldir.root_transport.clone(path), | ||
82 | 609 | possible_transports=possible_transports) | ||
83 | 610 | except errors.NotBranchError: | ||
84 | 611 | return None | ||
85 | 612 | else: | ||
86 | 613 | branch_location = urlutils.join(self.user_url, branch_location) | ||
87 | 614 | return Branch.open( | ||
88 | 615 | branch_location, possible_transports=possible_transports) | ||
89 | 616 | |||
90 | 617 | def set_push_location(self, location): | 607 | def set_push_location(self, location): |
91 | 618 | """See Branch.set_push_location.""" | 608 | """See Branch.set_push_location.""" |
92 | 619 | self._set_config_location('push_location', location) | 609 | self._set_config_location('push_location', location) |
93 | 620 | 610 | ||
94 | === modified file 'breezy/bzr/fullhistory.py' | |||
95 | --- breezy/bzr/fullhistory.py 2018-11-11 04:08:32 +0000 | |||
96 | +++ breezy/bzr/fullhistory.py 2020-01-19 15:24:24 +0000 | |||
97 | @@ -173,3 +173,5 @@ | |||
98 | 173 | 173 | ||
99 | 174 | def supports_tags(self): | 174 | def supports_tags(self): |
100 | 175 | return False | 175 | return False |
101 | 176 | |||
102 | 177 | supports_reference_locations = False | ||
103 | 176 | 178 | ||
104 | === modified file 'breezy/bzr/remote.py' | |||
105 | --- breezy/bzr/remote.py 2020-01-18 22:02:05 +0000 | |||
106 | +++ breezy/bzr/remote.py 2020-01-19 15:24:24 +0000 | |||
107 | @@ -3397,6 +3397,11 @@ | |||
108 | 3397 | self._ensure_real() | 3397 | self._ensure_real() |
109 | 3398 | return self._custom_format.supports_set_append_revisions_only() | 3398 | return self._custom_format.supports_set_append_revisions_only() |
110 | 3399 | 3399 | ||
111 | 3400 | @property | ||
112 | 3401 | def supports_reference_locations(self): | ||
113 | 3402 | self._ensure_real() | ||
114 | 3403 | return self._custom_format.supports_reference_locations | ||
115 | 3404 | |||
116 | 3400 | def stores_revno(self): | 3405 | def stores_revno(self): |
117 | 3401 | return True | 3406 | return True |
118 | 3402 | 3407 | ||
119 | @@ -3415,8 +3420,6 @@ | |||
120 | 3415 | return True | 3420 | return True |
121 | 3416 | return False | 3421 | return False |
122 | 3417 | 3422 | ||
123 | 3418 | supports_reference_locations = False | ||
124 | 3419 | |||
125 | 3420 | 3423 | ||
126 | 3421 | class RemoteBranchStore(_mod_config.IniFileStore): | 3424 | class RemoteBranchStore(_mod_config.IniFileStore): |
127 | 3422 | """Branch store which attempts to use HPSS calls to retrieve branch store. | 3425 | """Branch store which attempts to use HPSS calls to retrieve branch store. |
128 | @@ -4179,28 +4182,60 @@ | |||
129 | 4179 | reconciler = BranchReconciler(self, thorough=thorough) | 4182 | reconciler = BranchReconciler(self, thorough=thorough) |
130 | 4180 | return reconciler.reconcile() | 4183 | return reconciler.reconcile() |
131 | 4181 | 4184 | ||
137 | 4182 | def set_reference_info(self, tree_path, branch_location, file_id=None): | 4185 | def get_reference_info(self, file_id): |
138 | 4183 | raise errors.UnsupportedOperation(self.set_reference_info, self) | 4186 | """Get the tree_path and branch_location for a tree reference.""" |
139 | 4184 | 4187 | if not self._format.supports_reference_locations: | |
140 | 4185 | def get_reference_info(self, tree_path): | 4188 | raise errors.UnsupportedOperation(self.get_reference_info, self) |
141 | 4186 | raise errors.UnsupportedOperation(self.get_reference_info, self) | 4189 | return self._get_all_reference_info().get(file_id, (None, None)) |
142 | 4190 | |||
143 | 4191 | def set_reference_info(self, file_id, branch_location, tree_path=None): | ||
144 | 4192 | """Set the branch location to use for a tree reference.""" | ||
145 | 4193 | if not self._format.supports_reference_locations: | ||
146 | 4194 | raise errors.UnsupportedOperation(self.set_reference_info, self) | ||
147 | 4195 | self._ensure_real() | ||
148 | 4196 | self._real_branch.set_reference_info( | ||
149 | 4197 | file_id, branch_location, tree_path) | ||
150 | 4198 | |||
151 | 4199 | def _set_all_reference_info(self, reference_info): | ||
152 | 4200 | if not self._format.supports_reference_locations: | ||
153 | 4201 | raise errors.UnsupportedOperation(self.set_reference_info, self) | ||
154 | 4202 | self._ensure_real() | ||
155 | 4203 | self._real_branch._set_all_reference_info(reference_info) | ||
156 | 4187 | 4204 | ||
157 | 4188 | def _get_all_reference_info(self): | 4205 | def _get_all_reference_info(self): |
160 | 4189 | self._ensure_real() | 4206 | if not self._format.supports_reference_locations: |
161 | 4190 | return self._real_branch._get_all_reference_info() | 4207 | return {} |
162 | 4208 | try: | ||
163 | 4209 | response, handler = self._call_expecting_body( | ||
164 | 4210 | b'Branch.get_all_reference_info', self._remote_path()) | ||
165 | 4211 | except errors.UnknownSmartMethod: | ||
166 | 4212 | self._ensure_real() | ||
167 | 4213 | return self._real_branch._get_all_reference_info() | ||
168 | 4214 | if len(response) and response[0] != b'ok': | ||
169 | 4215 | raise errors.UnexpectedSmartServerResponse(response) | ||
170 | 4216 | ret = {} | ||
171 | 4217 | for (f, u, p) in bencode.bdecode(handler.read_body_bytes()): | ||
172 | 4218 | ret[f] = (u.decode('utf-8'), p.decode('utf-8') if p else None) | ||
173 | 4219 | return ret | ||
174 | 4191 | 4220 | ||
176 | 4192 | def reference_parent(self, path, possible_transports=None): | 4221 | def reference_parent(self, file_id, path, possible_transports=None): |
177 | 4193 | """Return the parent branch for a tree-reference. | 4222 | """Return the parent branch for a tree-reference. |
178 | 4194 | 4223 | ||
179 | 4195 | :param path: The path of the nested tree in the tree | 4224 | :param path: The path of the nested tree in the tree |
180 | 4196 | :return: A branch associated with the nested tree | 4225 | :return: A branch associated with the nested tree |
181 | 4197 | """ | 4226 | """ |
183 | 4198 | branch_location = self.get_reference_info(path)[0] | 4227 | branch_location = self.get_reference_info(file_id)[0] |
184 | 4199 | if branch_location is None: | 4228 | if branch_location is None: |
189 | 4200 | return BzrBranch.reference_parent(self, path, possible_transports) | 4229 | try: |
190 | 4201 | branch_location = urlutils.join(self.user_url, branch_location) | 4230 | return branch.Branch.open_from_transport( |
191 | 4202 | return Branch.open(branch_location, | 4231 | self.controldir.root_transport.clone(path), |
192 | 4203 | possible_transports=possible_transports) | 4232 | possible_transports=possible_transports) |
193 | 4233 | except errors.NotBranchError: | ||
194 | 4234 | return None | ||
195 | 4235 | return branch.Branch.open( | ||
196 | 4236 | urlutils.join( | ||
197 | 4237 | urlutils.strip_segment_parameters(self.user_url), branch_location), | ||
198 | 4238 | possible_transports=possible_transports) | ||
199 | 4204 | 4239 | ||
200 | 4205 | 4240 | ||
201 | 4206 | class RemoteConfig(object): | 4241 | class RemoteConfig(object): |
202 | 4207 | 4242 | ||
203 | === modified file 'breezy/bzr/smart/branch.py' | |||
204 | --- breezy/bzr/smart/branch.py 2019-03-06 21:27:22 +0000 | |||
205 | +++ breezy/bzr/smart/branch.py 2020-01-19 15:24:24 +0000 | |||
206 | @@ -439,3 +439,17 @@ | |||
207 | 439 | return SuccessfulSmartServerResponse((b'yes',)) | 439 | return SuccessfulSmartServerResponse((b'yes',)) |
208 | 440 | else: | 440 | else: |
209 | 441 | return SuccessfulSmartServerResponse((b'no',)) | 441 | return SuccessfulSmartServerResponse((b'no',)) |
210 | 442 | |||
211 | 443 | |||
212 | 444 | class SmartServerBranchRequestGetAllReferenceInfo(SmartServerBranchRequest): | ||
213 | 445 | """Get the reference information. | ||
214 | 446 | |||
215 | 447 | New in 3.1. | ||
216 | 448 | """ | ||
217 | 449 | |||
218 | 450 | def do_with_branch(self, branch): | ||
219 | 451 | all_reference_info = branch._get_all_reference_info() | ||
220 | 452 | content = bencode.bencode([ | ||
221 | 453 | (key, value[0].encode('utf-8'), value[1].encode('utf-8') if value[1] else b'') | ||
222 | 454 | for (key, value) in all_reference_info.items()]) | ||
223 | 455 | return SuccessfulSmartServerResponse((b'ok', ), content) | ||
224 | 442 | 456 | ||
225 | === modified file 'breezy/bzr/smart/request.py' | |||
226 | --- breezy/bzr/smart/request.py 2019-06-30 10:50:40 +0000 | |||
227 | +++ breezy/bzr/smart/request.py 2020-01-19 15:24:24 +0000 | |||
228 | @@ -609,6 +609,9 @@ | |||
229 | 609 | b'Branch.revision_id_to_revno', 'breezy.bzr.smart.branch', | 609 | b'Branch.revision_id_to_revno', 'breezy.bzr.smart.branch', |
230 | 610 | 'SmartServerBranchRequestRevisionIdToRevno', info='read') | 610 | 'SmartServerBranchRequestRevisionIdToRevno', info='read') |
231 | 611 | request_handlers.register_lazy( | 611 | request_handlers.register_lazy( |
232 | 612 | b'Branch.get_all_reference_info', 'breezy.bzr.smart.branch', | ||
233 | 613 | 'SmartServerBranchRequestGetAllReferenceInfo', info='read') | ||
234 | 614 | request_handlers.register_lazy( | ||
235 | 612 | b'BzrDir.checkout_metadir', 'breezy.bzr.smart.bzrdir', | 615 | b'BzrDir.checkout_metadir', 'breezy.bzr.smart.bzrdir', |
236 | 613 | 'SmartServerBzrDirRequestCheckoutMetaDir', info='read') | 616 | 'SmartServerBzrDirRequestCheckoutMetaDir', info='read') |
237 | 614 | request_handlers.register_lazy( | 617 | request_handlers.register_lazy( |
238 | 615 | 618 | ||
239 | === modified file 'breezy/git/branch.py' | |||
240 | --- breezy/git/branch.py 2020-01-18 16:15:37 +0000 | |||
241 | +++ breezy/git/branch.py 2020-01-19 15:24:24 +0000 | |||
242 | @@ -348,6 +348,8 @@ | |||
243 | 348 | """True if this branch format store revision numbers.""" | 348 | """True if this branch format store revision numbers.""" |
244 | 349 | return False | 349 | return False |
245 | 350 | 350 | ||
246 | 351 | supports_reference_locations = False | ||
247 | 352 | |||
248 | 351 | 353 | ||
249 | 352 | class LocalGitBranchFormat(GitBranchFormat): | 354 | class LocalGitBranchFormat(GitBranchFormat): |
250 | 353 | 355 | ||
251 | 354 | 356 | ||
252 | === modified file 'breezy/plugins/weave_fmt/branch.py' | |||
253 | --- breezy/plugins/weave_fmt/branch.py 2018-11-11 04:08:32 +0000 | |||
254 | +++ breezy/plugins/weave_fmt/branch.py 2020-01-19 15:24:24 +0000 | |||
255 | @@ -215,3 +215,5 @@ | |||
256 | 215 | 215 | ||
257 | 216 | def supports_leaving_lock(self): | 216 | def supports_leaving_lock(self): |
258 | 217 | return False | 217 | return False |
259 | 218 | |||
260 | 219 | supports_reference_locations = False | ||
261 | 218 | 220 | ||
262 | === modified file 'breezy/tests/blackbox/test_branch.py' | |||
263 | --- breezy/tests/blackbox/test_branch.py 2020-01-19 03:22:04 +0000 | |||
264 | +++ breezy/tests/blackbox/test_branch.py 2020-01-19 15:24:24 +0000 | |||
265 | @@ -557,9 +557,10 @@ | |||
266 | 557 | # become necessary for this use case. Please do not adjust this number | 557 | # become necessary for this use case. Please do not adjust this number |
267 | 558 | # upwards without agreement from bzr's network support maintainers. | 558 | # upwards without agreement from bzr's network support maintainers. |
268 | 559 | self.assertLength(2, self.hpss_connections) | 559 | self.assertLength(2, self.hpss_connections) |
272 | 560 | self.assertLength(33, self.hpss_calls) | 560 | self.assertLength(34, self.hpss_calls) |
273 | 561 | self.expectFailure("branching to the same branch requires VFS access", | 561 | self.expectFailure( |
274 | 562 | self.assertThat, self.hpss_calls, ContainsNoVfsCalls) | 562 | "branching to the same branch requires VFS access", |
275 | 563 | self.assertThat, self.hpss_calls, ContainsNoVfsCalls) | ||
276 | 563 | 564 | ||
277 | 564 | def test_branch_from_trivial_branch_streaming_acceptance(self): | 565 | def test_branch_from_trivial_branch_streaming_acceptance(self): |
278 | 565 | self.setup_smart_server_with_call_log() | 566 | self.setup_smart_server_with_call_log() |
279 | @@ -575,7 +576,7 @@ | |||
280 | 575 | # become necessary for this use case. Please do not adjust this number | 576 | # become necessary for this use case. Please do not adjust this number |
281 | 576 | # upwards without agreement from bzr's network support maintainers. | 577 | # upwards without agreement from bzr's network support maintainers. |
282 | 577 | self.assertThat(self.hpss_calls, ContainsNoVfsCalls) | 578 | self.assertThat(self.hpss_calls, ContainsNoVfsCalls) |
284 | 578 | self.assertLength(10, self.hpss_calls) | 579 | self.assertLength(11, self.hpss_calls) |
285 | 579 | self.assertLength(1, self.hpss_connections) | 580 | self.assertLength(1, self.hpss_connections) |
286 | 580 | 581 | ||
287 | 581 | def test_branch_from_trivial_stacked_branch_streaming_acceptance(self): | 582 | def test_branch_from_trivial_stacked_branch_streaming_acceptance(self): |
288 | @@ -597,7 +598,7 @@ | |||
289 | 597 | # being too low. If rpc_count increases, more network roundtrips have | 598 | # being too low. If rpc_count increases, more network roundtrips have |
290 | 598 | # become necessary for this use case. Please do not adjust this number | 599 | # become necessary for this use case. Please do not adjust this number |
291 | 599 | # upwards without agreement from bzr's network support maintainers. | 600 | # upwards without agreement from bzr's network support maintainers. |
293 | 600 | self.assertLength(15, self.hpss_calls) | 601 | self.assertLength(16, self.hpss_calls) |
294 | 601 | self.assertLength(1, self.hpss_connections) | 602 | self.assertLength(1, self.hpss_connections) |
295 | 602 | self.assertThat(self.hpss_calls, ContainsNoVfsCalls) | 603 | self.assertThat(self.hpss_calls, ContainsNoVfsCalls) |
296 | 603 | 604 | ||
297 | @@ -617,7 +618,7 @@ | |||
298 | 617 | # being too low. If rpc_count increases, more network roundtrips have | 618 | # being too low. If rpc_count increases, more network roundtrips have |
299 | 618 | # become necessary for this use case. Please do not adjust this number | 619 | # become necessary for this use case. Please do not adjust this number |
300 | 619 | # upwards without agreement from bzr's network support maintainers. | 620 | # upwards without agreement from bzr's network support maintainers. |
302 | 620 | self.assertLength(10, self.hpss_calls) | 621 | self.assertLength(11, self.hpss_calls) |
303 | 621 | self.assertThat(self.hpss_calls, ContainsNoVfsCalls) | 622 | self.assertThat(self.hpss_calls, ContainsNoVfsCalls) |
304 | 622 | self.assertLength(1, self.hpss_connections) | 623 | self.assertLength(1, self.hpss_connections) |
305 | 623 | 624 | ||
306 | @@ -659,7 +660,7 @@ | |||
307 | 659 | # become necessary for this use case. Please do not adjust this number | 660 | # become necessary for this use case. Please do not adjust this number |
308 | 660 | # upwards without agreement from bzr's network support maintainers. | 661 | # upwards without agreement from bzr's network support maintainers. |
309 | 661 | self.assertThat(self.hpss_calls, ContainsNoVfsCalls) | 662 | self.assertThat(self.hpss_calls, ContainsNoVfsCalls) |
311 | 662 | self.assertLength(11, self.hpss_calls) | 663 | self.assertLength(12, self.hpss_calls) |
312 | 663 | self.assertLength(1, self.hpss_connections) | 664 | self.assertLength(1, self.hpss_connections) |
313 | 664 | 665 | ||
314 | 665 | 666 | ||
315 | 666 | 667 | ||
316 | === modified file 'breezy/tests/blackbox/test_checkout.py' | |||
317 | --- breezy/tests/blackbox/test_checkout.py 2018-11-11 04:08:32 +0000 | |||
318 | +++ breezy/tests/blackbox/test_checkout.py 2020-01-19 15:24:24 +0000 | |||
319 | @@ -211,7 +211,7 @@ | |||
320 | 211 | # being too low. If rpc_count increases, more network roundtrips have | 211 | # being too low. If rpc_count increases, more network roundtrips have |
321 | 212 | # become necessary for this use case. Please do not adjust this number | 212 | # become necessary for this use case. Please do not adjust this number |
322 | 213 | # upwards without agreement from bzr's network support maintainers. | 213 | # upwards without agreement from bzr's network support maintainers. |
324 | 214 | self.assertLength(10, self.hpss_calls) | 214 | self.assertLength(11, self.hpss_calls) |
325 | 215 | self.assertLength(1, self.hpss_connections) | 215 | self.assertLength(1, self.hpss_connections) |
326 | 216 | self.assertThat(self.hpss_calls, ContainsNoVfsCalls) | 216 | self.assertThat(self.hpss_calls, ContainsNoVfsCalls) |
327 | 217 | 217 | ||
328 | 218 | 218 | ||
329 | === modified file 'breezy/tests/blackbox/test_pull.py' | |||
330 | --- breezy/tests/blackbox/test_pull.py 2019-02-09 02:59:15 +0000 | |||
331 | +++ breezy/tests/blackbox/test_pull.py 2020-01-19 15:24:24 +0000 | |||
332 | @@ -413,7 +413,7 @@ | |||
333 | 413 | # being too low. If rpc_count increases, more network roundtrips have | 413 | # being too low. If rpc_count increases, more network roundtrips have |
334 | 414 | # become necessary for this use case. Please do not adjust this number | 414 | # become necessary for this use case. Please do not adjust this number |
335 | 415 | # upwards without agreement from bzr's network support maintainers. | 415 | # upwards without agreement from bzr's network support maintainers. |
337 | 416 | self.assertLength(19, self.hpss_calls) | 416 | self.assertLength(20, self.hpss_calls) |
338 | 417 | self.assertLength(1, self.hpss_connections) | 417 | self.assertLength(1, self.hpss_connections) |
339 | 418 | remote = branch.Branch.open('stacked') | 418 | remote = branch.Branch.open('stacked') |
340 | 419 | self.assertEndsWith(remote.get_stacked_on_url(), '/parent') | 419 | self.assertEndsWith(remote.get_stacked_on_url(), '/parent') |
341 | 420 | 420 | ||
342 | === modified file 'breezy/tests/per_workingtree/test_workingtree.py' | |||
343 | --- breezy/tests/per_workingtree/test_workingtree.py 2020-01-19 03:22:04 +0000 | |||
344 | +++ breezy/tests/per_workingtree/test_workingtree.py 2020-01-19 15:24:24 +0000 | |||
345 | @@ -1385,8 +1385,8 @@ | |||
346 | 1385 | tree = WorkingTree.open('branch') | 1385 | tree = WorkingTree.open('branch') |
347 | 1386 | branch_location = tree.get_reference_info('path/to/file') | 1386 | branch_location = tree.get_reference_info('path/to/file') |
348 | 1387 | self.assertEqual( | 1387 | self.assertEqual( |
351 | 1388 | urlutils.local_path_to_url('branch/path/to/location'), | 1388 | urlutils.join(urlutils.strip_segment_parameters(tree.branch.user_url), 'path/to/location'), |
352 | 1389 | urlutils.join(tree.branch.user_url, branch_location)) | 1389 | urlutils.join(urlutils.strip_segment_parameters(tree.branch.user_url), branch_location)) |
353 | 1390 | 1390 | ||
354 | 1391 | def test_set_null_reference_info(self): | 1391 | def test_set_null_reference_info(self): |
355 | 1392 | tree = self.make_branch_and_tree('branch') | 1392 | tree = self.make_branch_and_tree('branch') |
356 | @@ -1443,7 +1443,8 @@ | |||
357 | 1443 | tree = self.make_tree_with_reference('branch', '../reference') | 1443 | tree = self.make_tree_with_reference('branch', '../reference') |
358 | 1444 | new_tree = tree.branch.controldir.sprout('new-branch').open_workingtree() | 1444 | new_tree = tree.branch.controldir.sprout('new-branch').open_workingtree() |
359 | 1445 | self.assertEqual( | 1445 | self.assertEqual( |
361 | 1446 | urlutils.local_path_to_url('reference'), | 1446 | urlutils.join(urlutils.strip_segment_parameters(tree.branch.user_url), |
362 | 1447 | '../reference'), | ||
363 | 1447 | urlutils.join(urlutils.strip_segment_parameters(new_tree.branch.user_url), | 1448 | urlutils.join(urlutils.strip_segment_parameters(new_tree.branch.user_url), |
364 | 1448 | new_tree.get_reference_info('path/to/file'))) | 1449 | new_tree.get_reference_info('path/to/file'))) |
365 | 1449 | 1450 | ||
366 | @@ -1451,7 +1452,7 @@ | |||
367 | 1451 | tree = self.make_tree_with_reference('branch', '../reference') | 1452 | tree = self.make_tree_with_reference('branch', '../reference') |
368 | 1452 | new_tree = tree.controldir.clone('new-branch').open_workingtree() | 1453 | new_tree = tree.controldir.clone('new-branch').open_workingtree() |
369 | 1453 | self.assertEqual( | 1454 | self.assertEqual( |
371 | 1454 | urlutils.local_path_to_url('reference'), | 1455 | urlutils.join(urlutils.strip_segment_parameters(tree.branch.user_url), '../reference'), |
372 | 1455 | urlutils.join(urlutils.strip_segment_parameters(new_tree.branch.user_url), | 1456 | urlutils.join(urlutils.strip_segment_parameters(new_tree.branch.user_url), |
373 | 1456 | new_tree.get_reference_info('path/to/file'))) | 1457 | new_tree.get_reference_info('path/to/file'))) |
374 | 1457 | 1458 | ||
375 | @@ -1460,7 +1461,8 @@ | |||
376 | 1460 | new_tree = tree.controldir.sprout( | 1461 | new_tree = tree.controldir.sprout( |
377 | 1461 | 'branch/new-branch').open_workingtree() | 1462 | 'branch/new-branch').open_workingtree() |
378 | 1462 | self.assertEqual( | 1463 | self.assertEqual( |
380 | 1463 | urlutils.local_path_to_url('branch/reference'), | 1464 | urlutils.join(urlutils.strip_segment_parameters(tree.branch.user_url), |
381 | 1465 | 'reference'), | ||
382 | 1464 | urlutils.join(urlutils.strip_segment_parameters(new_tree.branch.user_url), | 1466 | urlutils.join(urlutils.strip_segment_parameters(new_tree.branch.user_url), |
383 | 1465 | new_tree.get_reference_info('path/to/file'))) | 1467 | new_tree.get_reference_info('path/to/file'))) |
384 | 1466 | 1468 | ||
385 | @@ -1470,7 +1472,9 @@ | |||
386 | 1470 | 'new_branch', 'reference2') | 1472 | 'new_branch', 'reference2') |
387 | 1471 | new_tree.branch.update_references(tree.branch) | 1473 | new_tree.branch.update_references(tree.branch) |
388 | 1472 | self.assertEqual( | 1474 | self.assertEqual( |
390 | 1473 | urlutils.local_path_to_url('branch/reference'), | 1475 | urlutils.join( |
391 | 1476 | urlutils.strip_segment_parameters(tree.branch.user_url), | ||
392 | 1477 | 'reference'), | ||
393 | 1474 | urlutils.join( | 1478 | urlutils.join( |
394 | 1475 | urlutils.strip_segment_parameters(tree.branch.user_url), | 1479 | urlutils.strip_segment_parameters(tree.branch.user_url), |
395 | 1476 | tree.get_reference_info('path/to/file'))) | 1480 | tree.get_reference_info('path/to/file'))) |
396 | @@ -1481,7 +1485,9 @@ | |||
397 | 1481 | 'new_branch', 'reference2') | 1485 | 'new_branch', 'reference2') |
398 | 1482 | new_tree.branch.update_references(tree.branch) | 1486 | new_tree.branch.update_references(tree.branch) |
399 | 1483 | self.assertEqual( | 1487 | self.assertEqual( |
401 | 1484 | urlutils.local_path_to_url('branch/reference'), | 1488 | urlutils.join( |
402 | 1489 | urlutils.strip_segment_parameters(tree.branch.user_url), | ||
403 | 1490 | 'reference'), | ||
404 | 1485 | urlutils.join( | 1491 | urlutils.join( |
405 | 1486 | urlutils.strip_segment_parameters(tree.branch.user_url), | 1492 | urlutils.strip_segment_parameters(tree.branch.user_url), |
406 | 1487 | tree.get_reference_info('path/to/file'))) | 1493 | tree.get_reference_info('path/to/file'))) |
407 | @@ -1495,7 +1501,9 @@ | |||
408 | 1495 | new_tree.set_reference_info('foo', '../foo') | 1501 | new_tree.set_reference_info('foo', '../foo') |
409 | 1496 | new_tree.branch.update_references(tree.branch) | 1502 | new_tree.branch.update_references(tree.branch) |
410 | 1497 | self.assertEqual( | 1503 | self.assertEqual( |
412 | 1498 | urlutils.local_path_to_url('branch/reference'), | 1504 | urlutils.join( |
413 | 1505 | urlutils.strip_segment_parameters(tree.branch.user_url), | ||
414 | 1506 | 'reference'), | ||
415 | 1499 | urlutils.join( | 1507 | urlutils.join( |
416 | 1500 | urlutils.strip_segment_parameters(tree.branch.user_url), | 1508 | urlutils.strip_segment_parameters(tree.branch.user_url), |
417 | 1501 | tree.get_reference_info('path/to/file'))) | 1509 | tree.get_reference_info('path/to/file'))) |
418 | @@ -1510,7 +1518,7 @@ | |||
419 | 1510 | new_tree.commit('set reference') | 1518 | new_tree.commit('set reference') |
420 | 1511 | tree.pull(new_tree.branch) | 1519 | tree.pull(new_tree.branch) |
421 | 1512 | self.assertEqual( | 1520 | self.assertEqual( |
423 | 1513 | urlutils.local_path_to_url('branch/foo'), | 1521 | urlutils.join(urlutils.strip_segment_parameters(new_tree.branch.user_url), '../foo'), |
424 | 1514 | urlutils.join(tree.branch.user_url, tree.get_reference_info('foo'))) | 1522 | urlutils.join(tree.branch.user_url, tree.get_reference_info('foo'))) |
425 | 1515 | 1523 | ||
426 | 1516 | def test_push_updates_references(self): | 1524 | def test_push_updates_references(self): |
427 | @@ -1524,8 +1532,8 @@ | |||
428 | 1524 | tree.pull(new_tree.branch) | 1532 | tree.pull(new_tree.branch) |
429 | 1525 | tree.update() | 1533 | tree.update() |
430 | 1526 | self.assertEqual( | 1534 | self.assertEqual( |
433 | 1527 | urlutils.local_path_to_url('branch/foo'), | 1535 | urlutils.join(urlutils.strip_segment_parameters(new_tree.branch.user_url), '../foo'), |
434 | 1528 | urlutils.join(tree.branch.user_url, tree.get_reference_info('foo'))) | 1536 | urlutils.join(urlutils.strip_segment_parameters(tree.branch.user_url), tree.get_reference_info('foo'))) |
435 | 1529 | 1537 | ||
436 | 1530 | def test_merge_updates_references(self): | 1538 | def test_merge_updates_references(self): |
437 | 1531 | orig_tree = self.make_tree_with_reference('branch', 'reference') | 1539 | orig_tree = self.make_tree_with_reference('branch', 'reference') |
438 | @@ -1542,5 +1550,5 @@ | |||
439 | 1542 | merger.merge_type = merge.Merge3Merger | 1550 | merger.merge_type = merge.Merge3Merger |
440 | 1543 | merger.do_merge() | 1551 | merger.do_merge() |
441 | 1544 | self.assertEqual( | 1552 | self.assertEqual( |
443 | 1545 | urlutils.local_path_to_url('branch/reference'), | 1553 | urlutils.join(urlutils.strip_segment_parameters(orig_tree.branch.user_url), 'reference'), |
444 | 1546 | urlutils.join(urlutils.strip_segment_parameters(tree.branch.user_url), tree.get_reference_info('path/to/file'))) | 1554 | urlutils.join(urlutils.strip_segment_parameters(tree.branch.user_url), tree.get_reference_info('path/to/file'))) |
445 | 1547 | 1555 | ||
446 | === modified file 'breezy/tests/test_remote.py' | |||
447 | --- breezy/tests/test_remote.py 2019-11-06 01:31:41 +0000 | |||
448 | +++ breezy/tests/test_remote.py 2020-01-19 15:24:24 +0000 | |||
449 | @@ -4529,3 +4529,23 @@ | |||
450 | 4529 | (b'baserevid', b'line 1\n'), | 4529 | (b'baserevid', b'line 1\n'), |
451 | 4530 | (b'somerevid', b'line2\n')], | 4530 | (b'somerevid', b'line2\n')], |
452 | 4531 | list(tree.annotate_iter('filename'))) | 4531 | list(tree.annotate_iter('filename'))) |
453 | 4532 | |||
454 | 4533 | |||
455 | 4534 | class TestBranchGetAllReferenceInfo(RemoteBranchTestCase): | ||
456 | 4535 | |||
457 | 4536 | def test_get_all_reference_info(self): | ||
458 | 4537 | transport = MemoryTransport() | ||
459 | 4538 | client = FakeClient(transport.base) | ||
460 | 4539 | client.add_expected_call( | ||
461 | 4540 | b'Branch.get_stacked_on_url', (b'quack/',), | ||
462 | 4541 | b'error', (b'NotStacked',)) | ||
463 | 4542 | client.add_expected_call( | ||
464 | 4543 | b'Branch.get_all_reference_info', (b'quack/',), | ||
465 | 4544 | b'success', (b'ok',), bencode.bencode([ | ||
466 | 4545 | (b'file-id', b'https://www.example.com/', b'')])) | ||
467 | 4546 | transport.mkdir('quack') | ||
468 | 4547 | transport = transport.clone('quack') | ||
469 | 4548 | branch = self.make_remote_branch(transport, client) | ||
470 | 4549 | result = branch._get_all_reference_info() | ||
471 | 4550 | self.assertFinished(client) | ||
472 | 4551 | self.assertEqual({b'file-id': ('https://www.example.com/', None)}, result) | ||
473 | 4532 | 4552 | ||
474 | === modified file 'breezy/tests/test_smart.py' | |||
475 | --- breezy/tests/test_smart.py 2019-12-23 03:04:00 +0000 | |||
476 | +++ breezy/tests/test_smart.py 2020-01-19 15:24:24 +0000 | |||
477 | @@ -2819,3 +2819,18 @@ | |||
478 | 2819 | self.assertEqual( | 2819 | self.assertEqual( |
479 | 2820 | [[b'somerev', b'somecontents\n'], [b'somerev', b'morecontents\n']], | 2820 | [[b'somerev', b'somecontents\n'], [b'somerev', b'morecontents\n']], |
480 | 2821 | bencode.bdecode(response.body)) | 2821 | bencode.bdecode(response.body)) |
481 | 2822 | |||
482 | 2823 | |||
483 | 2824 | class TestSmartServerBranchRequestGetAllReferenceInfo(TestLockedBranch): | ||
484 | 2825 | |||
485 | 2826 | def test_get_some(self): | ||
486 | 2827 | backing = self.get_transport() | ||
487 | 2828 | request = smart_branch.SmartServerBranchRequestGetAllReferenceInfo(backing) | ||
488 | 2829 | branch = self.make_branch('.') | ||
489 | 2830 | branch.set_reference_info('some/path', 'http://www.example.com/') | ||
490 | 2831 | response = request.execute(b'') | ||
491 | 2832 | self.assertTrue(response.is_successful()) | ||
492 | 2833 | self.assertEqual(response.args, (b"ok", )) | ||
493 | 2834 | self.assertEqual( | ||
494 | 2835 | [[b'some/path', b'http://www.example.com/', b'']], | ||
495 | 2836 | bencode.bdecode(response.body)) | ||
496 | 2822 | 2837 | ||
497 | === modified file 'doc/en/release-notes/brz-3.1.txt' | |||
498 | --- doc/en/release-notes/brz-3.1.txt 2020-01-12 23:41:10 +0000 | |||
499 | +++ doc/en/release-notes/brz-3.1.txt 2020-01-19 15:24:24 +0000 | |||
500 | @@ -46,6 +46,9 @@ | |||
501 | 46 | have installed and speeds up import time since psutil brings in | 46 | have installed and speeds up import time since psutil brings in |
502 | 47 | various other modules. (Jelmer Vernooij) | 47 | various other modules. (Jelmer Vernooij) |
503 | 48 | 48 | ||
504 | 49 | * Information about tree references can now be updated on remote | ||
505 | 50 | branches. (Jelmer Vernooij) | ||
506 | 51 | |||
507 | 49 | * Warn the user when they attempt to use Breezy in a Subversion | 52 | * Warn the user when they attempt to use Breezy in a Subversion |
508 | 50 | working copy. (Jelmer Vernooij) | 53 | working copy. (Jelmer Vernooij) |
509 | 51 | 54 |
Running landing tests failed /ci.breezy- vcs.org/ job/brz/ job/brz- land/621/
https:/