/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: Alexander Belchenko
  • Date: 2006-12-05 08:25:54 UTC
  • mto: This revision was merged to the branch mainline in revision 2172.
  • Revision ID: bialix@ukr.net-20061205082554-q20iann59if299hf
Support for win32 UNC path (like: \\HOST\path)

Show diffs side-by-side

added added

removed removed

Lines of Context:
183
183
        raise errors.InvalidURL(url, 'local urls must start with file:///')
184
184
    # We strip off all 3 slashes
185
185
    win32_url = url[len('file:///'):]
 
186
    # check for UNC path: //HOST/path
 
187
    if win32_url.startswith('//'):
 
188
        if (win32_url[2] == '/'
 
189
            or win32_url[3] in '|:'):
 
190
            raise errors.InvalidURL(url, 'Win32 UNC path urls'
 
191
                ' have form file://///HOST/path')
 
192
        return unescape(win32_url)
 
193
    # usual local path with drive letter
186
194
    if (win32_url[0] not in ('abcdefghijklmnopqrstuvwxyz'
187
195
                             'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
188
196
        or win32_url[1] not in  '|:'
205
213
    #       semantics, since 'nt' is not an available module.
206
214
    win32_path = osutils._nt_normpath(
207
215
        osutils._win32_abspath(path)).replace('\\', '/')
 
216
    # check for UNC path \\HOST\path
 
217
    if win32_path.startswith('//'):
 
218
        return 'file:///' + escape(win32_path)
208
219
    return 'file:///' + win32_path[0].upper() + ':' + escape(win32_path[2:])
209
220
 
210
221