145
148
help='Use the hoster.',
146
lazy_registry=('breezy.propose', 'hosters')),
147
ListOption('reviewers', short_name='R', type=str,
149
lazy_registry=('breezy.plugins.propose.propose', 'hosters')),
150
ListOption('reviewers', short_name='R', type=text_type,
148
151
help='Requested reviewers.'),
149
152
Option('name', help='Name of the new remote branch.', type=str),
150
153
Option('description', help='Description of the change.', type=str),
154
157
'commit-message',
155
158
help='Set commit message for merge, if supported', type=str),
156
ListOption('labels', short_name='l', type=str,
159
ListOption('labels', short_name='l', type=text_type,
157
160
help='Labels to apply.'),
158
161
Option('no-allow-lossy',
159
162
help='Allow fallback to lossy push, if necessary.'),
161
164
help='Allow collaboration from target branch maintainer(s)'),
162
165
Option('allow-empty',
163
166
help='Do not prevent empty merge proposals.'),
164
Option('overwrite', help="Overwrite existing commits."),
166
168
takes_args = ['submit_branch?']
170
172
def run(self, submit_branch=None, directory='.', hoster=None,
171
173
reviewers=None, name=None, no_allow_lossy=False, description=None,
172
174
labels=None, prerequisite=None, commit_message=None, wip=False,
173
allow_collaboration=False, allow_empty=False, overwrite=False):
175
allow_collaboration=False, allow_empty=False):
174
176
tree, branch, relpath = (
175
177
controldir.ControlDir.open_containing_tree_or_branch(directory))
176
178
if submit_branch is None:
191
193
name = branch_name(branch)
192
194
remote_branch, public_branch_url = hoster.publish_derived(
193
branch, target, name=name, allow_lossy=not no_allow_lossy,
195
branch, target, name=name, allow_lossy=not no_allow_lossy)
195
196
branch.set_push_location(remote_branch.user_url)
196
197
branch.set_submit_branch(target.user_url)
197
198
note(gettext('Published branch to %s') % public_branch_url)
267
267
all='All merge proposals',
268
268
open='Open merge proposals',
269
269
merged='Merged merge proposals',
270
closed='Closed merge proposals'),
273
help='Use the hoster.',
274
lazy_registry=('breezy.propose', 'hosters')),
277
def run(self, status='open', verbose=False, hoster=None, base_url=None):
279
for instance in _mod_propose.iter_hoster_instances(hoster=hoster):
280
if base_url is not None and instance.base_url != base_url:
270
closed='Closed merge proposals')]
272
def run(self, status='open', verbose=False):
273
for name, hoster_cls in _mod_propose.hosters.items():
274
for instance in hoster_cls.iter_instances():
283
275
for mp in instance.iter_my_proposals(status=status):
284
276
self.outf.write('%s\n' % mp.url)
286
source_branch_url = mp.get_source_branch_url()
287
if source_branch_url:
289
'(Merging %s into %s)\n' %
291
mp.get_target_branch_url()))
294
'(Merging into %s)\n' %
295
mp.get_target_branch_url())
279
'(Merging %s into %s)\n' %
280
(mp.get_source_branch_url(),
281
mp.get_target_branch_url()))
296
282
description = mp.get_description()
298
284
self.outf.writelines(
300
286
for l in description.splitlines()])
301
287
self.outf.write('\n')
302
except _mod_propose.HosterLoginRequired as e:
303
warning('Skipping %r, login required.', instance)
306
290
class cmd_land_merge_proposal(Command):
313
297
def run(self, url, message=None):
314
298
proposal = _mod_propose.get_proposal_by_url(url)
315
299
proposal.merge(commit_message=message)
318
class cmd_hosters(Command):
319
__doc__ = """List all known hosting sites and user details."""
324
for instance in _mod_propose.iter_hoster_instances():
325
current_user = instance.get_current_user()
326
if current_user is not None:
327
current_user_url = instance.get_user_url(current_user)
328
if current_user_url is not None:
330
gettext('%s (%s) - user: %s (%s)\n') % (
331
instance.name, instance.base_url,
332
current_user, current_user_url))
335
gettext('%s (%s) - user: %s\n') % (
336
instance.name, instance.base_url,
340
gettext('%s (%s) - not logged in\n') % (
341
instance.name, instance.base_url))