/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/propose.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-11 12:46:45 UTC
  • mfrom: (7511.1.1 actions-no-fork)
  • Revision ID: breezy.the.bot@gmail.com-20200611124645-4lx66gps99i0hmzh
Avoid using fork when running the testsuite in github actions.

Merged from https://code.launchpad.net/~jelmer/brz/actions-no-fork/+merge/385565

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
        """Return the source branch."""
127
127
        raise NotImplementedError(self.get_source_branch_url)
128
128
 
129
 
    def get_source_revision(self):
130
 
        """Return the latest revision for the source branch."""
131
 
        raise NotImplementedError(self.get_source_revision)
132
 
 
133
129
    def get_target_branch_url(self):
134
130
        """Return the target branch."""
135
131
        raise NotImplementedError(self.get_target_branch_url)
176
172
        """
177
173
        raise NotImplementedError(self.get_merged_at)
178
174
 
179
 
    def post_comment(self, body):
180
 
        """Post a comment on the merge proposal.
181
 
 
182
 
        Args:
183
 
          body: Body of the comment
184
 
        """
185
 
        raise NotImplementedError(self.post_comment)
186
 
 
187
175
 
188
176
class MergeProposalBuilder(object):
189
177
    """Merge proposal creator.
238
226
    # proposals?
239
227
    supports_merge_proposal_labels = None
240
228
 
241
 
    @property
242
 
    def name(self):
243
 
        """Name of this instance."""
244
 
        return "%s at %s" % (type(self).__name__, self.base_url)
245
 
 
246
229
    # Does this hoster support suggesting a commit message in the
247
230
    # merge proposal?
248
231
    supports_merge_proposal_commit_message = None
269
252
        :raise HosterLoginRequired: Action requires a hoster login, but none is
270
253
            known.
271
254
        """
272
 
        raise NotImplementedError(self.publish_derived)
 
255
        raise NotImplementedError(self.publish)
273
256
 
274
257
    def get_derived_branch(self, base_branch, name, project=None, owner=None):
275
258
        """Get a derived branch ('a fork').
357
340
        """
358
341
        raise NotImplementedError(cls.iter_instances)
359
342
 
360
 
    def get_current_user(self):
361
 
        """Retrieve the name of the currently logged in user.
362
 
 
363
 
        :return: Username or None if not logged in
364
 
        """
365
 
        raise NotImplementedError(self.get_current_user)
366
 
 
367
 
    def get_user_url(self, user):
368
 
        """Rerieve the web URL for a user."""
369
 
        raise NotImplementedError(self.get_user_url)
370
 
 
371
343
 
372
344
def determine_title(description):
373
345
    """Determine the title for a merge proposal based on full description."""
398
370
    raise UnsupportedHoster(branch)
399
371
 
400
372
 
401
 
def iter_hoster_instances():
402
 
    """Iterate over all known hoster instances.
403
 
 
404
 
    :return: Iterator over Hoster instances
405
 
    """
406
 
    for name, hoster_cls in hosters.items():
407
 
        for instance in hoster_cls.iter_instances():
408
 
            yield instance
409
 
 
410
 
 
411
373
def get_proposal_by_url(url):
412
374
    """Get the proposal object associated with a URL.
413
375
 
415
377
    :raise UnsupportedHoster: if there is no hoster that supports the URL
416
378
    :return: A `MergeProposal` object
417
379
    """
418
 
    for instance in iter_hoster_instances():
419
 
        try:
420
 
            return instance.get_proposal_by_url(url)
421
 
        except UnsupportedHoster:
422
 
            pass
 
380
    for name, hoster_cls in hosters.items():
 
381
        for instance in hoster_cls.iter_instances():
 
382
            try:
 
383
                return instance.get_proposal_by_url(url)
 
384
            except UnsupportedHoster:
 
385
                pass
423
386
    raise UnsupportedHoster(url)
424
387
 
425
388