37
37
from bzrlib.api import require_any_api
39
require_any_api(bzrlib, [(1, 11, 0), (1, 13, 0)])
39
require_any_api(bzrlib, [(1, 11, 0), (1, 13, 0), (1, 15, 0)])
41
41
# TODO: This should provide a new type of server that can be used by bzr
42
42
# serve, maybe through a registry, rather than overriding the command. Though
71
71
import os.path, sys
72
72
sys.path.append(os.path.dirname(__file__))
74
from loggerhead.apps.filesystem import BranchesFromFileSystemRoot
74
from bzrlib.transport import get_transport
75
from loggerhead.apps.transport import BranchesFromTransportRoot
76
from loggerhead.config import LoggerheadConfig
75
77
from paste.httpexceptions import HTTPExceptionHandler
76
78
from paste.httpserver import serve
77
a = HTTPExceptionHandler(BranchesFromFileSystemRoot('.'))
78
79
port = kw.get('port', DEFAULT_PORT)
79
80
# port might be an int already...
80
81
if isinstance(port, basestring) and ':' in port:
81
82
host, port = port.split(':')
84
serve(a, host=host, port=port)
85
argv = ['--host', host, '--port', str(port)]
86
config = LoggerheadConfig(argv)
87
transport = get_transport('.')
88
app = BranchesFromTransportRoot(transport, config)
89
app = HTTPExceptionHandler(app)
90
serve(app, host=host, port=port)
86
92
super(cmd_serve, self).run(*args, **kw)