~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/urlutils.py

  • Committer: Sidnei da Silva
  • Date: 2009-05-29 14:19:29 UTC
  • mto: (4531.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4532.
  • Revision ID: sidnei.da.silva@canonical.com-20090529141929-3heywbvj36po72a5
- Add initial config

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
    This assumes that both paths are already fully specified file:// URLs.
76
76
    """
77
77
    if len(base) < MIN_ABS_FILEURL_LENGTH:
78
 
        raise ValueError('Length of base (%r) must equal or'
 
78
        raise ValueError('Length of base must be equal or'
79
79
            ' exceed the platform minimum url length (which is %d)' %
80
 
            (base, MIN_ABS_FILEURL_LENGTH))
 
80
            MIN_ABS_FILEURL_LENGTH)
81
81
    base = local_path_from_url(base)
82
82
    path = local_path_from_url(path)
83
83
    return escape(osutils.relpath(base, path))
217
217
# jam 20060502 Sorted to 'l' because the final target is 'local_path_from_url'
218
218
def _posix_local_path_from_url(url):
219
219
    """Convert a url like file:///path/to/foo into /path/to/foo"""
220
 
    file_localhost_prefix = 'file://localhost/'
221
 
    if url.startswith(file_localhost_prefix):
222
 
        path = url[len(file_localhost_prefix) - 1:]
223
 
    elif not url.startswith('file:///'):
224
 
        raise errors.InvalidURL(
225
 
            url, 'local urls must start with file:/// or file://localhost/')
226
 
    else:
227
 
        path = url[len('file://'):]
 
220
    if not url.startswith('file:///'):
 
221
        raise errors.InvalidURL(url, 'local urls must start with file:///')
228
222
    # We only strip off 2 slashes
229
 
    return unescape(path)
 
223
    return unescape(url[len('file://'):])
230
224
 
231
225
 
232
226
def _posix_local_path_to_url(path):