changeset 27862 | b2145c195f24 |
parent 27662 | f7ab50c721ac |
child 27924 | 24361fb68cba |
--- a/mercurial/transaction.py Fri Jan 15 13:14:49 2016 -0800 +++ b/mercurial/transaction.py Fri Jan 15 13:14:47 2016 -0800 @@ -333,6 +333,14 @@ if self.count > 0 and self.usages == 0: self._abort() + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + if exc_type is None: + self.close() + self.release() + def running(self): return self.count > 0