/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-08-23 01:15:41 UTC
  • mfrom: (7520.1.4 merge-3.1)
  • Revision ID: breezy.the.bot@gmail.com-20200823011541-nv0oh7nzaganx2qy
Merge lp:brz/3.1.

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

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    Option,
35
35
    RegistryOption,
36
36
    )
37
 
from ...trace import note
 
37
from ...trace import note, warning
38
38
from ... import (
39
39
    propose as _mod_propose,
40
40
    )
268
268
 
269
269
    def run(self, status='open', verbose=False):
270
270
        for instance in _mod_propose.iter_hoster_instances():
271
 
            for mp in instance.iter_my_proposals(status=status):
272
 
                self.outf.write('%s\n' % mp.url)
273
 
                if verbose:
274
 
                    self.outf.write(
275
 
                        '(Merging %s into %s)\n' %
276
 
                        (mp.get_source_branch_url(),
277
 
                         mp.get_target_branch_url()))
278
 
                    description = mp.get_description()
279
 
                    if description:
280
 
                        self.outf.writelines(
281
 
                            ['\t%s\n' % l
282
 
                             for l in description.splitlines()])
283
 
                    self.outf.write('\n')
 
271
            try:
 
272
                for mp in instance.iter_my_proposals(status=status):
 
273
                    self.outf.write('%s\n' % mp.url)
 
274
                    if verbose:
 
275
                        self.outf.write(
 
276
                            '(Merging %s into %s)\n' %
 
277
                            (mp.get_source_branch_url(),
 
278
                             mp.get_target_branch_url()))
 
279
                        description = mp.get_description()
 
280
                        if description:
 
281
                            self.outf.writelines(
 
282
                                ['\t%s\n' % l
 
283
                                 for l in description.splitlines()])
 
284
                        self.outf.write('\n')
 
285
            except _mod_propose.HosterLoginRequired as e:
 
286
                warning('Skipping %r, login required.', instance)
284
287
 
285
288
 
286
289
class cmd_land_merge_proposal(Command):
303
306
    def run(self):
304
307
        for instance in _mod_propose.iter_hoster_instances():
305
308
            current_user = instance.get_current_user()
306
 
            self.outf.write(
307
 
                gettext('%s (%s) - user: %s (%s)\n') % (
308
 
                    instance.name, instance.base_url,
309
 
                    current_user, instance.get_user_url(current_user)))
 
309
            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)))
 
314
            else:
 
315
                self.outf.write(
 
316
                    gettext('%s (%s) - not logged in\n') % (
 
317
                        instance.name, instance.base_url))