Rev 2194: Fix most of the lockable_files tests for RemoteBranchLockableFiles. in sftp://bazaar.launchpad.net/%7Ebzr/bzr/hpss/

Andrew Bennetts andrew.bennetts at canonical.com
Thu Mar 29 07:47:45 BST 2007


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

------------------------------------------------------------
revno: 2194
revision-id: andrew.bennetts at canonical.com-20070329064628-gdonyjmcedx7q8vh
parent: robertc at robertcollins.net-20070329060318-uqqabpbnzsnaldx7
committer: Andrew Bennetts <andrew.bennetts at canonical.com>
branch nick: hpss
timestamp: Thu 2007-03-29 16:46:28 +1000
message:
  Fix most of the lockable_files tests for RemoteBranchLockableFiles.
modified:
  bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/test_lockable_files.py test_lockable_files.py-20051225183927-365c7fd99591caf1
=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2007-03-27 06:42:26 +0000
+++ b/bzrlib/errors.py	2007-03-29 06:46:28 +0000
@@ -1228,12 +1228,13 @@
 
     _fmt = ("The medium '%(medium)s' has reached its concurrent request limit."
             " Be sure to finish_writing and finish_reading on the"
-            " current request that is open.")
+            " current open request: %(current_request)r")
 
     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 05:00:40 +0000
+++ b/bzrlib/remote.py	2007-03-29 06:46:28 +0000
@@ -20,12 +20,13 @@
 from cStringIO import StringIO
 from urlparse import urlparse
 
-from bzrlib import branch, errors, repository
+from bzrlib import branch, errors, lockdir, repository
 from bzrlib.branch import BranchReferenceFormat
 from bzrlib.bzrdir import BzrDir, BzrDirFormat, RemoteBzrDirFormat
 from bzrlib.config import BranchConfig, TreeConfig
 from bzrlib.decorators import needs_read_lock, needs_write_lock
 from bzrlib.errors import NoSuchRevision
+from bzrlib.lockable_files import LockableFiles
 from bzrlib.revision import NULL_REVISION
 from bzrlib.smart import client, vfs
 from bzrlib.urlutils import unescape
@@ -595,7 +596,7 @@
         return self._real_repository.has_signature_for_revision_id(revision_id)
 
 
-class RemoteBranchLockableFiles(object):
+class RemoteBranchLockableFiles(LockableFiles):
     """A 'LockableFiles' implementation that talks to a smart server.
     
     This is not a public interface class.
@@ -604,6 +605,8 @@
     def __init__(self, bzrdir, _client):
         self.bzrdir = bzrdir
         self._client = _client
+        LockableFiles.__init__(self, bzrdir.root_transport, 'lock',
+                lockdir.LockDir)
 
     def get(self, path):
         """'get' a remote path as per the LockableFiles interface.
@@ -612,6 +615,8 @@
              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)

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2007-03-28 22:54:43 +0000
+++ b/bzrlib/tests/__init__.py	2007-03-29 06:46:28 +0000
@@ -2155,7 +2155,6 @@
                    'bzrlib.tests.test_ssh_transport',
                    'bzrlib.tests.test_status',
                    'bzrlib.tests.test_store',
-                   'bzrlib.tests.test_strace',
                    'bzrlib.tests.test_subsume',
                    'bzrlib.tests.test_symbol_versioning',
                    'bzrlib.tests.test_tag',

=== modified file 'bzrlib/tests/test_lockable_files.py'
--- a/bzrlib/tests/test_lockable_files.py	2007-03-01 05:08:32 +0000
+++ b/bzrlib/tests/test_lockable_files.py	2007-03-29 06:46:28 +0000
@@ -371,40 +371,3 @@
         # getting a new lockable involves opening a new instance of the branch
         branch = bzrlib.branch.Branch.open(self.get_url('foo'))
         return branch.control_files
-
-    def test_lock_write_returns_None_refuses_token(self):
-        # this test is not relevant for RemoteBranchLockableFiles as remote
-        # locks are done directly from the remote branch object.
-        return None
-
-    def test_lock_write_raises_on_token_mismatch(self):
-        # See test_lock_write_returns_None_refuses_token.
-        return None
-
-    def test_lock_write_with_matching_token(self):
-        # See test_lock_write_returns_None_refuses_token.
-        return None
-
-    def test_unlock_after_lock_write_with_token(self):
-        # See test_lock_write_returns_None_refuses_token.
-        return None
-
-    def test_lock_write_with_token_fails_when_unlocked(self):
-        # See test_lock_write_returns_None_refuses_token.
-        return None
-
-    def test_lock_write_reenter_with_token(self):
-        # See test_lock_write_returns_None_refuses_token.
-        return None
-
-    def test_leave_in_place(self):
-        # See test_lock_write_returns_None_refuses_token.
-        return None
-
-    def test_dont_leave_in_place(self):
-        # See test_lock_write_returns_None_refuses_token.
-        return None
-
-    def test_lock_write_returns_token_when_given_token(self):
-        # See test_lock_write_returns_None_refuses_token.
-        return None




More information about the bazaar-commits mailing list