Skip to content

Commit

Permalink
Provide abort() when working in thin client mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
jelmer committed Jan 4, 2016
1 parent b0f5fbd commit 4cc972c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions dulwich/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,17 @@ def fetch(self, path, target, determine_wants=None, progress=None):
if determine_wants is None:
determine_wants = target.object_store.determine_wants_all
if CAPABILITY_THIN_PACK in self._fetch_capabilities:
# TODO(jelmer): Avoid reading entire file into memory and
# only processing it after the whole file has been fetched.
f = BytesIO()
def commit():
if f.tell():
f.seek(0)
target.object_store.add_thin_pack(f.read, None)
# TODO(jelmer): Avoid reading entire file into memory and
# only processing it after the whole file has been fetched.
f = BytesIO()
def commit():
if f.tell():
f.seek(0)
target.object_store.add_thin_pack(f.read, None)
def abort():
pass
else:
f, commit, abort = target.object_store.add_pack()
f, commit, abort = target.object_store.add_pack()
try:
result = self.fetch_pack(
path, determine_wants, target.get_graph_walker(), f.write,
Expand Down

0 comments on commit 4cc972c

Please sign in to comment.