--- a/mercurial/dirstateguard.py Mon Aug 14 16:26:36 2017 -0700
+++ b/mercurial/dirstateguard.py Fri Jul 28 22:42:10 2017 -0700
@@ -11,9 +11,10 @@
from . import (
error,
+ util,
)
-class dirstateguard(object):
+class dirstateguard(util.transactional):
'''Restore dirstate at unexpected failure.
At the construction, this class does:
@@ -43,16 +44,6 @@
# ``release(tr, ....)``.
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 close(self):
if not self._active: # already inactivated
msg = (_("can't close already inactivated backup: %s")