mercurial/formatter.py
changeset 29886 307b20e5e505
parent 29848 5b886289a1ca
child 29953 e7cacb45c4be
--- a/mercurial/formatter.py	Fri Aug 26 21:06:31 2016 +0200
+++ b/mercurial/formatter.py	Mon Aug 29 00:00:05 2016 +0900
@@ -52,6 +52,11 @@
         self._item = None
         # function to convert node to string suitable for this output
         self.hexfunc = hex
+    def __enter__(self):
+        return self
+    def __exit__(self, exctype, excvalue, traceback):
+        if exctype is None:
+            self.end()
     def __nonzero__(self):
         '''return False if we're not doing real templating so we can
         skip extra work'''