Merge lp:~jelmer/brz/allow-collaboration into lp:brz/3.1

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/allow-collaboration
Merge into: lp:brz/3.1
Diff against target: 138 lines (+20/-10)
5 files modified
breezy/plugins/propose/cmds.py (+5/-2)
breezy/plugins/propose/github.py (+7/-3)
breezy/plugins/propose/gitlabs.py (+3/-3)
breezy/plugins/propose/launchpad.py (+1/-1)
breezy/propose.py (+4/-1)
To merge this branch: bzr merge lp:~jelmer/brz/allow-collaboration
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+380390@code.launchpad.net

Commit message

Add allow-collaboration flag.

Description of the change

Add allow-collaboration flag.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/plugins/propose/cmds.py'
--- breezy/plugins/propose/cmds.py 2020-01-28 23:34:28 +0000
+++ breezy/plugins/propose/cmds.py 2020-03-07 13:31:56 +0000
@@ -152,6 +152,8 @@
152 help='Labels to apply.'),152 help='Labels to apply.'),
153 Option('no-allow-lossy',153 Option('no-allow-lossy',
154 help='Allow fallback to lossy push, if necessary.'),154 help='Allow fallback to lossy push, if necessary.'),
155 Option('allow-collaboration',
156 help='Allow collaboration from target branch maintainer(s)'),
155 ]157 ]
156 takes_args = ['submit_branch?']158 takes_args = ['submit_branch?']
157159
@@ -159,7 +161,8 @@
159161
160 def run(self, submit_branch=None, directory='.', hoster=None,162 def run(self, submit_branch=None, directory='.', hoster=None,
161 reviewers=None, name=None, no_allow_lossy=False, description=None,163 reviewers=None, name=None, no_allow_lossy=False, description=None,
162 labels=None, prerequisite=None, commit_message=None, wip=False):164 labels=None, prerequisite=None, commit_message=None, wip=False,
165 allow_collaboration=False):
163 tree, branch, relpath = (166 tree, branch, relpath = (
164 controldir.ControlDir.open_containing_tree_or_branch(directory))167 controldir.ControlDir.open_containing_tree_or_branch(directory))
165 if submit_branch is None:168 if submit_branch is None:
@@ -199,7 +202,7 @@
199 description=description, reviewers=reviewers,202 description=description, reviewers=reviewers,
200 prerequisite_branch=prerequisite_branch, labels=labels,203 prerequisite_branch=prerequisite_branch, labels=labels,
201 commit_message=commit_message,204 commit_message=commit_message,
202 work_in_progress=wip)205 work_in_progress=wip, allow_collaboration=allow_collaboration)
203 except _mod_propose.MergeProposalExists as e:206 except _mod_propose.MergeProposalExists as e:
204 note(gettext('There is already a branch merge proposal: %s'), e.url)207 note(gettext('There is already a branch merge proposal: %s'), e.url)
205 else:208 else:
206209
=== modified file 'breezy/plugins/propose/github.py'
--- breezy/plugins/propose/github.py 2020-03-07 10:21:23 +0000
+++ breezy/plugins/propose/github.py 2020-03-07 13:31:56 +0000
@@ -280,12 +280,14 @@
280 return json.loads(response.text)280 return json.loads(response.text)
281 raise InvalidHttpResponse(path, response.text)281 raise InvalidHttpResponse(path, response.text)
282282
283 def _create_pull(self, path, title, head, base, body=None, labels=None, assignee=None, draft=False):283 def _create_pull(self, path, title, head, base, body=None, labels=None,
284 assignee=None, draft=False, maintainers_can_modify=False):
284 data = {285 data = {
285 'title': title,286 'title': title,
286 'head': head,287 'head': head,
287 'base': base,288 'base': base,
288 'draft': draft,289 'draft': draft,
290 'maintainers_can_modify': maintainers_can_modify,
289 }291 }
290 if labels is not None:292 if labels is not None:
291 data['labels'] = labels293 data['labels'] = labels
@@ -556,7 +558,7 @@
556558
557 def create_proposal(self, description, reviewers=None, labels=None,559 def create_proposal(self, description, reviewers=None, labels=None,
558 prerequisite_branch=None, commit_message=None,560 prerequisite_branch=None, commit_message=None,
559 work_in_progress=False):561 work_in_progress=False, allow_collaboration=False):
560 """Perform the submission."""562 """Perform the submission."""
561 if prerequisite_branch is not None:563 if prerequisite_branch is not None:
562 raise PrerequisiteBranchUnsupported(self)564 raise PrerequisiteBranchUnsupported(self)
@@ -587,7 +589,9 @@
587 head="%s:%s" % (self.source_owner, self.source_branch_name),589 head="%s:%s" % (self.source_owner, self.source_branch_name),
588 base=self.target_branch_name,590 base=self.target_branch_name,
589 labels=labels, assignee=assignees,591 labels=labels, assignee=assignees,
590 draft=work_in_progress)592 draft=work_in_progress,
593 maintainer_can_modify=allow_collaboration,
594 )
591 except ValidationFailed:595 except ValidationFailed:
592 raise MergeProposalExists(self.source_branch.user_url)596 raise MergeProposalExists(self.source_branch.user_url)
593 return GitHubMergeProposal(self.gh, pull_request)597 return GitHubMergeProposal(self.gh, pull_request)
594598
=== modified file 'breezy/plugins/propose/gitlabs.py'
--- breezy/plugins/propose/gitlabs.py 2020-02-18 03:11:01 +0000
+++ breezy/plugins/propose/gitlabs.py 2020-03-07 13:31:56 +0000
@@ -588,7 +588,7 @@
588588
589 def create_proposal(self, description, reviewers=None, labels=None,589 def create_proposal(self, description, reviewers=None, labels=None,
590 prerequisite_branch=None, commit_message=None,590 prerequisite_branch=None, commit_message=None,
591 work_in_progress=False):591 work_in_progress=False, allow_collaboration=False):
592 """Perform the submission."""592 """Perform the submission."""
593 # https://docs.gitlab.com/ee/api/merge_requests.html#create-mr593 # https://docs.gitlab.com/ee/api/merge_requests.html#create-mr
594 if prerequisite_branch is not None:594 if prerequisite_branch is not None:
@@ -600,7 +600,6 @@
600 title = determine_title(description)600 title = determine_title(description)
601 if work_in_progress:601 if work_in_progress:
602 title = 'WIP: %s' % title602 title = 'WIP: %s' % title
603 # TODO(jelmer): Allow setting allow_collaboration field
604 # TODO(jelmer): Allow setting milestone field603 # TODO(jelmer): Allow setting milestone field
605 # TODO(jelmer): Allow setting squash field604 # TODO(jelmer): Allow setting squash field
606 kwargs = {605 kwargs = {
@@ -609,7 +608,8 @@
609 'target_project_id': target_project['id'],608 'target_project_id': target_project['id'],
610 'source_branch_name': self.source_branch_name,609 'source_branch_name': self.source_branch_name,
611 'target_branch_name': self.target_branch_name,610 'target_branch_name': self.target_branch_name,
612 'description': description}611 'description': description,
612 'allow_collaboration': allow_collaboration}
613 if labels:613 if labels:
614 kwargs['labels'] = ','.join(labels)614 kwargs['labels'] = ','.join(labels)
615 if reviewers:615 if reviewers:
616616
=== modified file 'breezy/plugins/propose/launchpad.py'
--- breezy/plugins/propose/launchpad.py 2020-02-18 03:11:01 +0000
+++ breezy/plugins/propose/launchpad.py 2020-03-07 13:31:56 +0000
@@ -550,7 +550,7 @@
550550
551 def create_proposal(self, description, reviewers=None, labels=None,551 def create_proposal(self, description, reviewers=None, labels=None,
552 prerequisite_branch=None, commit_message=None,552 prerequisite_branch=None, commit_message=None,
553 work_in_progress=False):553 work_in_progress=False, allow_collaboration=False):
554 """Perform the submission."""554 """Perform the submission."""
555 if labels:555 if labels:
556 raise LabelsUnsupported(self)556 raise LabelsUnsupported(self)
557557
=== modified file 'breezy/propose.py'
--- breezy/propose.py 2020-02-18 03:11:01 +0000
+++ breezy/propose.py 2020-03-07 13:31:56 +0000
@@ -202,7 +202,7 @@
202202
203 def create_proposal(self, description, reviewers=None, labels=None,203 def create_proposal(self, description, reviewers=None, labels=None,
204 prerequisite_branch=None, commit_message=None,204 prerequisite_branch=None, commit_message=None,
205 work_in_progress=False):205 work_in_progress=False, allow_collaboration=False):
206 """Create a proposal to merge a branch for merging.206 """Create a proposal to merge a branch for merging.
207207
208 :param description: Description for the merge proposal208 :param description: Description for the merge proposal
@@ -212,6 +212,9 @@
212 :param commit_message: Optional commit message212 :param commit_message: Optional commit message
213 :param work_in_progress:213 :param work_in_progress:
214 Whether this merge proposal is still a work-in-progress214 Whether this merge proposal is still a work-in-progress
215 :param allow_collaboration:
216 Whether to allow changes to the branch from the target branch
217 maintainer(s)
215 :return: A `MergeProposal` object218 :return: A `MergeProposal` object
216 """219 """
217 raise NotImplementedError(self.create_proposal)220 raise NotImplementedError(self.create_proposal)

Subscribers

People subscribed via source and target branches