reapplying defunkts changes

This commit is contained in:
Scott Chacon 2009-05-01 20:16:07 -07:00
parent 5679e51481
commit 1afd2ff363

View File

@ -360,14 +360,16 @@ class GitHandler(object):
def generate_pack_contents(self, want, have):
graph_walker = SimpleFetchGraphWalker(want, self.git.get_parents)
next = graph_walker.next()
shas = []
shas = set()
while next:
if next in have:
graph_walker.ack(next)
else:
shas.append(next)
shas.add(next)
next = graph_walker.next()
seen = []
# so now i have the shas, need to turn them into a list of
# tuples (sha, path) for ALL the objects i'm sending
# TODO : don't send blobs or trees they already have
@ -377,11 +379,15 @@ class GitHandler(object):
for (mode, name, sha) in tree.entries():
if mode == 57344: # TODO : properly handle submodules
continue
if sha in seen:
continue
obj = self.git.get_object(sha)
seen.append(sha)
if isinstance (obj, Blob):
changes.append((obj, path + name))
elif isinstance(obj, Tree):
changes.extend (get_objects (obj, path + name + '/'))
changes.extend(get_objects(obj, path + name + '/'))
return changes
objects = []