Bug 2478 - bundlerepo does not clean up temporary bundle files
Summary: bundlerepo does not clean up temporary bundle files
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: urgent bug
Assignee: Klaus Koch
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-07 12:52 UTC by Klaus Koch
Modified: 2010-11-10 09:00 UTC (History)
4 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Klaus Koch 2010-11-07 12:52 UTC
This bug was introduced in rev. 40935b59518b and rev. 6277a9469dff.
Comment 1 Klaus Koch 2010-11-07 13:35 UTC
# HG changeset patch
# User Klaus Koch <kuk42@gmx.net>
# Date 1289157537 -3600
# Branch stable
# Node ID 5c4c15ff045b40809a3a381bdbf23fc5ba8ba4ae
# Parent  ab93029ab622d4c6167fe792fc53dcd73fc86545
bundlerepository: Get rid of temporary bundle files (issue2478).

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -249,11 +249,13 @@
     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
-        if tempfile is not None:
-            os.unlink(tempfile)
+        if self.tempfile is not None:
+            os.unlink(self.tempfile)
         if self._tempparent:
             shutil.rmtree(self._tempparent, True)
 
diff --git a/tests/test-mq-pull-from-bundle.t b/tests/test-mq-pull-from-
bundle.t
--- a/tests/test-mq-pull-from-bundle.t
+++ b/tests/test-mq-pull-from-bundle.t
@@ -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
Comment 2 Matt Mackall 2010-11-07 13:43 UTC
Patches go to mercurial-devel@selenic.com for review (no subscription
necessary), not the BTS. The BTS is ill-suited to reviewing and accepting
patches.
Comment 3 HG Bot 2010-11-10 09:00 UTC
Fixed by http://hg.intevation.org/mercurial/crew/rev/ff083040a555
Klaus Koch <kuk42@gmx.net>
bundlerepository: get rid of temporary bundle files (issue2478)
Comment 4 Bugzilla 2012-05-12 09:14 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:14 EDT  ---

This bug was previously known as _bug_ 2478 at http://mercurial.selenic.com/bts/issue2478