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/forge |
Merge into: | lp:brz |
Diff against target: |
793 lines (+162/-162) 13 files modified
breezy/plugins/github/__init__.py (+2/-2) breezy/plugins/github/forge.py (+7/-7) breezy/plugins/gitlab/__init__.py (+2/-2) breezy/plugins/gitlab/cmds.py (+2/-2) breezy/plugins/gitlab/forge.py (+15/-15) breezy/plugins/gitlab/tests/__init__.py (+2/-2) breezy/plugins/gitlab/tests/test_forge.py (+1/-1) breezy/plugins/launchpad/__init__.py (+2/-2) breezy/plugins/launchpad/forge.py (+6/-6) breezy/plugins/propose/__init__.py (+1/-1) breezy/plugins/propose/cmds.py (+21/-21) breezy/propose.py (+71/-71) breezy/tests/test_propose.py (+30/-30) |
To merge this branch: | bzr merge lp:~jelmer/brz/forge |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email: mp+423445@code.launchpad.net |
Commit message
s/Hoster/Forge/
Description of the change
s/Hoster/Forge/
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 : | # |
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote : | # |
Running landing tests failed
https:/
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'breezy/plugins/github/__init__.py' |
2 | --- breezy/plugins/github/__init__.py 2020-06-01 14:06:02 +0000 |
3 | +++ breezy/plugins/github/__init__.py 2022-07-08 09:31:18 +0000 |
4 | @@ -24,8 +24,8 @@ |
5 | plugin_cmds.register_lazy("cmd_github_login", ["gh-login"], __name__ + ".cmds") |
6 | |
7 | |
8 | -from ...propose import hosters |
9 | -hosters.register_lazy("github", __name__ + '.hoster', "GitHub") |
10 | +from ...propose import forges |
11 | +forges.register_lazy("github", __name__ + '.forge', "GitHub") |
12 | |
13 | |
14 | def test_suite(): |
15 | |
16 | === renamed file 'breezy/plugins/github/hoster.py' => 'breezy/plugins/github/forge.py' |
17 | --- breezy/plugins/github/hoster.py 2021-08-19 16:05:04 +0000 |
18 | +++ breezy/plugins/github/forge.py 2022-07-08 09:31:18 +0000 |
19 | @@ -21,15 +21,15 @@ |
20 | |
21 | from ...propose import ( |
22 | determine_title, |
23 | - Hoster, |
24 | - HosterLoginRequired, |
25 | + Forge, |
26 | + ForgeLoginRequired, |
27 | MergeProposal, |
28 | MergeProposalBuilder, |
29 | MergeProposalExists, |
30 | NoSuchProject, |
31 | PrerequisiteBranchUnsupported, |
32 | ReopenFailed, |
33 | - UnsupportedHoster, |
34 | + UnsupportedForge, |
35 | ) |
36 | |
37 | from ... import ( |
38 | @@ -91,7 +91,7 @@ |
39 | self.url = url |
40 | |
41 | |
42 | -class GitHubLoginRequired(HosterLoginRequired): |
43 | +class GitHubLoginRequired(ForgeLoginRequired): |
44 | |
45 | _fmt = "Action requires GitHub login." |
46 | |
47 | @@ -259,7 +259,7 @@ |
48 | return url.split('{')[0] |
49 | |
50 | |
51 | -class GitHub(Hoster): |
52 | +class GitHub(Forge): |
53 | |
54 | name = 'github' |
55 | |
56 | @@ -534,7 +534,7 @@ |
57 | try: |
58 | parse_github_url(url) |
59 | except NotGitHubUrl: |
60 | - raise UnsupportedHoster(url) |
61 | + raise UnsupportedForge(url) |
62 | transport = get_transport( |
63 | API_GITHUB_URL, possible_transports=possible_transports) |
64 | return cls(transport) |
65 | @@ -565,7 +565,7 @@ |
66 | yield GitHubMergeProposal(self, json.loads(response.text)) |
67 | |
68 | def get_proposal_by_url(self, url): |
69 | - raise UnsupportedHoster(url) |
70 | + raise UnsupportedForge(url) |
71 | |
72 | def iter_my_forks(self, owner=None): |
73 | if owner: |
74 | |
75 | === modified file 'breezy/plugins/gitlab/__init__.py' |
76 | --- breezy/plugins/gitlab/__init__.py 2020-06-01 13:58:16 +0000 |
77 | +++ breezy/plugins/gitlab/__init__.py 2022-07-08 09:31:18 +0000 |
78 | @@ -24,8 +24,8 @@ |
79 | plugin_cmds.register_lazy("cmd_gitlab_login", ["gl-login"], __name__ + ".cmds") |
80 | |
81 | |
82 | -from ...propose import hosters |
83 | -hosters.register_lazy("gitlab", __name__ + '.hoster', "GitLab") |
84 | +from ...propose import forges |
85 | +forges.register_lazy("gitlab", __name__ + '.forge', "GitLab") |
86 | |
87 | |
88 | def test_suite(): |
89 | |
90 | === modified file 'breezy/plugins/gitlab/cmds.py' |
91 | --- breezy/plugins/gitlab/cmds.py 2021-10-23 21:51:23 +0000 |
92 | +++ breezy/plugins/gitlab/cmds.py 2022-07-08 09:31:18 +0000 |
93 | @@ -58,7 +58,7 @@ |
94 | |
95 | def run(self, url, private_token=None, name=None, no_check=False): |
96 | from breezy import ui |
97 | - from .hoster import store_gitlab_token |
98 | + from .forge import store_gitlab_token |
99 | if name is None: |
100 | try: |
101 | name = urlutils.parse_url(url)[3].split('.')[-2] |
102 | @@ -71,6 +71,6 @@ |
103 | private_token = ui.ui_factory.get_password(u'Private token') |
104 | if not no_check: |
105 | from breezy.transport import get_transport |
106 | - from .hoster import GitLab |
107 | + from .forge import GitLab |
108 | GitLab(get_transport(url), private_token=private_token) |
109 | store_gitlab_token(name=name, url=url, private_token=private_token) |
110 | |
111 | === renamed file 'breezy/plugins/gitlab/hoster.py' => 'breezy/plugins/gitlab/forge.py' |
112 | --- breezy/plugins/gitlab/hoster.py 2022-03-09 20:58:17 +0000 |
113 | +++ breezy/plugins/gitlab/forge.py 2022-07-08 09:31:18 +0000 |
114 | @@ -34,15 +34,15 @@ |
115 | |
116 | from ...propose import ( |
117 | determine_title, |
118 | - Hoster, |
119 | + Forge, |
120 | MergeProposal, |
121 | MergeProposalBuilder, |
122 | MergeProposalExists, |
123 | NoSuchProject, |
124 | PrerequisiteBranchUnsupported, |
125 | SourceNotDerivedFromTarget, |
126 | - UnsupportedHoster, |
127 | - HosterLoginRequired, |
128 | + UnsupportedForge, |
129 | + ForgeLoginRequired, |
130 | ) |
131 | |
132 | |
133 | @@ -107,9 +107,9 @@ |
134 | self.target_host = target_host |
135 | |
136 | |
137 | -class GitLabLoginMissing(HosterLoginRequired): |
138 | +class GitLabLoginMissing(ForgeLoginRequired): |
139 | |
140 | - _fmt = ("Please log into GitLab instance at %(hoster)s") |
141 | + _fmt = ("Please log into GitLab instance at %(forge)s") |
142 | |
143 | |
144 | class GitlabLoginError(errors.BzrError): |
145 | @@ -354,8 +354,8 @@ |
146 | return git_url_to_bzr_url(url, branch=name) |
147 | |
148 | |
149 | -class GitLab(Hoster): |
150 | - """GitLab hoster implementation.""" |
151 | +class GitLab(Forge): |
152 | + """GitLab forge implementation.""" |
153 | |
154 | supports_merge_proposal_labels = True |
155 | supports_merge_proposal_commit_message = False |
156 | @@ -708,14 +708,14 @@ |
157 | raise GitLabLoginMissing(self.base_url) |
158 | else: |
159 | raise GitlabLoginError(response.text) |
160 | - raise UnsupportedHoster(self.base_url) |
161 | + raise UnsupportedForge(self.base_url) |
162 | |
163 | @classmethod |
164 | def probe_from_url(cls, url, possible_transports=None): |
165 | try: |
166 | (host, project) = parse_gitlab_url(url) |
167 | except NotGitLabUrl: |
168 | - raise UnsupportedHoster(url) |
169 | + raise UnsupportedForge(url) |
170 | transport = get_transport( |
171 | 'https://%s' % host, possible_transports=possible_transports) |
172 | credentials = get_credentials_by_url(transport.base) |
173 | @@ -727,13 +727,13 @@ |
174 | resp = transport.request( |
175 | 'GET', 'https://%s/api/v4/projects/%s' % (host, urlutils.quote(str(project), ''))) |
176 | except errors.UnexpectedHttpStatus as e: |
177 | - raise UnsupportedHoster(url) |
178 | + raise UnsupportedForge(url) |
179 | else: |
180 | if not resp.getheader('X-Gitlab-Feature-Category'): |
181 | - raise UnsupportedHoster(url) |
182 | + raise UnsupportedForge(url) |
183 | if resp.status in (200, 401): |
184 | raise GitLabLoginMissing('https://%s/' % host) |
185 | - raise UnsupportedHoster(url) |
186 | + raise UnsupportedForge(url) |
187 | |
188 | @classmethod |
189 | def iter_instances(cls): |
190 | @@ -764,14 +764,14 @@ |
191 | try: |
192 | (host, project, merge_id) = parse_gitlab_merge_request_url(url) |
193 | except NotGitLabUrl: |
194 | - raise UnsupportedHoster(url) |
195 | + raise UnsupportedForge(url) |
196 | except NotMergeRequestUrl as e: |
197 | if self.base_hostname == e.host: |
198 | raise |
199 | else: |
200 | - raise UnsupportedHoster(url) |
201 | + raise UnsupportedForge(url) |
202 | if self.base_hostname != host: |
203 | - raise UnsupportedHoster(url) |
204 | + raise UnsupportedForge(url) |
205 | project = self._get_project(project) |
206 | mr = self._get_merge_request(project['path_with_namespace'], merge_id) |
207 | return GitLabMergeProposal(self, mr) |
208 | |
209 | === modified file 'breezy/plugins/gitlab/tests/__init__.py' |
210 | --- breezy/plugins/gitlab/tests/__init__.py 2020-06-01 13:58:16 +0000 |
211 | +++ breezy/plugins/gitlab/tests/__init__.py 2022-07-08 09:31:18 +0000 |
212 | @@ -19,8 +19,8 @@ |
213 | |
214 | def test_suite(): |
215 | result = TestSuite() |
216 | - from . import test_hoster |
217 | + from . import test_forge |
218 | |
219 | loader = TestLoader() |
220 | - result.addTests(loader.loadTestsFromModule(test_hoster)) |
221 | + result.addTests(loader.loadTestsFromModule(test_forge)) |
222 | return result |
223 | |
224 | === renamed file 'breezy/plugins/gitlab/tests/test_hoster.py' => 'breezy/plugins/gitlab/tests/test_forge.py' |
225 | --- breezy/plugins/gitlab/tests/test_hoster.py 2020-06-01 13:58:16 +0000 |
226 | +++ breezy/plugins/gitlab/tests/test_forge.py 2022-07-08 09:31:18 +0000 |
227 | @@ -16,7 +16,7 @@ |
228 | |
229 | from breezy.tests import TestCase |
230 | |
231 | -from breezy.plugins.gitlab.hoster import ( |
232 | +from breezy.plugins.gitlab.forge import ( |
233 | parse_gitlab_merge_request_url, |
234 | NotMergeRequestUrl, |
235 | NotGitLabUrl, |
236 | |
237 | === modified file 'breezy/plugins/launchpad/__init__.py' |
238 | --- breezy/plugins/launchpad/__init__.py 2020-06-01 21:57:00 +0000 |
239 | +++ breezy/plugins/launchpad/__init__.py 2022-07-08 09:31:18 +0000 |
240 | @@ -124,5 +124,5 @@ |
241 | 'Using Bazaar with Launchpad.net') |
242 | |
243 | |
244 | -from ...propose import hosters |
245 | -hosters.register_lazy("launchpad", __name__ + '.hoster', "Launchpad") |
246 | +from ...propose import forges |
247 | +forges.register_lazy("launchpad", __name__ + '.forge', "Launchpad") |
248 | |
249 | === renamed file 'breezy/plugins/launchpad/hoster.py' => 'breezy/plugins/launchpad/forge.py' |
250 | --- breezy/plugins/launchpad/hoster.py 2021-09-28 12:08:32 +0000 |
251 | +++ breezy/plugins/launchpad/forge.py 2022-07-08 09:31:18 +0000 |
252 | @@ -22,12 +22,12 @@ |
253 | import tempfile |
254 | |
255 | from ...propose import ( |
256 | - Hoster, |
257 | + Forge, |
258 | LabelsUnsupported, |
259 | MergeProposal, |
260 | MergeProposalBuilder, |
261 | MergeProposalExists, |
262 | - UnsupportedHoster, |
263 | + UnsupportedForge, |
264 | ) |
265 | |
266 | from ... import ( |
267 | @@ -208,7 +208,7 @@ |
268 | self._mp.createComment(content=body) |
269 | |
270 | |
271 | -class Launchpad(Hoster): |
272 | +class Launchpad(Forge): |
273 | """The Launchpad hosting service.""" |
274 | |
275 | name = 'launchpad' |
276 | @@ -259,7 +259,7 @@ |
277 | def probe_from_url(cls, url, possible_transports=None): |
278 | if plausible_launchpad_url(url): |
279 | return Launchpad(uris.LPNET_SERVICE_ROOT) |
280 | - raise UnsupportedHoster(url) |
281 | + raise UnsupportedForge(url) |
282 | |
283 | def _get_lp_git_ref_from_branch(self, branch): |
284 | url, params = urlutils.split_segment_parameters(branch.user_url) |
285 | @@ -503,9 +503,9 @@ |
286 | LAUNCHPAD_CODE_DOMAINS = [ |
287 | ('code.%s' % domain) for domain in lp_uris.LAUNCHPAD_DOMAINS.values()] |
288 | if host not in LAUNCHPAD_CODE_DOMAINS: |
289 | - raise UnsupportedHoster(url) |
290 | + raise UnsupportedForge(url) |
291 | # TODO(jelmer): Check if this is a launchpad URL. Otherwise, raise |
292 | - # UnsupportedHoster |
293 | + # UnsupportedForge |
294 | # See https://api.launchpad.net/devel/#branch_merge_proposal |
295 | # the syntax is: |
296 | # https://api.launchpad.net/devel/~<author.name>/<project.name>/<branch.name>/+merge/<id> |
297 | |
298 | === modified file 'breezy/plugins/propose/__init__.py' |
299 | --- breezy/plugins/propose/__init__.py 2020-07-28 02:11:05 +0000 |
300 | +++ breezy/plugins/propose/__init__.py 2022-07-08 09:31:18 +0000 |
301 | @@ -26,7 +26,7 @@ |
302 | plugin_cmds.register_lazy( |
303 | "cmd_my_merge_proposals", ["my-proposals"], |
304 | __name__ + ".cmds") |
305 | -plugin_cmds.register_lazy("cmd_hosters", [], __name__ + ".cmds") |
306 | +plugin_cmds.register_lazy("cmd_forges", [], __name__ + ".cmds") |
307 | |
308 | |
309 | def test_suite(): |
310 | |
311 | === modified file 'breezy/plugins/propose/cmds.py' |
312 | --- breezy/plugins/propose/cmds.py 2022-02-28 22:48:07 +0000 |
313 | +++ breezy/plugins/propose/cmds.py 2022-07-08 09:31:18 +0000 |
314 | @@ -89,8 +89,8 @@ |
315 | _check_already_merged(local_branch, submit_branch) |
316 | if name is None: |
317 | name = branch_name(local_branch) |
318 | - hoster = _mod_propose.get_hoster(submit_branch) |
319 | - remote_branch, public_url = hoster.publish_derived( |
320 | + forge = _mod_propose.get_forge(submit_branch) |
321 | + remote_branch, public_url = forge.publish_derived( |
322 | local_branch, submit_branch, name=name, project=project, |
323 | owner=owner, allow_lossy=not no_allow_lossy, |
324 | overwrite=overwrite) |
325 | @@ -141,9 +141,9 @@ |
326 | takes_options = [ |
327 | 'directory', |
328 | RegistryOption( |
329 | - 'hoster', |
330 | - help='Use the hoster.', |
331 | - lazy_registry=('breezy.propose', 'hosters')), |
332 | + 'forge', |
333 | + help='Use the forge.', |
334 | + lazy_registry=('breezy.propose', 'forges')), |
335 | ListOption('reviewers', short_name='R', type=str, |
336 | help='Requested reviewers.'), |
337 | Option('name', help='Name of the new remote branch.', type=str), |
338 | @@ -167,7 +167,7 @@ |
339 | |
340 | aliases = ['propose'] |
341 | |
342 | - def run(self, submit_branch=None, directory='.', hoster=None, |
343 | + def run(self, submit_branch=None, directory='.', forge=None, |
344 | reviewers=None, name=None, no_allow_lossy=False, description=None, |
345 | labels=None, prerequisite=None, commit_message=None, wip=False, |
346 | allow_collaboration=False, allow_empty=False, overwrite=False): |
347 | @@ -183,13 +183,13 @@ |
348 | target = _mod_branch.Branch.open(submit_branch) |
349 | if not allow_empty: |
350 | _check_already_merged(branch, target) |
351 | - if hoster is None: |
352 | - hoster = _mod_propose.get_hoster(target) |
353 | + if forge is None: |
354 | + forge = _mod_propose.get_forge(target) |
355 | else: |
356 | - hoster = hoster.probe(target) |
357 | + forge = forge.probe(target) |
358 | if name is None: |
359 | name = branch_name(branch) |
360 | - remote_branch, public_branch_url = hoster.publish_derived( |
361 | + remote_branch, public_branch_url = forge.publish_derived( |
362 | branch, target, name=name, allow_lossy=not no_allow_lossy, |
363 | overwrite=overwrite) |
364 | branch.set_push_location(remote_branch.user_url) |
365 | @@ -199,7 +199,7 @@ |
366 | prerequisite_branch = _mod_branch.Branch.open(prerequisite) |
367 | else: |
368 | prerequisite_branch = None |
369 | - proposal_builder = hoster.get_proposer(remote_branch, target) |
370 | + proposal_builder = forge.get_proposer(remote_branch, target) |
371 | if description is None: |
372 | body = proposal_builder.get_initial_body() |
373 | info = proposal_builder.get_infotext() |
374 | @@ -243,8 +243,8 @@ |
375 | gettext("No target location specified or remembered")) |
376 | else: |
377 | target = _mod_branch.Branch.open(submit_branch) |
378 | - hoster = _mod_propose.get_hoster(branch) |
379 | - for mp in hoster.iter_proposals(branch, target): |
380 | + forge = _mod_propose.get_forge(branch) |
381 | + for mp in forge.iter_proposals(branch, target): |
382 | self.outf.write(gettext('Merge proposal: %s\n') % mp.url) |
383 | |
384 | |
385 | @@ -269,14 +269,14 @@ |
386 | merged='Merged merge proposals', |
387 | closed='Closed merge proposals'), |
388 | RegistryOption( |
389 | - 'hoster', |
390 | - help='Use the hoster.', |
391 | - lazy_registry=('breezy.propose', 'hosters')), |
392 | + 'forge', |
393 | + help='Use the forge.', |
394 | + lazy_registry=('breezy.propose', 'forges')), |
395 | ] |
396 | |
397 | - def run(self, status='open', verbose=False, hoster=None, base_url=None): |
398 | + def run(self, status='open', verbose=False, forge=None, base_url=None): |
399 | |
400 | - for instance in _mod_propose.iter_hoster_instances(hoster=hoster): |
401 | + for instance in _mod_propose.iter_forge_instances(forge=forge): |
402 | if base_url is not None and instance.base_url != base_url: |
403 | continue |
404 | try: |
405 | @@ -299,7 +299,7 @@ |
406 | ['\t%s\n' % l |
407 | for l in description.splitlines()]) |
408 | self.outf.write('\n') |
409 | - except _mod_propose.HosterLoginRequired as e: |
410 | + except _mod_propose.ForgeLoginRequired as e: |
411 | warning('Skipping %s, login required.', instance) |
412 | |
413 | |
414 | @@ -315,13 +315,13 @@ |
415 | proposal.merge(commit_message=message) |
416 | |
417 | |
418 | -class cmd_hosters(Command): |
419 | +class cmd_forges(Command): |
420 | __doc__ = """List all known hosting sites and user details.""" |
421 | |
422 | hidden = True |
423 | |
424 | def run(self): |
425 | - for instance in _mod_propose.iter_hoster_instances(): |
426 | + for instance in _mod_propose.iter_forge_instances(): |
427 | current_user = instance.get_current_user() |
428 | if current_user is not None: |
429 | current_user_url = instance.get_user_url(current_user) |
430 | |
431 | === modified file 'breezy/propose.py' |
432 | --- breezy/propose.py 2021-08-29 19:06:53 +0000 |
433 | +++ breezy/propose.py 2022-07-08 09:31:18 +0000 |
434 | @@ -45,9 +45,9 @@ |
435 | self.existing_proposal = existing_proposal |
436 | |
437 | |
438 | -class UnsupportedHoster(errors.BzrError): |
439 | +class UnsupportedForge(errors.BzrError): |
440 | |
441 | - _fmt = "No supported hoster for %(branch)s." |
442 | + _fmt = "No supported forge for %(branch)s." |
443 | |
444 | def __init__(self, branch): |
445 | errors.BzrError.__init__(self) |
446 | @@ -73,31 +73,31 @@ |
447 | |
448 | |
449 | class LabelsUnsupported(errors.BzrError): |
450 | - """Labels not supported by this hoster.""" |
451 | - |
452 | - _fmt = "Labels are not supported by %(hoster)r." |
453 | - |
454 | - def __init__(self, hoster): |
455 | + """Labels not supported by this forge.""" |
456 | + |
457 | + _fmt = "Labels are not supported by %(forge)r." |
458 | + |
459 | + def __init__(self, forge): |
460 | errors.BzrError.__init__(self) |
461 | - self.hoster = hoster |
462 | + self.forge = forge |
463 | |
464 | |
465 | class PrerequisiteBranchUnsupported(errors.BzrError): |
466 | - """Prerequisite branch not supported by this hoster.""" |
467 | - |
468 | - def __init__(self, hoster): |
469 | - errors.BzrError.__init__(self) |
470 | - self.hoster = hoster |
471 | - |
472 | - |
473 | -class HosterLoginRequired(errors.BzrError): |
474 | - """Action requires hoster login credentials.""" |
475 | - |
476 | - _fmt = "Action requires credentials for hosting site %(hoster)r.""" |
477 | - |
478 | - def __init__(self, hoster): |
479 | - errors.BzrError.__init__(self) |
480 | - self.hoster = hoster |
481 | + """Prerequisite branch not supported by this forge.""" |
482 | + |
483 | + def __init__(self, forge): |
484 | + errors.BzrError.__init__(self) |
485 | + self.forge = forge |
486 | + |
487 | + |
488 | +class ForgeLoginRequired(errors.BzrError): |
489 | + """Action requires forge login credentials.""" |
490 | + |
491 | + _fmt = "Action requires credentials for hosting site %(forge)r.""" |
492 | + |
493 | + def __init__(self, forge): |
494 | + errors.BzrError.__init__(self) |
495 | + self.forge = forge |
496 | |
497 | |
498 | class SourceNotDerivedFromTarget(errors.BzrError): |
499 | @@ -249,11 +249,11 @@ |
500 | raise NotImplementedError(self.create_proposal) |
501 | |
502 | |
503 | -class Hoster(object): |
504 | +class Forge(object): |
505 | """A hosting site manager. |
506 | """ |
507 | |
508 | - # Does this hoster support arbitrary labels being attached to merge |
509 | + # Does this forge support arbitrary labels being attached to merge |
510 | # proposals? |
511 | supports_merge_proposal_labels = None |
512 | |
513 | @@ -262,7 +262,7 @@ |
514 | """Name of this instance.""" |
515 | return "%s at %s" % (type(self).__name__, self.base_url) |
516 | |
517 | - # Does this hoster support suggesting a commit message in the |
518 | + # Does this forge support suggesting a commit message in the |
519 | # merge proposal? |
520 | supports_merge_proposal_commit_message = None |
521 | |
522 | @@ -274,7 +274,7 @@ |
523 | # Common values: 'plain', 'markdown' |
524 | merge_proposal_description_format = None |
525 | |
526 | - # Does this hoster support the allow_collaboration flag? |
527 | + # Does this forge support the allow_collaboration flag? |
528 | supports_allow_collaboration = False |
529 | |
530 | def publish_derived(self, new_branch, base_branch, name, project=None, |
531 | @@ -285,7 +285,7 @@ |
532 | :param base_branch: branch to derive the new branch from |
533 | :param new_branch: branch to publish |
534 | :return: resulting branch, public URL |
535 | - :raise HosterLoginRequired: Action requires a hoster login, but none is |
536 | + :raise ForgeLoginRequired: Action requires a forge login, but none is |
537 | known. |
538 | """ |
539 | raise NotImplementedError(self.publish_derived) |
540 | @@ -302,7 +302,7 @@ |
541 | def get_proposer(self, source_branch, target_branch): |
542 | """Get a merge proposal creator. |
543 | |
544 | - :note: source_branch does not have to be hosted by the hoster. |
545 | + :note: source_branch does not have to be hosted by the forge. |
546 | |
547 | :param source_branch: Source branch |
548 | :param target_branch: Target branch |
549 | @@ -325,24 +325,24 @@ |
550 | |
551 | :param url: Merge proposal URL. |
552 | :return: MergeProposal object |
553 | - :raise UnsupportedHoster: Hoster does not support this URL |
554 | + :raise UnsupportedForge: Forge does not support this URL |
555 | """ |
556 | raise NotImplementedError(self.get_proposal_by_url) |
557 | |
558 | def hosts(self, branch): |
559 | - """Return true if this hoster hosts given branch.""" |
560 | + """Return true if this forge hosts given branch.""" |
561 | raise NotImplementedError(self.hosts) |
562 | |
563 | @classmethod |
564 | def probe_from_branch(cls, branch): |
565 | - """Create a Hoster object if this hoster knows about a branch.""" |
566 | + """Create a Forge object if this forge knows about a branch.""" |
567 | url = urlutils.strip_segment_parameters(branch.user_url) |
568 | return cls.probe_from_url( |
569 | url, possible_transports=[branch.control_transport]) |
570 | |
571 | @classmethod |
572 | - def probe_from_url(cls, url, possible_hosters=None): |
573 | - """Create a Hoster object if this hoster knows about a URL.""" |
574 | + def probe_from_url(cls, url, possible_forges=None): |
575 | + """Create a Forge object if this forge knows about a URL.""" |
576 | raise NotImplementedError(cls.probe_from_url) |
577 | |
578 | def iter_my_proposals(self, status='open', author=None): |
579 | @@ -352,7 +352,7 @@ |
580 | (one of: 'open', 'closed', 'merged', 'all') |
581 | :param author: Name of author to query (defaults to current user) |
582 | :return: Iterator over MergeProposal objects |
583 | - :raise HosterLoginRequired: Action requires a hoster login, but none is |
584 | + :raise ForgeLoginRequired: Action requires a forge login, but none is |
585 | known. |
586 | """ |
587 | raise NotImplementedError(self.iter_my_proposals) |
588 | @@ -374,7 +374,7 @@ |
589 | def iter_instances(cls): |
590 | """Iterate instances. |
591 | |
592 | - :return: Hoster instances |
593 | + :return: Forge instances |
594 | """ |
595 | raise NotImplementedError(cls.iter_instances) |
596 | |
597 | @@ -405,41 +405,41 @@ |
598 | return firstline[:i] |
599 | |
600 | |
601 | -def get_hoster(branch, possible_hosters=None): |
602 | - """Find the hoster for a branch. |
603 | +def get_forge(branch, possible_forges=None): |
604 | + """Find the forge for a branch. |
605 | |
606 | - :param branch: Branch to find hoster for |
607 | - :param possible_hosters: Optional list of hosters to reuse |
608 | - :raise UnsupportedHoster: if there is no hoster that supports `branch` |
609 | - :return: A `Hoster` object |
610 | + :param branch: Branch to find forge for |
611 | + :param possible_forges: Optional list of forges to reuse |
612 | + :raise UnsupportedForge: if there is no forge that supports `branch` |
613 | + :return: A `Forge` object |
614 | """ |
615 | - if possible_hosters: |
616 | - for hoster in possible_hosters: |
617 | - if hoster.hosts(branch): |
618 | - return hoster |
619 | - for name, hoster_cls in hosters.items(): |
620 | + if possible_forges: |
621 | + for forge in possible_forges: |
622 | + if forge.hosts(branch): |
623 | + return forge |
624 | + for name, forge_cls in forges.items(): |
625 | try: |
626 | - hoster = hoster_cls.probe_from_branch(branch) |
627 | - except UnsupportedHoster: |
628 | + forge = forge_cls.probe_from_branch(branch) |
629 | + except UnsupportedForge: |
630 | pass |
631 | else: |
632 | - if possible_hosters is not None: |
633 | - possible_hosters.append(hoster) |
634 | - return hoster |
635 | - raise UnsupportedHoster(branch) |
636 | - |
637 | - |
638 | -def iter_hoster_instances(hoster=None): |
639 | - """Iterate over all known hoster instances. |
640 | - |
641 | - :return: Iterator over Hoster instances |
642 | + if possible_forges is not None: |
643 | + possible_forges.append(forge) |
644 | + return forge |
645 | + raise UnsupportedForge(branch) |
646 | + |
647 | + |
648 | +def iter_forge_instances(forge=None): |
649 | + """Iterate over all known forge instances. |
650 | + |
651 | + :return: Iterator over Forge instances |
652 | """ |
653 | - if hoster is None: |
654 | - hoster_clses = [hoster_cls for name, hoster_cls in hosters.items()] |
655 | + if forge is None: |
656 | + forge_clses = [forge_cls for name, forge_cls in forges.items()] |
657 | else: |
658 | - hoster_clses = [hoster] |
659 | - for hoster_cls in hoster_clses: |
660 | - for instance in hoster_cls.iter_instances(): |
661 | + forge_clses = [forge] |
662 | + for forge_cls in forge_clses: |
663 | + for instance in forge_cls.iter_instances(): |
664 | yield instance |
665 | |
666 | |
667 | @@ -447,15 +447,15 @@ |
668 | """Get the proposal object associated with a URL. |
669 | |
670 | :param url: URL of the proposal |
671 | - :raise UnsupportedHoster: if there is no hoster that supports the URL |
672 | + :raise UnsupportedForge: if there is no forge that supports the URL |
673 | :return: A `MergeProposal` object |
674 | """ |
675 | - for instance in iter_hoster_instances(): |
676 | + for instance in iter_forge_instances(): |
677 | try: |
678 | return instance.get_proposal_by_url(url) |
679 | - except UnsupportedHoster: |
680 | + except UnsupportedForge: |
681 | pass |
682 | - raise UnsupportedHoster(url) |
683 | - |
684 | - |
685 | -hosters = registry.Registry() |
686 | + raise UnsupportedForge(url) |
687 | + |
688 | + |
689 | +forges = registry.Registry() |
690 | |
691 | === modified file 'breezy/tests/test_propose.py' |
692 | --- breezy/tests/test_propose.py 2021-03-27 10:37:44 +0000 |
693 | +++ breezy/tests/test_propose.py 2022-07-08 09:31:18 +0000 |
694 | @@ -19,10 +19,10 @@ |
695 | from ..propose import ( |
696 | determine_title, |
697 | get_proposal_by_url, |
698 | - get_hoster, |
699 | - Hoster, |
700 | + get_forge, |
701 | + Forge, |
702 | MergeProposal, |
703 | - UnsupportedHoster, |
704 | + UnsupportedForge, |
705 | ) |
706 | from .. import ( |
707 | propose as _mod_propose, |
708 | @@ -39,7 +39,7 @@ |
709 | """Sample merge proposal.""" |
710 | |
711 | |
712 | -class SampleHoster(Hoster): |
713 | +class SampleForge(Forge): |
714 | |
715 | _locations = [] |
716 | |
717 | @@ -52,7 +52,7 @@ |
718 | for b in cls._locations: |
719 | if url.startswith(b): |
720 | return cls() |
721 | - raise UnsupportedHoster(url) |
722 | + raise UnsupportedForge(url) |
723 | |
724 | def hosts(self, branch): |
725 | for b in self._locations: |
726 | @@ -68,42 +68,42 @@ |
727 | for b in self._locations: |
728 | if url.startswith(b): |
729 | return MergeProposal() |
730 | - raise UnsupportedHoster(url) |
731 | - |
732 | - |
733 | -class SampleHosterTestCase(tests.TestCaseWithTransport): |
734 | + raise UnsupportedForge(url) |
735 | + |
736 | + |
737 | +class SampleForgeTestCase(tests.TestCaseWithTransport): |
738 | |
739 | def setUp(self): |
740 | - super(SampleHosterTestCase, self).setUp() |
741 | - self._old_hosters = _mod_propose.hosters |
742 | - _mod_propose.hosters = registry.Registry() |
743 | - self.hoster = SampleHoster() |
744 | + super(SampleForgeTestCase, self).setUp() |
745 | + self._old_forges = _mod_propose.forges |
746 | + _mod_propose.forges = registry.Registry() |
747 | + self.forge = SampleForge() |
748 | os.mkdir('hosted') |
749 | - SampleHoster._add_location( |
750 | + SampleForge._add_location( |
751 | urlutils.local_path_to_url(os.path.join(self.test_dir, 'hosted'))) |
752 | - _mod_propose.hosters.register('sample', self.hoster) |
753 | + _mod_propose.forges.register('sample', self.forge) |
754 | |
755 | def tearDown(self): |
756 | - super(SampleHosterTestCase, self).tearDown() |
757 | - _mod_propose.hosters = self._old_hosters |
758 | - SampleHoster._locations = [] |
759 | - |
760 | - |
761 | -class TestGetHosterTests(SampleHosterTestCase): |
762 | - |
763 | - def test_get_hoster(self): |
764 | + super(SampleForgeTestCase, self).tearDown() |
765 | + _mod_propose.forges = self._old_forges |
766 | + SampleForge._locations = [] |
767 | + |
768 | + |
769 | +class TestGetForgeTests(SampleForgeTestCase): |
770 | + |
771 | + def test_get_forge(self): |
772 | tree = self.make_branch_and_tree('hosted/branch') |
773 | - self.assertIs(self.hoster, get_hoster(tree.branch, [self.hoster])) |
774 | - self.assertIsInstance(get_hoster(tree.branch), SampleHoster) |
775 | + self.assertIs(self.forge, get_forge(tree.branch, [self.forge])) |
776 | + self.assertIsInstance(get_forge(tree.branch), SampleForge) |
777 | |
778 | tree = self.make_branch_and_tree('blah') |
779 | - self.assertRaises(UnsupportedHoster, get_hoster, tree.branch) |
780 | - |
781 | - |
782 | -class TestGetProposal(SampleHosterTestCase): |
783 | + self.assertRaises(UnsupportedForge, get_forge, tree.branch) |
784 | + |
785 | + |
786 | +class TestGetProposal(SampleForgeTestCase): |
787 | |
788 | def test_get_proposal_by_url(self): |
789 | - self.assertRaises(UnsupportedHoster, get_proposal_by_url, 'blah') |
790 | + self.assertRaises(UnsupportedForge, get_proposal_by_url, 'blah') |
791 | |
792 | url = urlutils.local_path_to_url(os.path.join(self.test_dir, 'hosted', 'proposal')) |
793 | self.assertIsInstance(get_proposal_by_url(url), MergeProposal) |
Running landing tests failed /ci.breezy- vcs.org/ job/brz/ job/brz- land/960/
https:/