mercurial/commands.py
changeset 1969 6d17d420c46c
parent 1966 f8b0e73e320f
child 1970 119165543ce6
--- a/mercurial/commands.py	Fri Mar 17 09:49:28 2006 -0800
+++ b/mercurial/commands.py	Fri Mar 17 18:53:04 2006 +0100
@@ -297,8 +297,10 @@
             fh.write(z.compress(chunk))
         fh.write(z.flush())
     except:
+        fh.close()
         os.unlink(filename)
         raise
+    fh.close()
 
 def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always,
            changes=None, text=False, opts={}):
@@ -1790,7 +1792,6 @@
 
         cg = other.changegroup(incoming, "incoming")
         write_bundle(cg, fname, compress=other.local(), fh=f)
-        f.close()
         if not other.local():
             # use a bundlerepo
             other = bundlerepo.bundlerepository(ui, repo.root, fname)