From: Jelmer Vernooij Date: Mon, 4 May 2009 16:56:43 +0000 (+0002) Subject: Use dictionary in send_pack. X-Git-Tag: dulwich-0.3.0~51 X-Git-Url: http://git.samba.org/samba.git/?p=jelmer%2Fdulwich-libgit2.git;a=commitdiff_plain;h=eb80daad15dbcf35578d1ea66da4b600a4b5900a Use dictionary in send_pack. --- diff --git a/dulwich/client.py b/dulwich/client.py index 913d455..eff18b3 100644 --- a/dulwich/client.py +++ b/dulwich/client.py @@ -119,15 +119,17 @@ class GitClient(object): want = [] have = [] sent_capabilities = False - for changed_ref in changed_refs: + for changed_ref, (old_sha1, new_sha1) in changed_refs.iteritems(): + if old_sha1 is None: + old_sha1 = "0" * 40 if sent_capabilities: - self.proto.write_pkt_line("%s %s %s" % changed_ref) + self.proto.write_pkt_line("%s %s %s" % (old_sha1, new_sha1, changed_ref)) else: - self.proto.write_pkt_line("%s %s %s\0%s" % (changed_ref[0], changed_ref[1], changed_ref[2], self.capabilities())) + self.proto.write_pkt_line("%s %s %s\0%s" % (old_sha1, new_sha1, changed_ref, self.capabilities())) sent_capabilities = True - want.append(changed_ref[1]) - if changed_ref[0] != "0"*40: - have.append(changed_ref[0]) + want.append(new_sha1) + if old_sha1 != "0"*40: + have.append(old_sha1) self.proto.write_pkt_line(None) shas = generate_pack_contents(want, have)