~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/remote.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-07-27 09:33:30 UTC
  • mfrom: (4556.2.10 hpss-push-tags)
  • Revision ID: pqm@pqm.ubuntu.com-20090727093330-882xn6s1tt1zbnw6
(andrew) Add Branch.set_tags_bytes verb, removing more VFS calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
        except errors.ErrorFromSmartServer, err:
60
60
            self._translate_error(err, **err_context)
61
61
 
 
62
    def _call_with_body_bytes(self, method, args, body_bytes, **err_context):
 
63
        try:
 
64
            return self._client.call_with_body_bytes(method, args, body_bytes)
 
65
        except errors.ErrorFromSmartServer, err:
 
66
            self._translate_error(err, **err_context)
 
67
 
62
68
    def _call_with_body_bytes_expecting_body(self, method, args, body_bytes,
63
69
                                             **err_context):
64
70
        try:
2162
2168
            return self._vfs_get_tags_bytes()
2163
2169
        return response[0]
2164
2170
 
 
2171
    def _vfs_set_tags_bytes(self, bytes):
 
2172
        self._ensure_real()
 
2173
        return self._real_branch._set_tags_bytes(bytes)
 
2174
 
 
2175
    def _set_tags_bytes(self, bytes):
 
2176
        medium = self._client._medium
 
2177
        if medium._is_remote_before((1, 18)):
 
2178
            self._vfs_set_tags_bytes(bytes)
 
2179
        try:
 
2180
            args = (
 
2181
                self._remote_path(), self._lock_token, self._repo_lock_token)
 
2182
            response = self._call_with_body_bytes(
 
2183
                'Branch.set_tags_bytes', args, bytes)
 
2184
        except errors.UnknownSmartMethod:
 
2185
            medium._remember_remote_is_before((1, 18))
 
2186
            self._vfs_set_tags_bytes(bytes)
 
2187
 
2165
2188
    def lock_read(self):
2166
2189
        self.repository.lock_read()
2167
2190
        if not self._lock_mode:
2221
2244
            self.repository.lock_write(self._repo_lock_token)
2222
2245
        return self._lock_token or None
2223
2246
 
2224
 
    def _set_tags_bytes(self, bytes):
2225
 
        self._ensure_real()
2226
 
        return self._real_branch._set_tags_bytes(bytes)
2227
 
 
2228
2247
    def _unlock(self, branch_token, repo_token):
2229
2248
        err_context = {'token': str((branch_token, repo_token))}
2230
2249
        response = self._call(