~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to serve-branches

  • Committer: Martin Albisetti
  • Date: 2009-06-03 23:11:27 UTC
  • mfrom: (352.5.8 global-config)
  • Revision ID: martin.albisetti@canonical.com-20090603231127-kyzswuj78lvq2eb6
Allow setting configuration options in ~/.bazaar/bazaar.conf, and deprecate start-loggerhead

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
 
2
#
 
3
# Copyright (C) 2008, 2009 Canonical Ltd
 
4
#
2
5
# This program is free software; you can redistribute it and/or modify
3
6
# it under the terms of the GNU General Public License as published by
4
7
# the Free Software Foundation; either version 2 of the License, or
20
23
import sys
21
24
 
22
25
from bzrlib.plugin import load_plugins
 
26
from bzrlib.transport import get_transport
23
27
 
24
28
from paste import httpserver
25
29
from paste.httpexceptions import HTTPExceptionHandler, HTTPInternalServerError
26
30
from paste.translogger import TransLogger
27
31
 
28
32
from loggerhead import __version__
29
 
from loggerhead.apps.filesystem import (
30
 
    BranchesFromFileSystemRoot, UserBranchesFromFileSystemRoot)
 
33
from loggerhead.apps.transport import (
 
34
    BranchesFromTransportRoot, UserBranchesFromTransportRoot)
31
35
from loggerhead.config import LoggerheadConfig
32
36
from loggerhead.util import Reloader
33
37
from loggerhead.apps.error import ErrorHandlerApp
48
52
    else:
49
53
        path = '.'
50
54
 
51
 
    if not os.path.isdir(path):
52
 
        print "%s is not a directory" % path
53
 
        sys.exit(1)
 
55
    load_plugins()
 
56
 
 
57
    transport = get_transport(path)
54
58
 
55
59
    if config.get_option('trunk_dir') and not config.get_option('user_dirs'):
56
60
        print "--trunk-dir is only valid with --user-dirs"
66
70
        if not config.get_option('trunk_dir'):
67
71
            print "You didn't specify a directory for the trunk directories."
68
72
            sys.exit(1)
69
 
        app = UserBranchesFromFileSystemRoot(path, config)
 
73
        app = UserBranchesFromTransportRoot(transport, config)
70
74
    else:
71
 
        app = BranchesFromFileSystemRoot(path, config)
 
75
        app = BranchesFromTransportRoot(transport, config)
72
76
 
73
77
    # setup_logging()
74
78
    logging.basicConfig()
134
138
    else:
135
139
        host = config.get_option('user_host')
136
140
 
137
 
    load_plugins()
138
 
 
139
141
    httpserver.serve(app, host=host, port=port)
140
142
 
141
143