/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 breezy/plugins/launchpad/lp_directory.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-17 00:47:52 UTC
  • mfrom: (7182 work)
  • mto: This revision was merged to the branch mainline in revision 7305.
  • Revision ID: jelmer@jelmer.uk-20181117004752-6ywampe5pfywlby4
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
transport.register_urlparse_netloc_protocol('bzr+ssh')
49
49
transport.register_urlparse_netloc_protocol('lp')
50
50
 
51
 
_ubuntu_series_shortcuts = {
52
 
    'n': 'natty',
53
 
    'm': 'maverick',
54
 
    'l': 'lucid',
55
 
    'k': 'karmic',
56
 
    'j': 'jaunty',
57
 
    'h': 'hardy',
58
 
    'd': 'dapper',
59
 
    }
60
 
 
61
51
 
62
52
class LaunchpadDirectory(object):
63
53
 
69
59
        urlsplit.
70
60
        """
71
61
        return (scheme in ('bzr+ssh', 'sftp')
72
 
                and (netloc.endswith('launchpad.net')
73
 
                     or netloc.endswith('launchpad.dev')))
 
62
                and (netloc.endswith('launchpad.net') or
 
63
                     netloc.endswith('launchpad.dev')))
74
64
 
75
65
    def look_up(self, name, url):
76
66
        """See DirectoryService.look_up"""
93
83
            # messages.
94
84
            parts = path.split('/')
95
85
            if (len(parts) < 3
96
 
                or (parts[1] in ('ubuntu', 'debian') and len(parts) < 5)):
 
86
                    or (parts[1] in ('ubuntu', 'debian') and len(parts) < 5)):
97
87
                # This special case requires 5-parts to be valid.
98
88
                maybe_invalid = True
99
89
        else:
118
108
        if scheme in ('ubuntu', 'debianlp'):
119
109
            if scheme == 'ubuntu':
120
110
                distro = 'ubuntu'
121
 
                distro_series = _ubuntu_series_shortcuts
122
111
            elif scheme == 'debianlp':
123
112
                distro = 'debian'
124
113
                # No shortcuts for Debian distroseries.
125
 
                distro_series = {}
126
114
            else:
127
115
                raise AssertionError('scheme should be ubuntu: or debianlp:')
128
116
            # Split the path.  It's either going to be 'project' or
142
130
                # There are either 0 or > 2 path parts, neither of which is
143
131
                # supported for these schemes.
144
132
                raise InvalidURL('Bad path: %s' % url)
145
 
            # Expand any series shortcuts, but keep unknown series.
146
 
            series = distro_series.get(series, series)
147
133
            # Hack the url and let the following do the final resolution.
148
134
            url = lp_url_template % dict(
149
135
                distro=distro,
156
142
        if path.startswith('~/'):
157
143
            if lp_login is None:
158
144
                raise InvalidURL(path=url,
159
 
                    extra='Cannot resolve "~" to your username.'
160
 
                          ' See "bzr help launchpad-login"')
 
145
                                 extra='Cannot resolve "~" to your username.'
 
146
                                 ' See "bzr help launchpad-login"')
161
147
            path = '~' + lp_login + path[1:]
162
148
        return path
163
149
 
177
163
                result = self._resolve_via_xmlrpc(path, url, _request_factory)
178
164
                trace.note(gettext(
179
165
                    'resolution for {0}\n  local: {1}\n remote: {2}').format(
180
 
                           url, local_res['urls'], result['urls']))
 
166
                    url, local_res['urls'], result['urls']))
181
167
        else:
182
168
            result = self._resolve_via_xmlrpc(path, url, _request_factory)
183
169
 
196
182
                if _lp_login is None:
197
183
                    if not _warned_login:
198
184
                        trace.warning(
199
 
'You have not informed bzr of your Launchpad ID, and you must do this to\n'
200
 
'write to Launchpad or access private data.  See "bzr help launchpad-login".')
 
185
                            'You have not informed bzr of your Launchpad ID, and you must do this to\n'
 
186
                            'write to Launchpad or access private data.  See "bzr help launchpad-login".')
201
187
                        _warned_login = True
202
188
            else:
203
189
                # Use the URL if we can create a transport for it.