# HG changeset patch # User Matt Harbison <matt_harbi...@yahoo.com> # Date 1491961091 14400 # Tue Apr 11 21:38:11 2017 -0400 # Node ID ef3aa25da8e5b3137b917e9a1756df7a7eac5c3a # Parent 7b6f5632f09d85b96b2f986961576eb165d44cbf windows: add context manager support to mixedfilemodewrapper
I stumbled into this in the next patch. The difference between getting a context manager capable object or not from vfs classes was as subtle as adding a '+' to the file mode. diff --git a/mercurial/windows.py b/mercurial/windows.py --- a/mercurial/windows.py +++ b/mercurial/windows.py @@ -64,6 +64,12 @@ object.__setattr__(self, r'_fp', fp) object.__setattr__(self, r'_lastop', 0) + def __enter__(self): + return self._fp.__enter__() + + def __exit__(self, exc_type, exc_val, exc_tb): + self._fp.__exit__(exc_type, exc_val, exc_tb) + def __getattr__(self, name): return getattr(self._fp, name) _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel