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

  • Committer: Jelmer Vernooij
  • Date: 2020-03-22 19:39:52 UTC
  • mfrom: (7490.7.6 work)
  • mto: (7490.40.19 work)
  • mto: This revision was merged to the branch mainline in revision 7516.
  • Revision ID: jelmer@jelmer.uk-20200322193952-i9nl0jdw4pb2exn0
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
237
237
 
238
238
    supports_merge_proposal_labels = True
239
239
    supports_merge_proposal_commit_message = False
 
240
    supports_allow_collaboration = True
240
241
    merge_proposal_description_format = 'markdown'
241
242
 
242
243
    def __repr__(self):
280
281
            return json.loads(response.text)
281
282
        raise InvalidHttpResponse(path, response.text)
282
283
 
283
 
    def _create_pull(self, path, title, head, base, body=None, labels=None, assignee=None, draft=False):
 
284
    def _create_pull(self, path, title, head, base, body=None, labels=None,
 
285
                     assignee=None, draft=False, maintainer_can_modify=False):
284
286
        data = {
285
287
            'title': title,
286
288
            'head': head,
287
289
            'base': base,
288
290
            'draft': draft,
 
291
            'maintainer_can_modify': maintainer_can_modify,
289
292
        }
290
293
        if labels is not None:
291
294
            data['labels'] = labels
556
559
 
557
560
    def create_proposal(self, description, reviewers=None, labels=None,
558
561
                        prerequisite_branch=None, commit_message=None,
559
 
                        work_in_progress=False):
 
562
                        work_in_progress=False, allow_collaboration=False):
560
563
        """Perform the submission."""
561
564
        if prerequisite_branch is not None:
562
565
            raise PrerequisiteBranchUnsupported(self)
566
569
            self.target_repo_name = self.target_repo_name[:-4]
567
570
        # TODO(jelmer): Allow setting title explicitly?
568
571
        title = determine_title(description)
569
 
        # TODO(jelmer): Set maintainers_can_modify?
570
572
        target_repo = self.gh._get_repo(
571
573
            self.target_owner, self.target_repo_name)
572
574
        assignees = []
587
589
                head="%s:%s" % (self.source_owner, self.source_branch_name),
588
590
                base=self.target_branch_name,
589
591
                labels=labels, assignee=assignees,
590
 
                draft=(not work_in_progress))
 
592
                draft=work_in_progress,
 
593
                maintainer_can_modify=allow_collaboration,
 
594
                )
591
595
        except ValidationFailed:
592
596
            raise MergeProposalExists(self.source_branch.user_url)
593
597
        return GitHubMergeProposal(self.gh, pull_request)