/breezy/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/trunk

« back to all changes in this revision

Viewing changes to breezy/plugins/launchpad/lp_registration.py

  • Committer: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
export BRZ_LP_XMLRPC_URL=http://xmlrpc.staging.launchpad.net/bazaar/
38
38
'''
39
39
 
 
40
 
 
41
class InvalidURL(errors.PathError):
 
42
 
 
43
    _fmt = 'Invalid url supplied to transport: "%(path)s"%(extra)s'
 
44
 
 
45
 
40
46
class InvalidLaunchpadInstance(errors.BzrError):
41
47
 
42
48
    _fmt = "%(lp_instance)s is not a valid Launchpad instance."
142
148
        if lp_instance == '':
143
149
            lp_instance = None
144
150
        elif lp_instance not in cls.LAUNCHPAD_INSTANCE:
145
 
            raise errors.InvalidURL(path=url)
 
151
            raise InvalidURL(url)
146
152
        return cls(lp_instance=lp_instance, **kwargs)
147
153
 
148
154
    def get_proxy(self):
191
197
            try:
192
198
                result = resolve.submit(self)
193
199
            except xmlrpclib.Fault as fault:
194
 
                raise errors.InvalidURL(branch_url, str(fault))
 
200
                raise InvalidURL(branch_url, str(fault))
195
201
            branch_url = result['urls'][0]
196
202
            path = urlsplit(branch_url)[2]
197
203
        else:
205
211
    def get_web_url_from_branch_url(self, branch_url, _request_factory=None):
206
212
        """Get the Launchpad web URL for the given branch URL.
207
213
 
208
 
        :raise errors.InvalidURL: if 'branch_url' cannot be identified as a
 
214
        :raise InvalidURL: if 'branch_url' cannot be identified as a
209
215
            Launchpad branch URL.
210
216
        :return: The URL of the branch on Launchpad.
211
217
        """
245
251
 
246
252
    def __init__(self, path):
247
253
        if not path:
248
 
            raise errors.InvalidURL(path=path,
249
 
                                    extra="You must specify a project.")
 
254
            raise InvalidURL(url=path, extra="You must specify a project.")
250
255
        self.path = path
251
256
 
252
257
    def _request_params(self):