Merge server implementation.
[jelmer/dulwich-libgit2.git] / bin / dul-daemon
1 #!/usr/bin/python
2 # dul-daemon - Simple git-daemon a like
3 # Copyright (C) 2008 John Carr <john.carr@unrouted.co.uk>
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 # 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 sys
21 from dulwich.server import Backend, TCPGitServer
22
23 class GitBackend(Backend):
24
25     def __init__(self, gitdir):
26         self.gitdir = gitdir
27
28     def get_refs(self):
29         return [['refs/heads/foo', '768fbb786f3a0a2a97ed980f3ce730e9e984f436']]
30
31     def has_revision(self, sha):
32         return False
33
34     def apply_pack(self, refs, read):
35         read()
36
37     def generate_pack(self, want, have, write, progress):
38         pass
39
40
41 if __name__ == "__main__":
42     backend = GitBackend(sys.argv[1])
43     server = TCPGitServer(backend, ('localhost', 9418))
44     server.serve_forever()