~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: 2008-01-03 18:09:01 UTC
  • mfrom: (3159.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20080103180901-w987y1ftqoh02qbm
(vila) Fix #179368 by keeping the current range hint on
        ShortReadvErrors

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',))
135
136
            return FailedSmartServerResponse(('TokenMismatch',))
136
137
        except errors.UnlockableTransport:
137
138
            return FailedSmartServerResponse(('UnlockableTransport',))
138
 
        branch.repository.leave_lock_in_place()
 
139
        except errors.LockFailed, e:
 
140
            return FailedSmartServerResponse(('LockFailed', str(e.lock), str(e.why)))
 
141
        if repo_token is None:
 
142
            repo_token = ''
 
143
        else:
 
144
            branch.repository.leave_lock_in_place()
139
145
        branch.leave_lock_in_place()
140
146
        branch.unlock()
141
147
        return SuccessfulSmartServerResponse(('ok', branch_token, repo_token))
152
158
                branch.repository.unlock()
153
159
        except errors.TokenMismatch:
154
160
            return FailedSmartServerResponse(('TokenMismatch',))
155
 
        branch.repository.dont_leave_lock_in_place()
 
161
        if repo_token:
 
162
            branch.repository.dont_leave_lock_in_place()
156
163
        branch.dont_leave_lock_in_place()
157
164
        branch.unlock()
158
165
        return SuccessfulSmartServerResponse(('ok',))