~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to serve-branches

  • Committer: Matt Nordhoff
  • Date: 2009-05-04 20:28:50 UTC
  • mfrom: (336.2.3 transport)
  • Revision ID: mnordhoff@mattnordhoff.com-20090504202850-9p17jxgvxspx8k47
Use transports internally rather than local file system. (Jelmer Vernooij)

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
23
24
 
24
25
from paste import httpserver
25
26
from paste.httpexceptions import HTTPExceptionHandler, HTTPInternalServerError
26
27
from paste.translogger import TransLogger
27
28
 
28
29
from loggerhead import __version__
29
 
from loggerhead.apps.filesystem import (
30
 
    BranchesFromFileSystemRoot, UserBranchesFromFileSystemRoot)
 
30
from loggerhead.apps.transport import (
 
31
    BranchesFromTransportRoot, UserBranchesFromTransportRoot)
31
32
from loggerhead.config import LoggerheadConfig
32
33
from loggerhead.util import Reloader
33
34
from loggerhead.apps.error import ErrorHandlerApp
48
49
    else:
49
50
        path = '.'
50
51
 
51
 
    if not os.path.isdir(path):
52
 
        print "%s is not a directory" % path
53
 
        sys.exit(1)
 
52
    load_plugins()
 
53
 
 
54
    transport = get_transport(path)
54
55
 
55
56
    if config.get_option('trunk_dir') and not config.get_option('user_dirs'):
56
57
        print "--trunk-dir is only valid with --user-dirs"
66
67
        if not config.get_option('trunk_dir'):
67
68
            print "You didn't specify a directory for the trunk directories."
68
69
            sys.exit(1)
69
 
        app = UserBranchesFromFileSystemRoot(path, config)
 
70
        app = UserBranchesFromTransportRoot(transport, config)
70
71
    else:
71
 
        app = BranchesFromFileSystemRoot(path, config)
 
72
        app = BranchesFromTransportRoot(transport, config)
72
73
 
73
74
    # setup_logging()
74
75
    logging.basicConfig()
134
135
    else:
135
136
        host = config.get_option('user_host')
136
137
 
137
 
    load_plugins()
138
 
 
139
138
    httpserver.serve(app, host=host, port=port)
140
139
 
141
140