Rev 3713: LocalTransport.abspath returns drive letter if transport has one in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Sep 19 04:48:54 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3713
revision-id: pqm at pqm.ubuntu.com-20080919034851-21510mhvx3xwyrta
parent: pqm at pqm.ubuntu.com-20080919010941-eu2yokwzyw7ezvh9
parent: ian.clatworthy at canonical.com-20080919031709-59dexi51pf0g2cho
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2008-09-19 04:48:51 +0100
message:
LocalTransport.abspath returns drive letter if transport has one
(Mark Hammond)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
bzrlib/transport/local.py local_transport.py-20050711165921-9b1f142bfe480c24
------------------------------------------------------------
revno: 3712.1.1
revision-id: ian.clatworthy at canonical.com-20080919031709-59dexi51pf0g2cho
parent: pqm at pqm.ubuntu.com-20080919010941-eu2yokwzyw7ezvh9
parent: mhammond at skippinet.com.au-20080919002858-lj7fjayefxp9grdm
committer: Ian Clatworthy <ian.clatworthy at canonical.com>
branch nick: ianc-integration
timestamp: Fri 2008-09-19 13:17:09 +1000
message:
LocalTransport.abspath returns drive letter if transport has one (Mark Hammond)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
bzrlib/transport/local.py local_transport.py-20050711165921-9b1f142bfe480c24
------------------------------------------------------------
revno: 3693.2.3
revision-id: mhammond at skippinet.com.au-20080919002858-lj7fjayefxp9grdm
parent: mhammond at skippinet.com.au-20080909120350-b2ntvttvqzfsx38t
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr.work.transport_abspath
timestamp: Fri 2008-09-19 10:28:58 +1000
message:
Back to skipping the tests on non-windows platforms.
modified:
bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
------------------------------------------------------------
revno: 3693.2.2
revision-id: mhammond at skippinet.com.au-20080909120350-b2ntvttvqzfsx38t
parent: mhammond at skippinet.com.au-20080906073334-7jklokha0uco0tnk
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr.work.transport_abspath
timestamp: Tue 2008-09-09 22:03:50 +1000
message:
add a test for win32 abspath sematics, which as requested by lifeless,
monkey-patches sys.platform for the duration of the test.
modified:
bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
------------------------------------------------------------
revno: 3693.2.1
revision-id: mhammond at skippinet.com.au-20080906073334-7jklokha0uco0tnk
parent: pqm at pqm.ubuntu.com-20080905212548-ig8wqqpv4vb8b2v4
committer: Mark Hammond <mhammond at skippinet.com.au>
branch nick: bzr.work
timestamp: Sat 2008-09-06 17:33:34 +1000
message:
ensure LocalTransport.abspath() returns an absolute URL with the same
drive letter (or lack of drive letter) that our _local_base has.
modified:
bzrlib/transport/local.py local_transport.py-20050711165921-9b1f142bfe480c24
=== modified file 'NEWS'
--- a/NEWS 2008-09-19 00:38:45 +0000
+++ b/NEWS 2008-09-19 03:17:09 +0000
@@ -44,6 +44,10 @@
``bzrlib.tests.per_repository`` so that we have a common structure
(and it is shorter). (John Arbash Meinel, #239343)
+ * ``LocalTransport.abspath()`` now returns a drive letter if the
+ transport has one, fixing numerous tests on Windows.
+ (Mark Hammond)
+
* The full test suite is passing again on OSX.
(Guillermo Gonzalez, Vincent Ladeuil)
=== modified file 'bzrlib/tests/test_transport_implementations.py'
--- a/bzrlib/tests/test_transport_implementations.py 2008-09-10 19:52:36 +0000
+++ b/bzrlib/tests/test_transport_implementations.py 2008-09-19 03:17:09 +0000
@@ -1338,6 +1338,23 @@
self.assertEqual(transport.clone("/").abspath('foo'),
transport.abspath("/foo"))
+ def test_win32_abspath(self):
+ # Note: we tried to set sys.platform='win32' so we could test on
+ # other platforms too, but then osutils does platform specific
+ # things at import time which defeated us...
+ if sys.platform != 'win32':
+ raise TestSkipped(
+ 'Testing drive letters in abspath implemented only for win32')
+
+ # smoke test for abspath on win32.
+ # a transport based on 'file:///' never fully qualifies the drive.
+ transport = get_transport("file:///")
+ self.failUnlessEqual(transport.abspath("/"), "file:///")
+
+ # but a transport that starts with a drive spec must keep it.
+ transport = get_transport("file:///C:/")
+ self.failUnlessEqual(transport.abspath("/"), "file:///C:/")
+
def test_local_abspath(self):
transport = self.get_transport()
try:
=== modified file 'bzrlib/transport/local.py'
--- a/bzrlib/transport/local.py 2008-08-11 02:32:44 +0000
+++ b/bzrlib/transport/local.py 2008-09-06 07:33:34 +0000
@@ -109,6 +109,16 @@
# proper handling of stuff like
path = osutils.normpath(osutils.pathjoin(
self._local_base, urlutils.unescape(relpath)))
+ # on windows, our _local_base may or may not have a drive specified
+ # (ie, it may be "/" or "c:/foo").
+ # If 'relpath' is '/' we *always* get back an abspath without
+ # the drive letter - but if our transport already has a drive letter,
+ # we want our abspaths to have a drive letter too - so handle that
+ # here.
+ if (sys.platform == "win32" and self._local_base[1:2] == ":"
+ and path == '/'):
+ path = self._local_base[:3]
+
return urlutils.local_path_to_url(path)
def local_abspath(self, relpath):
More information about the bazaar-commits
mailing list