~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2010 Canonical Ltd
 
1
# Copyright (C) 2009, 2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
 
import urlparse
19
18
import webbrowser
20
19
 
21
20
from bzrlib import (
22
21
    errors,
23
 
    hooks,
24
22
    msgeditor,
25
23
)
 
24
from bzrlib.hooks import HookPoint, Hooks
26
25
from bzrlib.plugins.launchpad import (
27
26
    lp_api,
28
27
    lp_registration,
31
30
from lazr.restfulclient import errors as restful_errors
32
31
 
33
32
 
34
 
class ProposeMergeHooks(hooks.Hooks):
 
33
class ProposeMergeHooks(Hooks):
35
34
    """Hooks for proposing a merge on Launchpad."""
36
35
 
37
36
    def __init__(self):
38
 
        hooks.Hooks.__init__(self)
 
37
        Hooks.__init__(self)
39
38
        self.create_hook(
40
 
            hooks.HookPoint(
 
39
            HookPoint(
41
40
                'get_prerequisite',
42
41
                "Return the prerequisite branch for proposing as merge.",
43
42
                (2, 1), None),
44
43
        )
45
44
        self.create_hook(
46
 
            hooks.HookPoint(
 
45
            HookPoint(
47
46
                'merge_proposal_body',
48
47
                "Return an initial body for the merge proposal message.",
49
48
                (2, 1), None),
203
202
 
204
203
def canonical_url(object):
205
204
    """Return the canonical URL for a branch."""
206
 
    scheme, netloc, path, params, query, fragment = urlparse.urlparse(
207
 
        str(object.self_link))
208
 
    path = '/'.join(path.split('/')[2:])
209
 
    netloc = netloc.replace('api.', 'code.')
210
 
    return urlparse.urlunparse((scheme, netloc, path, params, query,
211
 
                                fragment))
 
205
    url = object.self_link.replace('https://api.', 'https://code.')
 
206
    return url.replace('/beta/', '/')