27
27
"""Loggerhead web viewer for Bazaar branches.
29
This provides a new option "--http" to the "bzr serve" command, that
29
This provides a new option "--http" to the "bzr serve" command, that
30
30
starts a web server to browse the contents of a branch.
34
bzr_plugin_version as version_info,
35
bzr_compatible_versions,
33
version_info = (1, 17, 0)
38
35
if __name__ == 'bzrlib.plugins.loggerhead':
40
37
from bzrlib.api import require_any_api
42
require_any_api(bzrlib, bzr_compatible_versions)
39
require_any_api(bzrlib, [
40
(1, 13, 0), (1, 15, 0), (1, 16, 0), (1, 17, 0), (1, 18, 0),
41
(2, 0, 0), (2, 1, 0), (2, 2, 0)])
44
43
# NB: Normally plugins should lazily load almost everything, but this
45
44
# seems reasonable to have in-line here: bzrlib.commands and options are
70
69
logging.getLogger('simpleTAL').addHandler(handler)
71
70
logging.getLogger('simpleTALES').addHandler(handler)
72
def serve_http(transport, host=None, port=None, inet=None):
73
from paste.httpexceptions import HTTPExceptionHandler
74
from paste.httpserver import serve
74
def _ensure_loggerhead_path():
75
"""Ensure that you can 'import loggerhead' and get the root."""
76
76
# loggerhead internal code will try to 'import loggerhead', so
77
77
# let's put it on the path if we can't find it in the existing path
81
81
import os.path, sys
82
82
sys.path.append(os.path.dirname(__file__))
84
def serve_http(transport, host=None, port=None, inet=None):
85
from paste.httpexceptions import HTTPExceptionHandler
86
from paste.httpserver import serve
88
_ensure_loggerhead_path()
90
84
from loggerhead.apps.transport import BranchesFromTransportRoot
91
85
from loggerhead.config import LoggerheadConfig
138
132
super(cmd_serve, self).run(*args, **kw)
140
134
register_command(cmd_serve)
142
def load_tests(standard_tests, module, loader):
143
_ensure_loggerhead_path()
144
standard_tests.addTests(loader.loadTestsFromModuleNames(
145
['bzrlib.plugins.loggerhead.loggerhead.tests']))
146
return standard_tests