~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2011-04-09 19:25:42 UTC
  • mto: (5777.5.1 inventoryworkingtree)
  • mto: This revision was merged to the branch mainline in revision 5781.
  • Revision ID: jelmer@samba.org-20110409192542-8bbedp36s7nj928e
Split InventoryTree out of Tree.

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