/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/transport/__init__.py

  • Committer: Martin Pool
  • Date: 2008-05-08 04:33:38 UTC
  • mfrom: (3414 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3415.
  • Revision ID: mbp@sourcefrog.net-20080508043338-ru3vflx8z641a76k
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
        deprecated_function,
51
51
        DEPRECATED_PARAMETER,
52
52
        one_four,
53
 
        zero_ninety,
54
53
        )
55
54
from bzrlib.trace import (
56
55
    mutter,
180
179
        transport_list_registry.remove(scheme)
181
180
 
182
181
 
183
 
 
184
 
@deprecated_function(zero_ninety)
185
 
def split_url(url):
186
 
    # TODO: jam 20060606 urls should only be ascii, or they should raise InvalidURL
187
 
    if isinstance(url, unicode):
188
 
        url = url.encode('utf-8')
189
 
    (scheme, netloc, path, params,
190
 
     query, fragment) = urlparse.urlparse(url, allow_fragments=False)
191
 
    username = password = host = port = None
192
 
    if '@' in netloc:
193
 
        username, host = netloc.split('@', 1)
194
 
        if ':' in username:
195
 
            username, password = username.split(':', 1)
196
 
            password = urllib.unquote(password)
197
 
        username = urllib.unquote(username)
198
 
    else:
199
 
        host = netloc
200
 
 
201
 
    if ':' in host:
202
 
        host, port = host.rsplit(':', 1)
203
 
        try:
204
 
            port = int(port)
205
 
        except ValueError:
206
 
            # TODO: Should this be ConnectionError?
207
 
            raise errors.TransportError(
208
 
                'invalid port number %s in url:\n%s' % (port, url))
209
 
    host = urllib.unquote(host)
210
 
 
211
 
    path = urllib.unquote(path)
212
 
 
213
 
    return (scheme, username, password, host, port, path)
214
 
 
215
 
 
216
182
class _CoalescedOffset(object):
217
183
    """A data container for keeping track of coalesced offsets."""
218
184
 
1540
1506
        return transport
1541
1507
 
1542
1508
 
1543
 
@deprecated_function(zero_ninety)
1544
 
def urlescape(relpath):
1545
 
    urlutils.escape(relpath)
1546
 
 
1547
 
 
1548
 
@deprecated_function(zero_ninety)
1549
 
def urlunescape(url):
1550
 
    urlutils.unescape(url)
1551
 
 
1552
1509
# We try to recognize an url lazily (ignoring user, password, etc)
1553
1510
_urlRE = re.compile(r'^(?P<proto>[^:/\\]+)://(?P<rest>.*)$')
1554
1511