/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/urlutils.py

  • Committer: John Arbash Meinel
  • Date: 2006-09-12 22:59:53 UTC
  • mto: This revision was merged to the branch mainline in revision 2071.
  • Revision ID: john@arbash-meinel.com-20060912225953-6d8567932927b1e3
Change how 'revision' is imported to avoid problems later

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
"""A collection of function for handling URL operations."""
20
20
 
21
21
import os
22
 
from posixpath import split as _posix_split, normpath as _posix_normpath
23
22
import re
24
23
import sys
 
24
 
 
25
from bzrlib.lazy_import import lazy_import
 
26
lazy_import(globals(), """
 
27
from posixpath import split as _posix_split, normpath as _posix_normpath
25
28
import urllib
26
29
 
27
 
import bzrlib.errors as errors
28
 
import bzrlib.osutils
 
30
from bzrlib import (
 
31
    errors,
 
32
    osutils,
 
33
    )
 
34
""")
29
35
 
30
36
 
31
37
def basename(url, exclude_trailing_slash=True):
75
81
 
76
82
    base = local_path_from_url(base)
77
83
    path = local_path_from_url(path)
78
 
    return escape(bzrlib.osutils.relpath(base, path))
 
84
    return escape(osutils.relpath(base, path))
79
85
 
80
86
 
81
87
def _find_scheme_and_separator(url):
166
172
    # importing directly from posixpath allows us to test this 
167
173
    # on non-posix platforms
168
174
    return 'file://' + escape(_posix_normpath(
169
 
        bzrlib.osutils._posix_abspath(path)))
 
175
        osutils._posix_abspath(path)))
170
176
 
171
177
 
172
178
def _win32_local_path_from_url(url):
195
201
    #       which actually strips trailing space characters.
196
202
    #       The worst part is that under linux ntpath.abspath has different
197
203
    #       semantics, since 'nt' is not an available module.
198
 
    win32_path = bzrlib.osutils._nt_normpath(
199
 
        bzrlib.osutils._win32_abspath(path)).replace('\\', '/')
 
204
    win32_path = osutils._nt_normpath(
 
205
        osutils._win32_abspath(path)).replace('\\', '/')
200
206
    return 'file:///' + win32_path[0].upper() + ':' + escape(win32_path[2:])
201
207
 
202
208