# HG changeset patch # User Matt Harbison <matt_harbi...@yahoo.com> # Date 1520055359 18000 # Sat Mar 03 00:35:59 2018 -0500 # Node ID 57af2e6a832eabb2e584977a11cc34c97092cfcd # Parent ed77050177498aff4ff4db94f30d5bdeefd8f76e profile: colorize output on Windows
Previously, the ANSI codes were printed to the screen, throwing off the alignment. We could probably do this unconditionally, but it's kind of a hack, so I figured I'd limit the scope. diff --git a/mercurial/profiling.py b/mercurial/profiling.py --- a/mercurial/profiling.py +++ b/mercurial/profiling.py @@ -14,6 +14,7 @@ encoding, error, extensions, + pycompat, util, ) @@ -200,6 +201,16 @@ elif self._output: path = self._ui.expandpath(self._output) self._fp = open(path, 'wb') + elif pycompat.iswindows: + class uifp(object): + def __init__(self, ui): + self._ui = ui + def write(self, data): + self._ui.write_err(data) + def flush(self): + self._ui.flush() + self._fpdoclose = False + self._fp = uifp(self._ui) else: self._fpdoclose = False self._fp = self._ui.ferr _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel