~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/branch.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-11-26 21:33:20 UTC
  • mfrom: (3015.2.15 pack.read-locks)
  • Revision ID: pqm@pqm.ubuntu.com-20071126213320-adxxra3gsie5inhw
(robertc) Many fixes to support packs on the smart server and as the
        default format. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
            try:
129
129
                branch_token = branch.lock_write(token=branch_token)
130
130
            finally:
 
131
                # this leaves the repository with 1 lock
131
132
                branch.repository.unlock()
132
133
        except errors.LockContention:
133
134
            return FailedSmartServerResponse(('LockContention',))
137
138
            return FailedSmartServerResponse(('UnlockableTransport',))
138
139
        except errors.LockFailed, e:
139
140
            return FailedSmartServerResponse(('LockFailed', str(e.lock), str(e.why)))
140
 
        branch.repository.leave_lock_in_place()
 
141
        if repo_token is None:
 
142
            repo_token = ''
 
143
        else:
 
144
            branch.repository.leave_lock_in_place()
141
145
        branch.leave_lock_in_place()
142
146
        branch.unlock()
143
147
        return SuccessfulSmartServerResponse(('ok', branch_token, repo_token))
154
158
                branch.repository.unlock()
155
159
        except errors.TokenMismatch:
156
160
            return FailedSmartServerResponse(('TokenMismatch',))
157
 
        branch.repository.dont_leave_lock_in_place()
 
161
        if repo_token:
 
162
            branch.repository.dont_leave_lock_in_place()
158
163
        branch.dont_leave_lock_in_place()
159
164
        branch.unlock()
160
165
        return SuccessfulSmartServerResponse(('ok',))