mercurial/wireproto.py
changeset 17567 2ee7281e5aaa
parent 17558 380a89413403
child 17603 a7fa5bd1c914
--- a/mercurial/wireproto.py	Sat Sep 15 00:06:08 2012 +0400
+++ b/mercurial/wireproto.py	Sat Sep 15 08:38:02 2012 +0200
@@ -558,7 +558,12 @@
                 # partially encode name over the wire for backwards compat
                 yield '%s\0%d\n' % (store.encodedir(name), size)
                 if size <= 65536:
-                    yield sopener(name).read(size)
+                    fp = sopener(name)
+                    try:
+                        data = fp.read(size)
+                    finally:
+                        fp.close()
+                    yield data
                 else:
                     for chunk in util.filechunkiter(sopener(name), limit=size):
                         yield chunk