12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #!/usr/bin/python
- # dul-daemon - Simple git smart server client
- # Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
- #
- # This program is free software; you can redistribute it and/or
- # modify it under the terms of the GNU General Public License
- # as published by the Free Software Foundation; version 2
- # or (at your option) a later version of the License.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program; if not, write to the Free Software
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- # MA 02110-1301, USA.
- from dulwich.client import TCPGitClient, SimpleFetchGraphWalker
- from dulwich.repo import Repo
- import sys
- (host, path) = sys.argv[1].split(":", 1)
- client = TCPGitClient(host)
- all = True
- if all:
- determine_wants = lambda x: x.values()
- else:
- determine_wants = lambda x: sys.argv[1:]
- r = Repo(".")
- # FIXME: Will just fetch everything..
- graphwalker = SimpleFetchGraphWalker(r.heads().values(), r.get_parents)
- f, commit = r.add_pack()
- try:
- client.fetch_pack(path, determine_wants, graphwalker, f.write, sys.stdout.write)
- f.close()
- commit()
- except:
- f.close()
- raise
|