Rev 3022: In the RemoteServer repository methods handle repositories that cannot be remotely locked like pack repositories, and add a read lock in SmartServerRepositoryStreamKnitDataForRevisions. in http://people.ubuntu.com/~robertc/baz2.0/pack.read-locks
Robert Collins
robertc at robertcollins.net
Mon Nov 26 02:08:32 GMT 2007
At http://people.ubuntu.com/~robertc/baz2.0/pack.read-locks
------------------------------------------------------------
revno: 3022
revision-id:robertc at robertcollins.net-20071126020813-7sqwqvr0rucxv0oc
parent: robertc at robertcollins.net-20071126020652-u7lp6gpb86ppvl1r
committer: Robert Collins <robertc at robertcollins.net>
branch nick: pack.read-locks
timestamp: Mon 2007-11-26 13:08:13 +1100
message:
In the RemoteServer repository methods handle repositories that cannot be remotely locked like pack repositories, and add a read lock in SmartServerRepositoryStreamKnitDataForRevisions.
modified:
bzrlib/smart/repository.py repository.py-20061128022038-vr5wy5bubyb8xttk-1
=== modified file 'bzrlib/smart/repository.py'
--- a/bzrlib/smart/repository.py 2007-10-17 09:39:41 +0000
+++ b/bzrlib/smart/repository.py 2007-11-26 02:08:13 +0000
@@ -168,7 +168,8 @@
except errors.LockFailed, e:
return FailedSmartServerResponse(('LockFailed',
str(e.lock), str(e.why)))
- repository.leave_lock_in_place()
+ if token is not None:
+ repository.leave_lock_in_place()
repository.unlock()
if token is None:
token = ''
@@ -249,6 +250,13 @@
class SmartServerRepositoryStreamKnitDataForRevisions(SmartServerRepositoryRequest):
def do_repository_request(self, repository, *revision_ids):
+ repository.lock_read()
+ try:
+ return self._do_repository_request(repository, revision_ids)
+ finally:
+ repository.unlock()
+
+ def _do_repository_request(self, repository, revision_ids):
stream = repository.get_data_stream(revision_ids)
filelike = StringIO()
pack = ContainerWriter(filelike.write)
More information about the bazaar-commits
mailing list