bundlerepository: get rid of temporary bundle files (issue2478) stable
authorKlaus Koch <kuk42@gmx.net>
Sun, 07 Nov 2010 20:18:57 +0100
branchstable
changeset 12962 ff083040a555
parent 12961 ad63e5f834e1
child 12963 e80128e40c04
child 12965 0d4fb319974b
bundlerepository: get rid of temporary bundle files (issue2478) This bug was introduced in 40935b59518b and 6277a9469dff.
mercurial/bundlerepo.py
tests/test-mq-pull-from-bundle.t
--- a/mercurial/bundlerepo.py	Wed Nov 10 15:38:00 2010 +0100
+++ b/mercurial/bundlerepo.py	Sun Nov 07 20:18:57 2010 +0100
@@ -249,6 +249,8 @@
     def close(self):
         """Close assigned bundle file immediately."""
         self.bundle.close()
+        if self.tempfile is not None:
+            os.unlink(self.tempfile)
 
     def __del__(self):
         del self.bundle
--- a/tests/test-mq-pull-from-bundle.t	Wed Nov 10 15:38:00 2010 +0100
+++ b/tests/test-mq-pull-from-bundle.t	Sun Nov 07 20:18:57 2010 +0100
@@ -33,6 +33,7 @@
   comparing with main.hg
   0: main: one added
   1: main: one updated
+  $ test -f ./fresh/.hg/hg-bundle* && echo 'temp. bundle file remained' || true
 
   $ hg -R fresh tincoming bundle:fresh+main.hg
   comparing with bundle:fresh+main.hg
@@ -58,6 +59,7 @@
 
   $ hg -R .hg/patches bundle --base=null ../queue.hgq
   1 changesets found
+  $ test -f ./fresh/.hg/hg-bundle* && echo 'temp. bundle file remained' || true
 
   $ cd ..
 
@@ -75,6 +77,7 @@
   $ hg -R .hg/patches tincoming ../queue.hgq
   comparing with ../queue.hgq
   0: queue: two.patch added
+  $ test -f .hg/hg-bundle* && echo 'temp. bundle file remained' || true
 
 Pull queue bundle:
 
@@ -87,6 +90,7 @@
   added 1 changesets with 3 changes to 3 files
   merging series
   2 files updated, 1 files merged, 0 files removed, 0 files unresolved
+  $ test -f .hg/patches/hg-bundle* && echo 'temp. bundle file remained' || true
 
   $ hg -R .hg/patches theads
   0: queue: two.patch added