/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/smart/request.py

Extract a simple SmartClient class from RemoteTransport, and a hack to avoid VFS operations when probing for a bzrdir over a smart transport.

Show diffs side-by-side

added added

removed removed

Lines of Context:
203
203
        return SmartServerResponse((), tmpf.read())
204
204
 
205
205
 
 
206
# This exists solely to help RemoteObjectHacking.  It should be removed
 
207
# eventually.  It should not be considered part of the real smart server
 
208
# protocol!
 
209
class ProbeDontUseRequest(SmartServerRequest):
 
210
 
 
211
    def do(self, path):
 
212
        from bzrlib.bzrdir import BzrDirFormat
 
213
        t = self._backing_transport.clone(path)
 
214
        default_format = BzrDirFormat.get_default_format()
 
215
        real_bzrdir = default_format.open(t, _found=True)
 
216
        try:
 
217
            real_bzrdir._format.probe_transport(t)
 
218
        except (errors.NotBranchError, errors.UnknownFormatError):
 
219
            answer = 'no'
 
220
        else:
 
221
            answer = 'yes'
 
222
        return SmartServerResponse((answer,))
 
223
 
 
224
 
206
225
request_handlers = registry.Registry()
207
226
request_handlers.register_lazy(
208
227
    'append', 'bzrlib.smart.vfs', 'AppendRequest')
236
255
    'rmdir', 'bzrlib.smart.vfs', 'RmdirCommand')
237
256
request_handlers.register_lazy(
238
257
    'stat', 'bzrlib.smart.vfs', 'StatCommand')
239
 
 
 
258
request_handlers.register_lazy(
 
259
    'probe_dont_use', 'bzrlib.smart.request', 'ProbeDontUseRequest')