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
1=== modified file 'breezy/plugins/propose/cmds.py'
2--- breezy/plugins/propose/cmds.py 2020-01-28 23:34:28 +0000
3+++ breezy/plugins/propose/cmds.py 2020-03-07 13:31:56 +0000
4@@ -152,6 +152,8 @@
5 help='Labels to apply.'),
6 Option('no-allow-lossy',
7 help='Allow fallback to lossy push, if necessary.'),
8+ Option('allow-collaboration',
9+ help='Allow collaboration from target branch maintainer(s)'),
10 ]
11 takes_args = ['submit_branch?']
12
13@@ -159,7 +161,8 @@
14
15 def run(self, submit_branch=None, directory='.', hoster=None,
16 reviewers=None, name=None, no_allow_lossy=False, description=None,
17- labels=None, prerequisite=None, commit_message=None, wip=False):
18+ labels=None, prerequisite=None, commit_message=None, wip=False,
19+ allow_collaboration=False):
20 tree, branch, relpath = (
21 controldir.ControlDir.open_containing_tree_or_branch(directory))
22 if submit_branch is None:
23@@ -199,7 +202,7 @@
24 description=description, reviewers=reviewers,
25 prerequisite_branch=prerequisite_branch, labels=labels,
26 commit_message=commit_message,
27- work_in_progress=wip)
28+ work_in_progress=wip, allow_collaboration=allow_collaboration)
29 except _mod_propose.MergeProposalExists as e:
30 note(gettext('There is already a branch merge proposal: %s'), e.url)
31 else:
32
33=== modified file 'breezy/plugins/propose/github.py'
34--- breezy/plugins/propose/github.py 2020-03-07 10:21:23 +0000
35+++ breezy/plugins/propose/github.py 2020-03-07 13:31:56 +0000
36@@ -280,12 +280,14 @@
37 return json.loads(response.text)
38 raise InvalidHttpResponse(path, response.text)
39
40- def _create_pull(self, path, title, head, base, body=None, labels=None, assignee=None, draft=False):
41+ def _create_pull(self, path, title, head, base, body=None, labels=None,
42+ assignee=None, draft=False, maintainers_can_modify=False):
43 data = {
44 'title': title,
45 'head': head,
46 'base': base,
47 'draft': draft,
48+ 'maintainers_can_modify': maintainers_can_modify,
49 }
50 if labels is not None:
51 data['labels'] = labels
52@@ -556,7 +558,7 @@
53
54 def create_proposal(self, description, reviewers=None, labels=None,
55 prerequisite_branch=None, commit_message=None,
56- work_in_progress=False):
57+ work_in_progress=False, allow_collaboration=False):
58 """Perform the submission."""
59 if prerequisite_branch is not None:
60 raise PrerequisiteBranchUnsupported(self)
61@@ -587,7 +589,9 @@
62 head="%s:%s" % (self.source_owner, self.source_branch_name),
63 base=self.target_branch_name,
64 labels=labels, assignee=assignees,
65- draft=work_in_progress)
66+ draft=work_in_progress,
67+ maintainer_can_modify=allow_collaboration,
68+ )
69 except ValidationFailed:
70 raise MergeProposalExists(self.source_branch.user_url)
71 return GitHubMergeProposal(self.gh, pull_request)
72
73=== modified file 'breezy/plugins/propose/gitlabs.py'
74--- breezy/plugins/propose/gitlabs.py 2020-02-18 03:11:01 +0000
75+++ breezy/plugins/propose/gitlabs.py 2020-03-07 13:31:56 +0000
76@@ -588,7 +588,7 @@
77
78 def create_proposal(self, description, reviewers=None, labels=None,
79 prerequisite_branch=None, commit_message=None,
80- work_in_progress=False):
81+ work_in_progress=False, allow_collaboration=False):
82 """Perform the submission."""
83 # https://docs.gitlab.com/ee/api/merge_requests.html#create-mr
84 if prerequisite_branch is not None:
85@@ -600,7 +600,6 @@
86 title = determine_title(description)
87 if work_in_progress:
88 title = 'WIP: %s' % title
89- # TODO(jelmer): Allow setting allow_collaboration field
90 # TODO(jelmer): Allow setting milestone field
91 # TODO(jelmer): Allow setting squash field
92 kwargs = {
93@@ -609,7 +608,8 @@
94 'target_project_id': target_project['id'],
95 'source_branch_name': self.source_branch_name,
96 'target_branch_name': self.target_branch_name,
97- 'description': description}
98+ 'description': description,
99+ 'allow_collaboration': allow_collaboration}
100 if labels:
101 kwargs['labels'] = ','.join(labels)
102 if reviewers:
103
104=== modified file 'breezy/plugins/propose/launchpad.py'
105--- breezy/plugins/propose/launchpad.py 2020-02-18 03:11:01 +0000
106+++ breezy/plugins/propose/launchpad.py 2020-03-07 13:31:56 +0000
107@@ -550,7 +550,7 @@
108
109 def create_proposal(self, description, reviewers=None, labels=None,
110 prerequisite_branch=None, commit_message=None,
111- work_in_progress=False):
112+ work_in_progress=False, allow_collaboration=False):
113 """Perform the submission."""
114 if labels:
115 raise LabelsUnsupported(self)
116
117=== modified file 'breezy/propose.py'
118--- breezy/propose.py 2020-02-18 03:11:01 +0000
119+++ breezy/propose.py 2020-03-07 13:31:56 +0000
120@@ -202,7 +202,7 @@
121
122 def create_proposal(self, description, reviewers=None, labels=None,
123 prerequisite_branch=None, commit_message=None,
124- work_in_progress=False):
125+ work_in_progress=False, allow_collaboration=False):
126 """Create a proposal to merge a branch for merging.
127
128 :param description: Description for the merge proposal
129@@ -212,6 +212,9 @@
130 :param commit_message: Optional commit message
131 :param work_in_progress:
132 Whether this merge proposal is still a work-in-progress
133+ :param allow_collaboration:
134+ Whether to allow changes to the branch from the target branch
135+ maintainer(s)
136 :return: A `MergeProposal` object
137 """
138 raise NotImplementedError(self.create_proposal)

Subscribers

People subscribed via source and target branches