~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to serve-branches

  • Committer: Matt Nordhoff
  • Date: 2009-04-18 06:16:28 UTC
  • mto: (389.2.2 pep8-2009-10)
  • mto: This revision was merged to the branch mainline in revision 392.
  • Revision ID: mnordhoff@mattnordhoff.com-20090418061628-se1tmec6uig41md0
Remove unused imports in history.py, plus some syntax tweaks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import sys
21
21
 
22
22
from bzrlib.plugin import load_plugins
23
 
from bzrlib.transport import get_transport
24
23
 
25
24
from paste import httpserver
26
25
from paste.httpexceptions import HTTPExceptionHandler, HTTPInternalServerError
27
26
from paste.translogger import TransLogger
28
27
 
29
28
from loggerhead import __version__
30
 
from loggerhead.apps.transport import (
31
 
    BranchesFromTransportRoot, UserBranchesFromTransportRoot)
 
29
from loggerhead.apps.filesystem import (
 
30
    BranchesFromFileSystemRoot, UserBranchesFromFileSystemRoot)
32
31
from loggerhead.config import LoggerheadConfig
33
32
from loggerhead.util import Reloader
34
33
from loggerhead.apps.error import ErrorHandlerApp
49
48
    else:
50
49
        path = '.'
51
50
 
52
 
    load_plugins()
53
 
 
54
 
    transport = get_transport(path)
 
51
    if not os.path.isdir(path):
 
52
        print "%s is not a directory" % path
 
53
        sys.exit(1)
55
54
 
56
55
    if config.get_option('trunk_dir') and not config.get_option('user_dirs'):
57
56
        print "--trunk-dir is only valid with --user-dirs"
67
66
        if not config.get_option('trunk_dir'):
68
67
            print "You didn't specify a directory for the trunk directories."
69
68
            sys.exit(1)
70
 
        app = UserBranchesFromTransportRoot(transport, config)
 
69
        app = UserBranchesFromFileSystemRoot(
 
70
            path, config.get_option('trunk_dir'))
71
71
    else:
72
 
        app = BranchesFromTransportRoot(transport, config)
 
72
        app = BranchesFromFileSystemRoot(path)
73
73
 
74
74
    # setup_logging()
75
75
    logging.basicConfig()
87
87
    logfile.setLevel(logging.DEBUG)
88
88
    logger.addHandler(logfile)
89
89
 
 
90
    if config.get_option('memory_profile'):
 
91
        memprofile = logging.getLogger('loggerhead-memprofile')
 
92
        memprofile.setLevel(logging.DEBUG)
 
93
        memprofile.addHandler(logging.FileHandler('loggerhead-memprofile'))
 
94
 
90
95
    # setup_logging() #end
91
96
 
92
97
    app = TransLogger(app, logger=logger)
94
99
        from loggerhead.middleware.profile import LSProfMiddleware
95
100
        app = LSProfMiddleware(app)
96
101
    if config.get_option('memory_profile'):
97
 
        from dozer import Dozer
98
 
        app = Dozer(app)
 
102
        from loggerhead.middleware.profile import MemoryProfileMiddleware
 
103
        app = MemoryProfileMiddleware(app)
99
104
 
100
105
    if not config.get_option('user_prefix'):
101
106
        prefix = '/'
135
140
    else:
136
141
        host = config.get_option('user_host')
137
142
 
 
143
    load_plugins()
 
144
 
138
145
    httpserver.serve(app, host=host, port=port)
139
146
 
140
147