Rev 3017: Add test for MemoryTransport._abspath moving files between directories; fix exception construction in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Nov 23 05:37:26 GMT 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3017
revision-id:pqm at pqm.ubuntu.com-20071123053719-gxfu09uacv4heh6w
parent: pqm at pqm.ubuntu.com-20071123043953-lv68pawzrpa4s9t9
parent: mbp at sourcefrog.net-20071123045643-6l30ww29l0kzy49y
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2007-11-23 05:37:19 +0000
message:
  Add test for MemoryTransport._abspath moving files between directories; fix exception construction
modified:
  bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
  bzrlib/transport/memory.py     memory.py-20051016101338-cd008dbdf69f04fc
    ------------------------------------------------------------
    revno: 3010.2.2
    revision-id:mbp at sourcefrog.net-20071123045643-6l30ww29l0kzy49y
    parent: mbp at sourcefrog.net-20071122094939-7exa28yk7u0d40ch
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: memorytransport
    timestamp: Fri 2007-11-23 15:56:43 +1100
    message:
      Add missing import
    modified:
      bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
    ------------------------------------------------------------
    revno: 3010.2.1
    revision-id:mbp at sourcefrog.net-20071122094939-7exa28yk7u0d40ch
    parent: pqm at pqm.ubuntu.com-20071121045727-gqycrul94d0ssir1
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: memorytransport
    timestamp: Thu 2007-11-22 20:49:39 +1100
    message:
      Followon from MemoryTransport._abspath fix: add test_rename_across_subdirs, and fix error construction
    modified:
      bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
      bzrlib/transport/memory.py     memory.py-20051016101338-cd008dbdf69f04fc
=== modified file 'bzrlib/tests/test_transport_implementations.py'
--- a/bzrlib/tests/test_transport_implementations.py	2007-11-14 08:05:32 +0000
+++ b/bzrlib/tests/test_transport_implementations.py	2007-11-23 04:56:43 +0000
@@ -45,7 +45,12 @@
                            )
 from bzrlib.osutils import getcwd
 from bzrlib.smart import medium
-from bzrlib.tests import TestCaseInTempDir, TestScenarioApplier, TestSkipped
+from bzrlib.tests import (
+    TestCaseInTempDir,
+    TestScenarioApplier,
+    TestSkipped,
+    TestNotApplicable,
+    )
 from bzrlib.tests.test_transport import TestTransportImplementation
 from bzrlib.transport import (
     ConnectedTransport,
@@ -900,6 +905,20 @@
         self.assertFalse(t.has('adir/bdir'))
         self.assertFalse(t.has('adir/bsubdir'))
 
+    def test_rename_across_subdirs(self):
+        t = self.get_transport()
+        if t.is_readonly():
+            raise TestNotApplicable("transport is readonly")
+        t.mkdir('a')
+        t.mkdir('b')
+        ta = t.clone('a')
+        tb = t.clone('b')
+        ta.put_bytes('f', 'aoeu')
+        ta.rename('f', '../b/f')
+        self.assertTrue(tb.has('f'))
+        self.assertFalse(ta.has('f'))
+        self.assertTrue(t.has('b/f'))
+
     def test_delete_tree(self):
         t = self.get_transport()
 

=== modified file 'bzrlib/transport/memory.py'
--- a/bzrlib/transport/memory.py	2007-11-03 01:07:33 +0000
+++ b/bzrlib/transport/memory.py	2007-11-22 09:49:39 +0000
@@ -272,7 +272,7 @@
             if i == '..':
                 if not r:
                     raise ValueError("illegal relpath %r under %r"
-                        % relpath, self._cwd)
+                        % (relpath, self._cwd))
                 r = r[:-1]
             elif i == '.' or i == '':
                 pass




More information about the bazaar-commits mailing list