/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transport/remote.py

merge bzr.dev@3883

Show diffs side-by-side

added added

removed removed

Lines of Context:
172
172
        try:
173
173
            return self._client.call(method, *args)
174
174
        except errors.ErrorFromSmartServer, err:
175
 
            self._translate_error(err)
 
175
            # The first argument, if present, is always a path.
 
176
            if args:
 
177
                context = {'relpath': args[0]}
 
178
            else:
 
179
                context = {}
 
180
            self._translate_error(err, **context)
176
181
 
177
182
    def _call_with_body_bytes(self, method, args, body):
178
183
        """Call a method on the remote server with body bytes."""
179
184
        try:
180
185
            return self._client.call_with_body_bytes(method, args, body)
181
186
        except errors.ErrorFromSmartServer, err:
182
 
            self._translate_error(err)
 
187
            # The first argument, if present, is always a path.
 
188
            if args:
 
189
                context = {'relpath': args[0]}
 
190
            else:
 
191
                context = {}
 
192
            self._translate_error(err, **context)
183
193
 
184
194
    def has(self, relpath):
185
195
        """Indicate whether a remote file of the given name exists or not.
313
323
        sorted_offsets = sorted(offsets)
314
324
        coalesced = list(self._coalesce_offsets(sorted_offsets,
315
325
                               limit=self._max_readv_combine,
316
 
                               fudge_factor=self._bytes_to_read_before_seek))
 
326
                               fudge_factor=self._bytes_to_read_before_seek,
 
327
                               max_size=self._max_readv_bytes))
317
328
 
318
329
        # now that we've coallesced things, avoid making enormous requests
319
330
        requests = []
347
358
                    [(c.start, c.length) for c in cur_request])
348
359
                resp, response_handler = result
349
360
            except errors.ErrorFromSmartServer, err:
350
 
                self._translate_error(err)
 
361
                self._translate_error(err, relpath)
351
362
 
352
363
            if resp[0] != 'readv':
353
364
                # This should raise an exception
411
422
        if resp[0] != 'ok':
412
423
            raise errors.UnexpectedSmartServerResponse(resp)
413
424
        
414
 
    def _translate_error(self, err, orig_path=None):
415
 
        remote._translate_error(err, path=orig_path)
 
425
    def _translate_error(self, err, relpath=None):
 
426
        remote._translate_error(err, path=relpath)
416
427
 
417
428
    def disconnect(self):
418
429
        self.get_smart_medium().disconnect()