~jelmer/brz/byov-trunk

« back to all changes in this revision

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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-03-07 15:17:55 UTC
  • mfrom: (7496.1.2 trunk-merge-3.0)
  • Revision ID: breezy.the.bot@gmail.com-20200307151755-b5g0v8o9r80qhmp5
Merge the lp:brz/3.1 branch.

Merged from https://code.launchpad.net/~jelmer/brz/trunk-merge-3.1/+merge/380392

Show diffs side-by-side

added added

removed removed

Lines of Context:
275
275
            return json.loads(response.text)
276
276
        raise InvalidHttpResponse(path, response.text)
277
277
 
278
 
    def _create_pull(self, path, title, head, base, body=None, labels=None, assignee=None, draft=False):
 
278
    def _create_pull(self, path, title, head, base, body=None, labels=None,
 
279
                     assignee=None, draft=False, maintainer_can_modify=False):
279
280
        data = {
280
281
            'title': title,
281
282
            'head': head,
282
283
            'base': base,
283
284
            'draft': draft,
 
285
            'maintainer_can_modify': maintainer_can_modify,
284
286
        }
285
287
        if labels is not None:
286
288
            data['labels'] = labels
551
553
 
552
554
    def create_proposal(self, description, reviewers=None, labels=None,
553
555
                        prerequisite_branch=None, commit_message=None,
554
 
                        work_in_progress=False):
 
556
                        work_in_progress=False, allow_collaboration=False):
555
557
        """Perform the submission."""
556
558
        if prerequisite_branch is not None:
557
559
            raise PrerequisiteBranchUnsupported(self)
561
563
            self.target_repo_name = self.target_repo_name[:-4]
562
564
        # TODO(jelmer): Allow setting title explicitly?
563
565
        title = determine_title(description)
564
 
        # TODO(jelmer): Set maintainers_can_modify?
565
566
        target_repo = self.gh._get_repo(
566
567
            self.target_owner, self.target_repo_name)
567
568
        assignees = []
582
583
                head="%s:%s" % (self.source_owner, self.source_branch_name),
583
584
                base=self.target_branch_name,
584
585
                labels=labels, assignee=assignees,
585
 
                draft=(not work_in_progress))
 
586
                draft=work_in_progress,
 
587
                maintainer_can_modify=allow_collaboration,
 
588
                )
586
589
        except ValidationFailed:
587
590
            raise MergeProposalExists(self.source_branch.user_url)
588
591
        return GitHubMergeProposal(self.gh, pull_request)