Rev 2200: All TestLockableFiles_RemoteLockDir tests passing. in sftp://bazaar.launchpad.net/%7Ebzr/bzr/hpss/

Andrew Bennetts andrew.bennetts at canonical.com
Thu Mar 29 10:09:29 BST 2007


At sftp://bazaar.launchpad.net/%7Ebzr/bzr/hpss/

------------------------------------------------------------
revno: 2200
revision-id: andrew.bennetts at canonical.com-20070329090825-n2imszarc27gf6ls
parent: robertc at robertcollins.net-20070329085846-0tmwanst070lb0e5
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: hpss
timestamp: Thu 2007-03-29 19:08:25 +1000
message:
  All TestLockableFiles_RemoteLockDir tests passing.
modified:
  bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/tests/test_lockable_files.py test_lockable_files.py-20051225183927-365c7fd99591caf1
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2007-03-29 06:46:28 +0000
+++ b/bzrlib/errors.py	2007-03-29 09:08:25 +0000
@@ -1228,13 +1228,12 @@
 
     _fmt = ("The medium '%(medium)s' has reached its concurrent request limit."
             " Be sure to finish_writing and finish_reading on the"
-            " current open request: %(current_request)r")
+            " current open request.")
 
     internal_error = True
 
     def __init__(self, medium):
         self.medium = medium
-        self.current_request = medium._current_request
 
 
 class SmartProtocolError(TransportError):

=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2007-03-29 08:58:46 +0000
+++ b/bzrlib/remote.py	2007-03-29 09:08:25 +0000
@@ -615,8 +615,11 @@
     def __init__(self, bzrdir, _client):
         self.bzrdir = bzrdir
         self._client = _client
-        LockableFiles.__init__(self, bzrdir.root_transport, 'lock',
-                lockdir.LockDir)
+        # XXX: This assumes that the branch control directory is .bzr/branch,
+        # which isn't necessarily true.
+        LockableFiles.__init__(
+            self, bzrdir.root_transport.clone('.bzr/branch'),
+            'lock', lockdir.LockDir)
 
     def get(self, path):
         """'get' a remote path as per the LockableFiles interface.
@@ -625,14 +628,15 @@
              just retrieve a file, instead we ask the smart server to generate
              a configuration for us - which is retrieved as an INI file.
         """
-        if path != 'branch.conf':
-            raise errors.NoSuchFile(path)
-        assert path == 'branch.conf'
-        path = self.bzrdir._path_for_remote_call(self._client)
-        response = self._client.call2('Branch.get_config_file', path)
-        assert response[0][0] == 'ok', \
-            'unexpected response code %s' % (response[0],)
-        return StringIO(response[1].read_body_bytes())
+        if path == 'branch.conf':
+            path = self.bzrdir._path_for_remote_call(self._client)
+            response = self._client.call2('Branch.get_config_file', path)
+            assert response[0][0] == 'ok', \
+                'unexpected response code %s' % (response[0],)
+            return StringIO(response[1].read_body_bytes())
+        else:
+            # VFS fallback.
+            return LockableFiles.get(self, path)
 
 
 class RemoteBranchFormat(branch.BranchFormat):

=== modified file 'bzrlib/tests/test_lockable_files.py'
--- a/bzrlib/tests/test_lockable_files.py	2007-03-29 06:46:28 +0000
+++ b/bzrlib/tests/test_lockable_files.py	2007-03-29 09:08:25 +0000
@@ -48,7 +48,7 @@
             self.assertEqual(4, len(unicode_string))
             byte_string = unicode_string.encode('utf-8')
             self.assertEqual(6, len(byte_string))
-            self.assertRaises(UnicodeEncodeError, self.lockable.put, 'foo', 
+            self.assertRaises(UnicodeEncodeError, self.lockable.put, 'foo',
                               StringIO(unicode_string))
             self.lockable.put('foo', StringIO(byte_string))
             self.assertEqual(byte_string,




More information about the bazaar-commits mailing list