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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-11-19 19:46:23 UTC
  • mfrom: (7524.2.5 merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20201119194623-5tfi4z6ktdzo0z3y
Merge lp:brz/3.1.

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
143
143
        RegistryOption(
144
144
            'hoster',
145
145
            help='Use the hoster.',
146
 
            lazy_registry=('breezy.plugins.propose.propose', 'hosters')),
 
146
            lazy_registry=('breezy.propose', 'hosters')),
147
147
        ListOption('reviewers', short_name='R', type=str,
148
148
                   help='Requested reviewers.'),
149
149
        Option('name', help='Name of the new remote branch.', type=str),
161
161
               help='Allow collaboration from target branch maintainer(s)'),
162
162
        Option('allow-empty',
163
163
               help='Do not prevent empty merge proposals.'),
 
164
        Option('overwrite', help="Overwrite existing commits."),
164
165
        ]
165
166
    takes_args = ['submit_branch?']
166
167
 
169
170
    def run(self, submit_branch=None, directory='.', hoster=None,
170
171
            reviewers=None, name=None, no_allow_lossy=False, description=None,
171
172
            labels=None, prerequisite=None, commit_message=None, wip=False,
172
 
            allow_collaboration=False, allow_empty=False):
 
173
            allow_collaboration=False, allow_empty=False, overwrite=False):
173
174
        tree, branch, relpath = (
174
175
            controldir.ControlDir.open_containing_tree_or_branch(directory))
175
176
        if submit_branch is None:
189
190
        if name is None:
190
191
            name = branch_name(branch)
191
192
        remote_branch, public_branch_url = hoster.publish_derived(
192
 
            branch, target, name=name, allow_lossy=not no_allow_lossy)
 
193
            branch, target, name=name, allow_lossy=not no_allow_lossy,
 
194
            overwrite=overwrite)
193
195
        branch.set_push_location(remote_branch.user_url)
194
196
        branch.set_submit_branch(target.user_url)
195
197
        note(gettext('Published branch to %s') % public_branch_url)
253
255
 
254
256
    hidden = True
255
257
 
 
258
    takes_args = ['base-url?']
256
259
    takes_options = [
257
260
        'verbose',
258
261
        RegistryOption.from_kwargs(
264
267
            all='All merge proposals',
265
268
            open='Open merge proposals',
266
269
            merged='Merged merge proposals',
267
 
            closed='Closed merge proposals')]
268
 
 
269
 
    def run(self, status='open', verbose=False):
270
 
        for instance in _mod_propose.iter_hoster_instances():
 
270
            closed='Closed merge proposals'),
 
271
        RegistryOption(
 
272
            'hoster',
 
273
            help='Use the hoster.',
 
274
            lazy_registry=('breezy.propose', 'hosters')),
 
275
        ]
 
276
 
 
277
    def run(self, status='open', verbose=False, hoster=None, base_url=None):
 
278
 
 
279
        for instance in _mod_propose.iter_hoster_instances(hoster=hoster):
 
280
            if base_url is not None and instance.base_url != base_url:
 
281
                continue
271
282
            try:
272
283
                for mp in instance.iter_my_proposals(status=status):
273
284
                    self.outf.write('%s\n' % mp.url)
274
285
                    if verbose:
275
 
                        self.outf.write(
276
 
                            '(Merging %s into %s)\n' %
277
 
                            (mp.get_source_branch_url(),
278
 
                             mp.get_target_branch_url()))
 
286
                        source_branch_url = mp.get_source_branch_url()
 
287
                        if source_branch_url:
 
288
                            self.outf.write(
 
289
                                '(Merging %s into %s)\n' %
 
290
                                (source_branch_url,
 
291
                                 mp.get_target_branch_url()))
 
292
                        else:
 
293
                            self.outf.write(
 
294
                                '(Merging into %s)\n' %
 
295
                                mp.get_target_branch_url())
279
296
                        description = mp.get_description()
280
297
                        if description:
281
298
                            self.outf.writelines(
307
324
        for instance in _mod_propose.iter_hoster_instances():
308
325
            current_user = instance.get_current_user()
309
326
            if current_user is not None:
310
 
                self.outf.write(
311
 
                    gettext('%s (%s) - user: %s (%s)\n') % (
312
 
                        instance.name, instance.base_url,
313
 
                        current_user, instance.get_user_url(current_user)))
 
327
                current_user_url = instance.get_user_url(current_user)
 
328
                if current_user_url is not None:
 
329
                    self.outf.write(
 
330
                        gettext('%s (%s) - user: %s (%s)\n') % (
 
331
                            instance.name, instance.base_url,
 
332
                            current_user, current_user_url))
 
333
                else:
 
334
                    self.outf.write(
 
335
                        gettext('%s (%s) - user: %s\n') % (
 
336
                            instance.name, instance.base_url,
 
337
                            current_user))
314
338
            else:
315
339
                self.outf.write(
316
340
                    gettext('%s (%s) - not logged in\n') % (