Rev 3021: In the RemoteServer branch methods handle repositories that cannot be remotely locked like pack repositories. in http://people.ubuntu.com/~robertc/baz2.0/pack.read-locks
Robert Collins
robertc at robertcollins.net
Mon Nov 26 02:07:10 GMT 2007
At http://people.ubuntu.com/~robertc/baz2.0/pack.read-locks
------------------------------------------------------------
revno: 3021
revision-id:robertc at robertcollins.net-20071126020652-u7lp6gpb86ppvl1r
parent: robertc at robertcollins.net-20071126020511-udqau8afmvtulcxg
committer: Robert Collins <robertc at robertcollins.net>
branch nick: pack.read-locks
timestamp: Mon 2007-11-26 13:06:52 +1100
message:
In the RemoteServer branch methods handle repositories that cannot be remotely locked like pack repositories.
modified:
bzrlib/smart/branch.py branch.py-20061124031907-mzh3pla28r83r97f-1
=== modified file 'bzrlib/smart/branch.py'
--- a/bzrlib/smart/branch.py 2007-10-05 04:43:17 +0000
+++ b/bzrlib/smart/branch.py 2007-11-26 02:06:52 +0000
@@ -128,6 +128,7 @@
try:
branch_token = branch.lock_write(token=branch_token)
finally:
+ # this leaves the repository with 1 lock
branch.repository.unlock()
except errors.LockContention:
return FailedSmartServerResponse(('LockContention',))
@@ -137,7 +138,10 @@
return FailedSmartServerResponse(('UnlockableTransport',))
except errors.LockFailed, e:
return FailedSmartServerResponse(('LockFailed', str(e.lock), str(e.why)))
- branch.repository.leave_lock_in_place()
+ if repo_token is None:
+ repo_token = ''
+ else:
+ branch.repository.leave_lock_in_place()
branch.leave_lock_in_place()
branch.unlock()
return SuccessfulSmartServerResponse(('ok', branch_token, repo_token))
@@ -154,7 +158,8 @@
branch.repository.unlock()
except errors.TokenMismatch:
return FailedSmartServerResponse(('TokenMismatch',))
- branch.repository.dont_leave_lock_in_place()
+ if repo_token:
+ branch.repository.dont_leave_lock_in_place()
branch.dont_leave_lock_in_place()
branch.unlock()
return SuccessfulSmartServerResponse(('ok',))
More information about the bazaar-commits
mailing list