~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/urlutils.py

  • Committer: Vincent Ladeuil
  • Date: 2009-09-19 16:14:10 UTC
  • mto: (4707.2.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4708.
  • Revision ID: v.ladeuil+lp@free.fr-20090919161410-lmlunl2q9kbzd3x0
Fix OSX and FreeBSD failures.

* bzrlib/tests/__init__.py:
(TestCaseWithMemoryTransport._make_test_root): Fixing the problem
at the root, if we usr the real path there, we catch 99% of the
consequences.

* bzrlib/tests/test_osutils.py:
(TestCanonicalRelPath.test_canonical_relpath_simple,
TestCanonicalRelPath.test_canonical_relpath_missing_tail): No need
to use realpath here anymore.

* bzrlib/tests/script.py:
(ScriptRunner.do_rm): OSX and BSD raises a different exception,
and windows too even if that will require real testing (but
osutils._delete_file_or_dir use the same trick for unlink so it's
a pretty safe bet).

* bzrlib/tests/blackbox/test_outside_wt.py:
(TestOutsideWT.test_cwd_log,
TestOutsideWT.test_diff_outside_tree): Watch for OSX trick.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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):