/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

Merge bzr.dev r3466

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
    
76
76
    This assumes that both paths are already fully specified file:// URLs.
77
77
    """
78
 
    assert len(base) >= MIN_ABS_FILEURL_LENGTH, ('Length of base must be equal or'
79
 
        ' exceed the platform minimum url length (which is %d)' % 
80
 
        MIN_ABS_FILEURL_LENGTH)
81
 
 
 
78
    if len(base) < MIN_ABS_FILEURL_LENGTH:
 
79
        raise ValueError('Length of base must be equal or'
 
80
            ' exceed the platform minimum url length (which is %d)' %
 
81
            MIN_ABS_FILEURL_LENGTH)
82
82
    base = local_path_from_url(base)
83
83
    path = local_path_from_url(path)
84
84
    return escape(osutils.relpath(base, path))
274
274
    # check for UNC path \\HOST\path
275
275
    if win32_path.startswith('//'):
276
276
        return 'file:' + escape(win32_path)
277
 
    return 'file:///' + win32_path[0].upper() + ':' + escape(win32_path[2:])
 
277
    return ('file:///' + str(win32_path[0].upper()) + ':' +
 
278
        escape(win32_path[2:]))
278
279
 
279
280
 
280
281
local_path_to_url = _posix_local_path_to_url
573
574
    :return: A unicode string which can be safely encoded into the 
574
575
         specified encoding.
575
576
    """
576
 
    assert encoding is not None, 'you cannot specify None for the display encoding.'
 
577
    if encoding is None:
 
578
        raise ValueError('you cannot specify None for the display encoding')
577
579
    if url.startswith('file://'):
578
580
        try:
579
581
            path = local_path_from_url(url)