~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/smart.py

Merge --allow-writes from Robert

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
"""
50
50
 
51
51
 
 
52
# TODO: _translate_error should be on the client, not the transport because
 
53
#     error coding is wire protocol specific.
52
54
 
53
55
# TODO: A plain integer from query_version is too simple; should give some
54
56
# capabilities too?
465
467
            # This handles UnicodeEncodeError or UnicodeDecodeError
466
468
            return SmartServerResponse((e.__class__.__name__,
467
469
                    e.encoding, val, str(e.start), str(e.end), e.reason))
 
470
        except errors.TransportNotPossible, e:
 
471
            if e.msg == "readonly transport":
 
472
                return SmartServerResponse(('ReadOnlyError', ))
 
473
            else:
 
474
                raise
468
475
 
469
476
 
470
477
class SmartTCPServer(object):
864
871
                raise UnicodeDecodeError(encoding, val, start, end, reason)
865
872
            elif what == 'UnicodeEncodeError':
866
873
                raise UnicodeEncodeError(encoding, val, start, end, reason)
 
874
        elif what == "ReadOnlyError":
 
875
            raise errors.TransportNotPossible('readonly transport')
867
876
        else:
868
877
            raise errors.SmartProtocolError('unexpected smart server error: %r' % (resp,))
869
878
 
1040
1049
            vendor = ssh._get_ssh_vendor()
1041
1050
            self._ssh_connection = vendor.connect_ssh(self._username,
1042
1051
                    self._password, self._host, self._port,
1043
 
                    command=[executable, 'serve', '--inet', '--directory=/'])
 
1052
                    command=[executable, 'serve', '--inet', '--directory=/',
 
1053
                             '--allow-writes'])
1044
1054
            return self._ssh_connection.get_filelike_channels()
1045
1055
 
1046
1056
        def disconnect(self):