changeset 8072:ecf7795479d5

transaction: support multiple, separate transactions Solves that committed (closed) transactions may linger and be returned on subsequent transaction calls, even though a new transaction should be made, rather than a new nested transaction. This also fixes a race condition with the use of weakref.
author Henrik Stuart <henrik.stuart@edlund.dk>
date Wed, 15 Apr 2009 19:54:22 +0200
parents 9f14b66830a8
children e8a28556a0a8
files mercurial/localrepo.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Apr 16 15:41:25 2009 +0200
+++ b/mercurial/localrepo.py	Wed Apr 15 19:54:22 2009 +0200
@@ -593,8 +593,9 @@
         return self._filter("decode", filename, data)
 
     def transaction(self):
-        if self._transref and self._transref():
-            return self._transref().nest()
+        tr = self._transref and self._transref() or None
+        if tr and tr.running():
+            return tr.nest()
 
         # abort here if the journal already exists
         if os.path.exists(self.sjoin("journal")):