From 75f1dd79b6c01f11a1a00b3c53c69c614eb827f8 Mon Sep 17 00:00:00 2001 From: John Carr Date: Thu, 25 Dec 2008 13:12:00 +0000 Subject: [PATCH] write_pack_data expects a file object, not a callback. Add a ProtocolFile object to satisfy its desires for now. --- dulwich/protocol.py | 16 ++++++++++++++++ dulwich/server.py | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/dulwich/protocol.py b/dulwich/protocol.py index e467bc9..f37b56c 100644 --- a/dulwich/protocol.py +++ b/dulwich/protocol.py @@ -19,6 +19,22 @@ TCP_GIT_PORT = 9418 +class ProtocolFile(object): + """ + Some network ops are like file ops. The file ops expect to operate on + file objects, so provide them with a dummy file. + """ + + def __init__(self, read, write): + self.read = read + self.write = write + + def tell(self): + pass + + def close(self): + pass + class Protocol(object): def __init__(self, read, write): diff --git a/dulwich/server.py b/dulwich/server.py index fd9e557..42b00ee 100644 --- a/dulwich/server.py +++ b/dulwich/server.py @@ -17,7 +17,7 @@ # MA 02110-1301, USA. import SocketServer -from dulwich.protocol import Protocol, TCP_GIT_PORT, extract_capabilities +from dulwich.protocol import Protocol, ProtocolFile, TCP_GIT_PORT, extract_capabilities from dulwich.repo import Repo from dulwich.pack import PackData, Pack, write_pack_data import os, sha, tempfile @@ -140,7 +140,7 @@ class GitBackend(Backend): progress("counting objects: %d, done.\n" % len(sha_queue)) - write_pack_data(write, (self.repo.get_object(sha).as_raw_string() for sha in sha_queue)) + write_pack_data(ProtocolFile(None, write), (self.repo.get_object(sha).as_raw_string() for sha in sha_queue), len(sha_queue)) progress("how was that, then?\n") -- 2.34.1