changelog: implement context manager method for 'appender' object
This object mimics a file and was missing the context manager API.
--- a/mercurial/changelog.py Sun Feb 04 00:29:22 2018 +0100
+++ b/mercurial/changelog.py Mon Feb 05 20:36:51 2018 +0100
@@ -127,6 +127,13 @@
self.offset += len(s)
self._end += len(s)
+ def __enter__(self):
+ self.fp.__enter__()
+ return self
+
+ def __exit__(self, *args):
+ return self.fp.__exit__(*args)
+
def _divertopener(opener, target):
"""build an opener that writes in 'target.a' instead of 'target'"""
def _divert(name, mode='r', checkambig=False):