/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/propose/propose.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-06-03 23:55:03 UTC
  • mfrom: (7296.9.5 land)
  • Revision ID: breezy.the.bot@gmail.com-20190603235503-7jzh8ex3k73gm28d
Add a 'brz land' subcommand.

Merged from https://code.launchpad.net/~jelmer/brz/land/+merge/366609

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
        """Check whether this merge proposal has been merged."""
136
136
        raise NotImplementedError(self.is_merged)
137
137
 
 
138
    def merge(self, commit_message=None):
 
139
        """Merge this merge proposal."""
 
140
        raise NotImplementedError(self.merge)
 
141
 
138
142
 
139
143
class MergeProposalBuilder(object):
140
144
    """Merge proposal creator.
225
229
        raise NotImplementedError(self.get_proposer)
226
230
 
227
231
    def iter_proposals(self, source_branch, target_branch, status='open'):
228
 
        """Get a merge proposal for a specified branch tuple.
 
232
        """Get the merge proposals for a specified branch tuple.
229
233
 
230
234
        :param source_branch: Source branch
231
235
        :param target_branch: Target branch
234
238
        """
235
239
        raise NotImplementedError(self.iter_proposals)
236
240
 
 
241
    def get_proposal_by_url(self, url):
 
242
        """Retrieve a branch proposal by URL.
 
243
 
 
244
        :param url: Merge proposal URL.
 
245
        :return: MergeProposal object
 
246
        :raise UnsupportedHoster: Hoster does not support this URL
 
247
        """
 
248
        raise NotImplementedError(self.get_proposal_by_url)
 
249
 
237
250
    def hosts(self, branch):
238
251
        """Return true if this hoster hosts given branch."""
239
252
        raise NotImplementedError(self.hosts)
289
302
    raise UnsupportedHoster(branch)
290
303
 
291
304
 
 
305
def get_proposal_by_url(url):
 
306
    for name, hoster_cls in hosters.items():
 
307
        for instance in hoster_cls.iter_instances():
 
308
            try:
 
309
                return instance.get_proposal_by_url(url)
 
310
            except UnsupportedHoster:
 
311
                pass
 
312
    raise UnsupportedHoster(url)
 
313
 
 
314
 
292
315
hosters = registry.Registry()
293
316
hosters.register_lazy(
294
317
    "launchpad", "breezy.plugins.propose.launchpad",