Submitter | Matt Harbison |
---|---|
Date | March 3, 2018, 5:50 a.m. |
Message ID | <57af2e6a832eabb2e584.1520056246@Envy> |
Download | mbox | patch |
Permalink | /patch/28765/ |
State | Accepted |
Headers | show |
Comments
On Sat, 03 Mar 2018 00:50:46 -0500, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison <matt_harbison@yahoo.com> > # Date 1520055359 18000 > # Sat Mar 03 00:35:59 2018 -0500 > # Node ID 57af2e6a832eabb2e584977a11cc34c97092cfcd > # Parent ed77050177498aff4ff4db94f30d5bdeefd8f76e > profile: colorize output on Windows Queued, thanks. > 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: Added inline comment "parse escape sequence by win32print()" here because it seems unclear why we need this only for Windows. > + class uifp(object): > + def __init__(self, ui): > + self._ui = ui > + def write(self, data): > + self._ui.write_err(data)
Patch
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