mharbison72 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches.
REVISION SUMMARY With Windows and py3, all output that got directed to the pager was lost. It can be worked around by the user piping to `more`, but that's easy to forget, and can be dangerous if `hg diff` or similar incorrectly shows no changes. The problem appears to be the new WindowsConsoleIO in py3.6[1]. We've worked around it with PyOxidizer by setting the `Py_LegacyWindowsStdioFlag` interpreter option, and worked around it with `hg.bat` and `exewrapper.c` by internally setting `PYTHONLEGACYWINDOWSSTDIO=1`. Unfortunately, py2exe doesn't appear to be able to set the interpreter option, and somehow seems to also ignore the environment variable. The latter isn't a good fix anyway, since setting it in the environment would affect other python programs too. We can't install a global config for this because a config closer to the user (e.g. from before pager was turned on by default) can override it. [1] https://peps.python.org/pep-0528/ REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D12556 AFFECTED FILES mercurial/ui.py CHANGE DETAILS diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1432,6 +1432,14 @@ # HGPLAINEXCEPT=pager, and the user didn't specify --debug. return + # py2exe doesn't appear to be able to use legacy I/O, and nothing is + # output to the pager for paged commands. Piping to `more` in cmd.exe + # works, but is easy to forget. Just disable pager for py2exe, but + # leave it working for pyoxidizer and exewrapper builds. + if pycompat.iswindows and getattr(sys, "frozen", None) == "console_exe": + self.debug(b"pager is unavailable with py2exe packaging\n") + return + pagercmd = self.config(b'pager', b'pager', rcutil.fallbackpager) if not pagercmd: return To: mharbison72, #hg-reviewers Cc: mercurial-patches, mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel