~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Andrew Bennetts
  • Date: 2009-07-22 10:55:35 UTC
  • mto: This revision was merged to the branch mainline in revision 4573.
  • Revision ID: andrew.bennetts@canonical.com-20090722105535-t2iv2j8zbj2230q2
Add Branch.set_tags_bytes RPC, with HPSS call count acceptance test.  Also fixes serialisation of LockDir, and uses external_url() in LockDir's repr and contention message.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
        except errors.ErrorFromSmartServer, err:
62
62
            self._translate_error(err, **err_context)
63
63
 
 
64
    def _call_with_body_bytes(self, method, args, body_bytes, **err_context):
 
65
        try:
 
66
            return self._client.call_with_body_bytes(method, args, body_bytes)
 
67
        except errors.ErrorFromSmartServer, err:
 
68
            self._translate_error(err, **err_context)
 
69
 
64
70
    def _call_with_body_bytes_expecting_body(self, method, args, body_bytes,
65
71
                                             **err_context):
66
72
        try:
2146
2152
            return self._vfs_get_tags_bytes()
2147
2153
        return response[0]
2148
2154
 
 
2155
    def _vfs_set_tags_bytes(self):
 
2156
        self._ensure_real()
 
2157
        return self._real_branch._set_tags_bytes()
 
2158
 
 
2159
    def _set_tags_bytes(self, bytes):
 
2160
        medium = self._client._medium
 
2161
        if medium._is_remote_before((1, 18)):
 
2162
            self._vfs_set_tags_bytes(bytes)
 
2163
        try:
 
2164
            args = (
 
2165
                self._remote_path(), self._lock_token, self._repo_lock_token)
 
2166
            response = self._call_with_body_bytes(
 
2167
                'Branch.set_tags_bytes', args, bytes)
 
2168
        except errors.UnknownSmartMethod:
 
2169
            medium._remember_remote_is_before((1, 18))
 
2170
            self._vfs_set_tags_bytes(bytes)
 
2171
 
2149
2172
    def lock_read(self):
2150
2173
        self.repository.lock_read()
2151
2174
        if not self._lock_mode:
2205
2228
            self.repository.lock_write(self._repo_lock_token)
2206
2229
        return self._lock_token or None
2207
2230
 
2208
 
    def _set_tags_bytes(self, bytes):
2209
 
        self._ensure_real()
2210
 
        return self._real_branch._set_tags_bytes(bytes)
2211
 
 
2212
2231
    def _unlock(self, branch_token, repo_token):
2213
2232
        err_context = {'token': str((branch_token, repo_token))}
2214
2233
        response = self._call(