12345678910111213141516171819202122232425262728293031323334 |
- import sys
- from getopt import getopt
- from dulwich.repo import Repo
- from dulwich.client import get_transport_and_path
- opts, args = getopt(sys.argv, "", [])
- opts = dict(opts)
- if len(args) < 2:
- print("usage: %s host:path path" % (args[0], ))
- sys.exit(1)
- client, host_path = get_transport_and_path(args[1])
- path = args[2]
- r = Repo.init(path, mkdir=True)
- remote_refs = client.fetch(host_path, r,
- determine_wants=r.object_store.determine_wants_all,
- progress=sys.stdout.write)
- r["HEAD"] = remote_refs["HEAD"]
- r._build_tree()
|