/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 bzrlib/plugins/launchpad/lp_api.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-01-19 01:03:43 UTC
  • mfrom: (5616.1.1 bzr.dev)
  • Revision ID: pqm@pqm.ubuntu.com-20110119010343-vqp4ddfjjddplr0v
(jelmer) Support finding default target for packaging branches in
 lp-propose. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
230
230
            raise errors.BzrError('%s is not registered on Launchpad' % url)
231
231
        return lp_branch
232
232
 
233
 
    def get_dev_focus(self):
234
 
        """Return the 'LaunchpadBranch' for the dev focus of this one."""
 
233
    def get_target(self):
 
234
        """Return the 'LaunchpadBranch' for the target of this one."""
235
235
        lp_branch = self.lp
236
 
        if lp_branch.project is None:
237
 
            raise errors.BzrError('%s has no product.' %
238
 
                                  lp_branch.bzr_identity)
239
 
        dev_focus = lp_branch.project.development_focus.branch
240
 
        if dev_focus is None:
241
 
            raise errors.BzrError('%s has no development focus.' %
242
 
                                  lp_branch.bzr_identity)
243
 
        return LaunchpadBranch(dev_focus, dev_focus.bzr_identity)
 
236
        if lp_branch.project is not None:
 
237
            dev_focus = lp_branch.project.development_focus.branch
 
238
            if dev_focus is None:
 
239
                raise errors.BzrError('%s has no development focus.' %
 
240
                                  lp_branch.bzr_identity)
 
241
            target = dev_focus.branch
 
242
            if target is None:
 
243
                raise errors.BzrError('development focus %s has no branch.' % dev_focus)
 
244
        elif lp_branch.sourcepackage is not None:
 
245
            target = lp_branch.sourcepackage.getBranch(pocket="Release")
 
246
            if target is None:
 
247
                raise errors.BzrError('source package %s has no branch.' %
 
248
                                      lp_branch.sourcepackage)
 
249
        else:
 
250
            raise errors.BzrError('%s has no associated product or source package.' %
 
251
                                  lp_branch.bzr_identity)
 
252
        return LaunchpadBranch(target, target.bzr_identity)
244
253
 
245
254
    def update_lp(self):
246
255
        """Update the Launchpad copy of this branch."""