/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-03-02 21:51:19 UTC
  • mfrom: (7268.12.3 probe-url)
  • Revision ID: breezy.the.bot@gmail.com-20190302215119-7lhcqje0t7xvkbfj
Split out a 'probe_from_url' method on Hoster.

Merged from https://code.launchpad.net/~jelmer/brz/probe-url/+merge/362951

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    errors,
23
23
    hooks,
24
24
    registry,
 
25
    urlutils,
25
26
    )
26
27
 
27
28
 
225
226
        raise NotImplementedError(self.hosts)
226
227
 
227
228
    @classmethod
228
 
    def probe(cls, branch):
 
229
    def probe_from_branch(cls, branch):
229
230
        """Create a Hoster object if this hoster knows about a branch."""
230
 
        raise NotImplementedError(cls.probe)
 
231
        url = urlutils.split_segment_parameters(branch.user_url)[0]
 
232
        return cls.probe_from_url(url)
 
233
 
 
234
    @classmethod
 
235
    def probe_from_url(cls, url):
 
236
        """Create a Hoster object if this hoster knows about a URL."""
 
237
        raise NotImplementedError(cls.probe_from_url)
231
238
 
232
239
    # TODO(jelmer): Some way of cleaning up old branch proposals/branches
233
240
 
259
266
                return hoster
260
267
    for name, hoster_cls in hosters.items():
261
268
        try:
262
 
            hoster = hoster_cls.probe(branch)
 
269
            hoster = hoster_cls.probe_from_branch(branch)
263
270
        except UnsupportedHoster:
264
271
            pass
265
272
        else: