~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/launchpad/__init__.py

  • Committer: Patch Queue Manager
  • Date: 2011-09-20 14:38:17 UTC
  • mfrom: (6150.3.12 i18n-more-gettext)
  • Revision ID: pqm@pqm.ubuntu.com-20110920143817-505fvpundix8tqv8
(jr) adding gettext() to more strings
 (Jonathan Riddell)

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    ui,
47
47
    trace,
48
48
    )
 
49
from bzrlib.i18n import gettext
49
50
""")
50
51
 
51
52
from bzrlib import (
144
145
            try:
145
146
                b = _mod_branch.Branch.open_containing('.')[0]
146
147
            except NotBranchError:
147
 
                raise BzrCommandError('register-branch requires a public '
148
 
                    'branch url - see bzr help register-branch.')
 
148
                raise BzrCommandError(gettext(
 
149
                            'register-branch requires a public '
 
150
                            'branch url - see bzr help register-branch.'))
149
151
            public_url = b.get_public_branch()
150
152
            if public_url is None:
151
153
                raise NoPublicBranch(b)
152
154
        if product is not None:
153
155
            project = product
154
 
            trace.note('--product is deprecated; please use --project.')
 
156
            trace.note(gettext(
 
157
                '--product is deprecated; please use --project.'))
155
158
 
156
159
 
157
160
        rego = BranchRegistrationRequest(branch_url=public_url,
223
226
        if location is None:
224
227
            location = u'.'
225
228
        web_url = self._get_web_url(LaunchpadService(), location)
226
 
        trace.note('Opening %s in web browser' % web_url)
 
229
        trace.note(gettext('Opening %s in web browser') % web_url)
227
230
        if not dry_run:
228
231
            import webbrowser   # this import should not be lazy
229
232
                                # otherwise bzr.exe lacks this module
267
270
                if check_account:
268
271
                    account.check_lp_login(username)
269
272
                    if verbose:
270
 
                        self.outf.write(
271
 
                            "Launchpad user ID exists and has SSH keys.\n")
 
273
                        self.outf.write(gettext(
 
274
                            "Launchpad user ID exists and has SSH keys.\n"))
272
275
                self.outf.write(username + '\n')
273
276
            else:
274
 
                self.outf.write('No Launchpad user ID configured.\n')
 
277
                self.outf.write(gettext('No Launchpad user ID configured.\n'))
275
278
                return 1
276
279
        else:
277
280
            name = name.lower()
278
281
            if check_account:
279
282
                account.check_lp_login(name)
280
283
                if verbose:
281
 
                    self.outf.write(
282
 
                        "Launchpad user ID exists and has SSH keys.\n")
 
284
                    self.outf.write(gettext(
 
285
                        "Launchpad user ID exists and has SSH keys.\n"))
283
286
            account.set_lp_login(name)
284
287
            if verbose:
285
 
                self.outf.write("Launchpad user ID set to '%s'.\n" % (name,))
 
288
                self.outf.write(gettext("Launchpad user ID set to '%s'.\n") %
 
289
                                                                        (name,))
286
290
 
287
291
register_command(cmd_launchpad_login)
288
292
 
400
404
            revno = self._find_merged_revno(revision, b, pb)
401
405
            merged = self._find_proposals(revno, b, pb)
402
406
            if len(merged) == 0:
403
 
                raise BzrCommandError('No review found.')
404
 
            trace.note('%d proposals(s) found.' % len(merged))
 
407
                raise BzrCommandError(gettext('No review found.'))
 
408
            trace.note(gettext('%d proposals(s) found.') % len(merged))
405
409
            for mp in merged:
406
410
                webbrowser.open(lp_api.canonical_url(mp))
407
411
        finally:
411
415
    def _find_merged_revno(self, revision, b, pb):
412
416
        if revision is None:
413
417
            return b.revno()
414
 
        pb.update('Finding revision-id')
 
418
        pb.update(gettext('Finding revision-id'))
415
419
        revision_id = revision[0].as_revision_id(b)
416
420
        # a revno spec is necessarily on the mainline.
417
421
        if self._is_revno_spec(revision[0]):
418
422
            merging_revision = revision_id
419
423
        else:
420
424
            graph = b.repository.get_graph()
421
 
            pb.update('Finding merge')
 
425
            pb.update(gettext('Finding merge'))
422
426
            merging_revision = graph.find_lefthand_merger(
423
427
                revision_id, b.last_revision())
424
428
            if merging_revision is None:
425
429
                raise InvalidRevisionSpec(revision[0].user_spec, b)
426
 
        pb.update('Finding revno')
 
430
        pb.update(gettext('Finding revno'))
427
431
        return b.revision_id_to_revno(merging_revision)
428
432
 
429
433
    def _find_proposals(self, revno, b, pb):
430
434
        launchpad = lp_api.login(lp_registration.LaunchpadService())
431
 
        pb.update('Finding Launchpad branch')
 
435
        pb.update(gettext('Finding Launchpad branch'))
432
436
        lpb = lp_api.LaunchpadBranch.from_bzr(launchpad, b,
433
437
                                              create_missing=False)
434
 
        pb.update('Finding proposals')
 
438
        pb.update(gettext('Finding proposals'))
435
439
        return list(lpb.lp.getMergeProposals(status=['Merged'],
436
440
                                             merged_revnos=[revno]))
437
441