mercurial/transaction.py
changeset 1806 a2c69737e65e
parent 1559 59b3639df0a9
child 2084 d66278012853
--- a/mercurial/transaction.py	Tue Feb 28 11:49:35 2006 -0600
+++ b/mercurial/transaction.py	Tue Feb 28 12:24:54 2006 -0600
@@ -22,6 +22,7 @@
         if os.path.exists(journal):
             raise AssertionError(_("journal already exists - run hg recover"))
 
+        self.count = 1
         self.report = report
         self.opener = opener
         self.after = after
@@ -46,7 +47,17 @@
         self.file.write("%s\0%d\n" % (file, offset))
         self.file.flush()
 
+    def nest(self):
+        self.count += 1
+        return self
+
+    def running(self):
+        return self.count > 0
+
     def close(self):
+        self.count -= 1
+        if self.count != 0:
+            return
         self.file.close()
         self.entries = []
         if self.after: