92
92
branch.generate_revision_history(unicode_new_last_revision_id)
93
93
return SmartServerResponse(('ok',))
96
class SmartServerBranchRequestLockWrite(SmartServerBranchRequest):
98
def do_with_branch(self, branch, branch_token='', repo_token=''):
99
if branch_token == '':
103
tokens = (branch_token, repo_token)
104
if tokens == ('', ''):
107
branch_token, repo_token = branch.lock_write(tokens=tokens)
108
except errors.LockContention:
109
return SmartServerResponse(('LockContention',))
110
except errors.TokenMismatch:
111
return SmartServerResponse(('TokenMismatch',))
112
branch.repository.leave_lock_in_place()
113
branch.leave_lock_in_place()
115
return SmartServerResponse(('ok', branch_token, repo_token))
118
class SmartServerBranchRequestUnlock(SmartServerBranchRequest):
120
def do_with_branch(self, branch, branch_token, repo_token):
121
tokens = branch_token, repo_token
123
tokens = branch.lock_write(tokens=tokens)
124
except errors.TokenMismatch:
125
return SmartServerResponse(('TokenMismatch',))
126
branch.repository.dont_leave_lock_in_place()
127
branch.dont_leave_lock_in_place()
129
return SmartServerResponse(('ok',))