Merge support for lazy loading packs.
[jelmer/dulwich-libgit2.git] / bin / dul-web
1 #!/usr/bin/python
2 # dul-web - HTTP-based git server
3 # Copyright (C) 2010 Google, Inc. <dborowitz@google.com>
4 #
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; version 2
8 # or (at your option) a later version of the License.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 # MA  02110-1301, USA.
19
20 import os
21 import sys
22 from dulwich.repo import Repo
23 from dulwich.server import DictBackend
24 from dulwich.web import HTTPGitApplication
25 from wsgiref.simple_server import make_server
26
27 if __name__ == "__main__":
28     if len(sys.argv) > 1:
29         gitdir = sys.argv[1]
30     else:
31         gitdir = os.getcwd()
32
33     backend = DictBackend({"/": Repo(gitdir)})
34     app = HTTPGitApplication(backend)
35     # TODO: allow serving on other ports via command-line flag
36     server = make_server('', 8000, app)
37     server.serve_forever()