# HG changeset patch # User Boris Feld <boris.f...@octobus.net> # Date 1517859411 -3600 # Mon Feb 05 20:36:51 2018 +0100 # Node ID cc2e588940df0435bf0e3013ebd45013a22fa8fe # Parent 1a31111e6239a2eb841a5dce5e1cf8212c54bf33 # EXP-Topic revlog-fp # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r cc2e588940df changelog: implement context manager method for 'appender' object
This object mimics a file and was missing the context manager API. diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -127,6 +127,13 @@ class appender(object): 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): _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel