Changeset 669105af83a4…
Parent 9df270a8044b…
by
Changes to 3 files · Browse files at 669105af83a4 Showing diff from parent 9df270a8044b Diff from another changeset...
@@ -29,6 +29,7 @@ # if its not git or git+ssh, try a local url..
return SubprocessGitClient(), uri
+
def cmd_fetch_pack(args):
from dulwich.client import SimpleFetchGraphWalker
from dulwich.repo import Repo
@@ -36,7 +37,7 @@ opts = dict(opts)
client, path = get_transport_and_path(args.pop(0))
if "--all" in opts:
- determine_wants = lambda x: [y for y in x.values() if not y in r.object_store]
+ determine_wants = r.object_store.determine_wants_all
else:
determine_wants = lambda x: [y for y in args if not y in r.object_store]
r = Repo(".")
@@ -152,7 +153,6 @@ if args == []:
print "usage: dulwich clone host:path [PATH]"
sys.exit(1)
-
client, host_path = get_transport_and_path(args.pop(0))
if len(args) > 0:
@@ -164,11 +164,10 @@ os.mkdir(path)
Repo.init(path)
r = Repo(path)
- determine_wants = lambda x: [y for y in x.values() if not y in r.object_store]
graphwalker = SimpleFetchGraphWalker(r.heads().values(), r.get_parents)
f, commit = r.object_store.add_pack()
try:
- client.fetch_pack(host_path, determine_wants, graphwalker, f.write,
+ client.fetch_pack(host_path, r.object_store.determine_wants_all, graphwalker, f.write,
sys.stdout.write)
f.close()
commit()
|
@@ -85,8 +85,7 @@ (sha, ref) = pkt.rstrip("\n").split(" ", 1)
if server_capabilities is None:
(ref, server_capabilities) = extract_capabilities(ref)
- if not (ref == "capabilities^{}" and sha == "0" * 40):
- refs[ref] = sha
+ refs[ref] = sha
return refs, server_capabilities
def send_pack(self, path, generate_pack_contents):
|
@@ -42,6 +42,9 @@ self.path = path
self._packs = None
+ def determine_wants_all(self, refs):
+ return [sha for (ref, sha) in refs.iteritems() if not sha in self and not ref.endswith("^{}")]
+
def iter_shas(self, shas):
return ObjectStoreIterator(self, shas)
|
Loading...