dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00369
Re: [PATCH 4/6] object_store.DiskObjectStore.move_in_thin_pack: close temp pack
On Mon, 2010-12-20 at 22:53 +0800, Tay Ray Chuan wrote:
> ---
> dulwich/object_store.py | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/dulwich/object_store.py b/dulwich/object_store.py
> index 9c40b5d..ef81db4 100644
> --- a/dulwich/object_store.py
> +++ b/dulwich/object_store.py
> @@ -406,6 +406,10 @@ class DiskObjectStore(PackBasedObjectStore):
> temppath = os.path.join(self.pack_dir,
> sha_to_hex(urllib2.randombytes(20))+".temppack")
> write_pack(temppath, ((o, None) for o in p.iterobjects()), len(p))
> +
> + # done with temp pack
> + p.close()
> +
> pack_sha = load_pack_index(temppath+".idx").objects_sha1()
> newbasename = os.path.join(self.pack_dir, "pack-%s" % pack_sha)
> os.rename(temppath+".pack", newbasename+".pack")
Can you perhaps use a try/finally around this?
Same goes for the close() calls in test_pack.TestPack.test_copy,
although since those are in a test they're less important.
Cheers,
Jelmer
Attachment:
signature.asc
Description: This is a digitally signed message part
References