307
307
return transport.get_transport(url)
310
def serve_bzr(transport, host=None, port=None, inet=False):
311
from bzrlib import lockdir, ui
312
from bzrlib.transport import get_transport
313
from bzrlib.transport.chroot import ChrootServer
314
chroot_server = ChrootServer(transport)
315
chroot_server.setUp()
316
t = get_transport(chroot_server.get_url())
318
smart_server = medium.SmartServerPipeStreamMedium(
319
sys.stdin, sys.stdout, transport)
322
host = medium.BZR_DEFAULT_INTERFACE
324
port = medium.BZR_DEFAULT_PORT
325
smart_server = SmartTCPServer(
326
transport, host=host, port=port)
327
trace.note('listening on port: %s' % smart_server.port)
328
# For the duration of this server, no UI output is permitted. note
329
# that this may cause problems with blackbox tests. This should be
330
# changed with care though, as we dont want to use bandwidth sending
331
# progress over stderr to smart server clients!
332
old_factory = ui.ui_factory
333
old_lockdir_timeout = lockdir._DEFAULT_TIMEOUT_SECONDS
335
ui.ui_factory = ui.SilentUIFactory()
336
lockdir._DEFAULT_TIMEOUT_SECONDS = 0
339
ui.ui_factory = old_factory
340
lockdir._DEFAULT_TIMEOUT_SECONDS = old_lockdir_timeout