~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2011-11-24 15:48:29 UTC
  • mfrom: (6289 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6337.
  • Revision ID: v.ladeuil+lp@free.fr-20111124154829-avowjpsxdl8yp2vz
merge trunk resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    trace,
34
34
    transport,
35
35
    )
 
36
from bzrlib.i18n import gettext
36
37
from bzrlib.plugins.launchpad.lp_registration import (
37
38
    InvalidLaunchpadInstance,
38
39
    )
235
236
        """Create a Bazaar branch on Launchpad for the supplied branch."""
236
237
        url = cls.tweak_url(bzr_branch.get_push_location(), launchpad)
237
238
        if not cls.plausible_launchpad_url(url):
238
 
            raise errors.BzrError('%s is not registered on Launchpad' %
 
239
            raise errors.BzrError(gettext('%s is not registered on Launchpad') %
239
240
                                  bzr_branch.base)
240
241
        bzr_branch.create_clone_on_transport(transport.get_transport(url))
241
242
        lp_branch = launchpad.branches.getByUrl(url=url)
242
243
        if lp_branch is None:
243
 
            raise errors.BzrError('%s is not registered on Launchpad' % url)
 
244
            raise errors.BzrError(gettext('%s is not registered on Launchpad') %
 
245
                                                                            url)
244
246
        return lp_branch
245
247
 
246
248
    def get_target(self):
249
251
        if lp_branch.project is not None:
250
252
            dev_focus = lp_branch.project.development_focus
251
253
            if dev_focus is None:
252
 
                raise errors.BzrError('%s has no development focus.' %
 
254
                raise errors.BzrError(gettext('%s has no development focus.') %
253
255
                                  lp_branch.bzr_identity)
254
256
            target = dev_focus.branch
255
257
            if target is None:
256
 
                raise errors.BzrError('development focus %s has no branch.' % dev_focus)
 
258
                raise errors.BzrError(gettext(
 
259
                        'development focus %s has no branch.') % dev_focus)
257
260
        elif lp_branch.sourcepackage is not None:
258
261
            target = lp_branch.sourcepackage.getBranch(pocket="Release")
259
262
            if target is None:
260
 
                raise errors.BzrError('source package %s has no branch.' %
 
263
                raise errors.BzrError(gettext(
 
264
                                      'source package %s has no branch.') %
261
265
                                      lp_branch.sourcepackage)
262
266
        else:
263
 
            raise errors.BzrError('%s has no associated product or source package.' %
 
267
            raise errors.BzrError(gettext(
 
268
                        '%s has no associated product or source package.') %
264
269
                                  lp_branch.bzr_identity)
265
270
        return LaunchpadBranch(target, target.bzr_identity)
266
271
 
272
277
        try:
273
278
            if self.lp.last_scanned_id is not None:
274
279
                if self.bzr.last_revision() == self.lp.last_scanned_id:
275
 
                    trace.note('%s is already up-to-date.' %
 
280
                    trace.note(gettext('%s is already up-to-date.') %
276
281
                               self.lp.bzr_identity)
277
282
                    return
278
283
                graph = self.bzr.repository.get_graph()
279
284
                if not graph.is_ancestor(self.lp.last_scanned_id,
280
285
                                         self.bzr.last_revision()):
281
286
                    raise errors.DivergedBranches(self.bzr, self.push_bzr)
282
 
                trace.note('Pushing to %s' % self.lp.bzr_identity)
 
287
                trace.note(gettext('Pushing to %s') % self.lp.bzr_identity)
283
288
            self.bzr.push(self.push_bzr)
284
289
        finally:
285
290
            self.bzr.unlock()