mercurial/transaction.py
changeset 33793 bbbbd3c30bfc
parent 33279 7912404b70f2
child 35832 aad39713ef35
--- a/mercurial/transaction.py	Mon Aug 14 16:26:36 2017 -0700
+++ b/mercurial/transaction.py	Fri Jul 28 22:42:10 2017 -0700
@@ -101,7 +101,7 @@
         # only pure backup file remains, it is sage to ignore any error
         pass
 
-class transaction(object):
+class transaction(util.transactional):
     def __init__(self, report, opener, vfsmap, journalname, undoname=None,
                  after=None, createmode=None, validator=None, releasefn=None,
                  checkambigfiles=None):
@@ -376,16 +376,6 @@
         if self.count > 0 and self.usages == 0:
             self._abort()
 
-    def __enter__(self):
-        return self
-
-    def __exit__(self, exc_type, exc_val, exc_tb):
-        try:
-            if exc_type is None:
-                self.close()
-        finally:
-            self.release()
-
     def running(self):
         return self.count > 0