1234567891011121314151617181920212223242526272829303132333435 |
- import sys
- from dulwich.repo import Repo
- from dulwich.server import GitBackend, UploadPackHandler
- def send_fn(data):
- sys.stdout.write(data)
- sys.stdout.flush()
- if __name__ == "__main__":
- gitdir = None
- if len(sys.argv) > 1:
- gitdir = sys.argv[1]
- backend = GitBackend(Repo(gitdir))
- handler = UploadPackHandler(backend, sys.stdin.read, send_fn)
- handler.handle()
|