/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

Several small improvements to merge proposal commands.

Merged from https://code.launchpad.net/~jelmer/brz/by-hoster/+merge/389998

Show diffs side-by-side

added added

removed removed

Lines of Context:
146
146
        RegistryOption(
147
147
            'hoster',
148
148
            help='Use the hoster.',
149
 
            lazy_registry=('breezy.plugins.propose.propose', 'hosters')),
 
149
            lazy_registry=('breezy.propose', 'hosters')),
150
150
        ListOption('reviewers', short_name='R', type=text_type,
151
151
                   help='Requested reviewers.'),
152
152
        Option('name', help='Name of the new remote branch.', type=str),
258
258
 
259
259
    hidden = True
260
260
 
 
261
    takes_args = ['base-url?']
261
262
    takes_options = [
262
263
        'verbose',
263
264
        RegistryOption.from_kwargs(
269
270
            all='All merge proposals',
270
271
            open='Open merge proposals',
271
272
            merged='Merged merge proposals',
272
 
            closed='Closed merge proposals')]
273
 
 
274
 
    def run(self, status='open', verbose=False):
275
 
        for instance in _mod_propose.iter_hoster_instances():
 
273
            closed='Closed merge proposals'),
 
274
        RegistryOption(
 
275
            'hoster',
 
276
            help='Use the hoster.',
 
277
            lazy_registry=('breezy.propose', 'hosters')),
 
278
        ]
 
279
 
 
280
    def run(self, status='open', verbose=False, hoster=None, base_url=None):
 
281
 
 
282
        for instance in _mod_propose.iter_hoster_instances(hoster=hoster):
 
283
            if base_url is not None and instance.base_url != base_url:
 
284
                continue
276
285
            try:
277
286
                for mp in instance.iter_my_proposals(status=status):
278
287
                    self.outf.write('%s\n' % mp.url)
279
288
                    if verbose:
280
 
                        self.outf.write(
281
 
                            '(Merging %s into %s)\n' %
282
 
                            (mp.get_source_branch_url(),
283
 
                             mp.get_target_branch_url()))
 
289
                        source_branch_url = mp.get_source_branch_url()
 
290
                        if source_branch_url:
 
291
                            self.outf.write(
 
292
                                '(Merging %s into %s)\n' %
 
293
                                (source_branch_url,
 
294
                                 mp.get_target_branch_url()))
 
295
                        else:
 
296
                            self.outf.write(
 
297
                                '(Merging into %s)\n' %
 
298
                                mp.get_target_branch_url())
284
299
                        description = mp.get_description()
285
300
                        if description:
286
301
                            self.outf.writelines(
312
327
        for instance in _mod_propose.iter_hoster_instances():
313
328
            current_user = instance.get_current_user()
314
329
            if current_user is not None:
315
 
                self.outf.write(
316
 
                    gettext('%s (%s) - user: %s (%s)\n') % (
317
 
                        instance.name, instance.base_url,
318
 
                        current_user, instance.get_user_url(current_user)))
 
330
                current_user_url = instance.get_user_url(current_user)
 
331
                if current_user_url is not None:
 
332
                    self.outf.write(
 
333
                        gettext('%s (%s) - user: %s (%s)\n') % (
 
334
                            instance.name, instance.base_url,
 
335
                            current_user, current_user_url))
 
336
                else:
 
337
                    self.outf.write(
 
338
                        gettext('%s (%s) - user: %s\n') % (
 
339
                            instance.name, instance.base_url,
 
340
                            current_user))
319
341
            else:
320
342
                self.outf.write(
321
343
                    gettext('%s (%s) - not logged in\n') % (