~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin
  • Date: 2010-05-16 15:18:43 UTC
  • mfrom: (5235 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5239.
  • Revision ID: gzlist@googlemail.com-20100516151843-lu53u7caehm3ie3i
Merge bzr.dev to resolve conflicts in NEWS and _chk_map_pyx

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 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
18
19
import webbrowser
19
20
 
20
21
from bzrlib import (
21
22
    errors,
 
23
    hooks,
22
24
    msgeditor,
23
25
)
24
 
from bzrlib.hooks import HookPoint, Hooks
25
26
from bzrlib.plugins.launchpad import (
26
27
    lp_api,
27
28
    lp_registration,
30
31
from lazr.restfulclient import errors as restful_errors
31
32
 
32
33
 
33
 
class ProposeMergeHooks(Hooks):
 
34
class ProposeMergeHooks(hooks.Hooks):
34
35
    """Hooks for proposing a merge on Launchpad."""
35
36
 
36
37
    def __init__(self):
37
 
        Hooks.__init__(self)
 
38
        hooks.Hooks.__init__(self)
38
39
        self.create_hook(
39
 
            HookPoint(
 
40
            hooks.HookPoint(
40
41
                'get_prerequisite',
41
42
                "Return the prerequisite branch for proposing as merge.",
42
43
                (2, 1), None),
43
44
        )
44
45
        self.create_hook(
45
 
            HookPoint(
 
46
            hooks.HookPoint(
46
47
                'merge_proposal_body',
47
48
                "Return an initial body for the merge proposal message.",
48
49
                (2, 1), None),
202
203
 
203
204
def canonical_url(object):
204
205
    """Return the canonical URL for a branch."""
205
 
    url = object.self_link.replace('https://api.', 'https://code.')
206
 
    return url.replace('/beta/', '/')
 
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))