D12305: chgserver: remove Python 2 branch
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Wed Mar 2 23:31:43 UTC 2022
indygreg created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D12305
AFFECTED FILES
mercurial/chgserver.py
CHANGE DETAILS
diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -408,22 +408,13 @@
# be unbuffered no matter if it is a tty or not.
if fn == b'ferr':
newfp = fp
- elif pycompat.ispy3:
+ else:
# On Python 3, the standard library doesn't offer line-buffered
# binary streams, so wrap/unwrap it.
if fp.isatty():
newfp = procutil.make_line_buffered(fp)
else:
newfp = procutil.unwrap_line_buffered(fp)
- else:
- # Python 2 uses the I/O streams provided by the C library, so
- # make it line-buffered explicitly. Otherwise the default would
- # be decided on first write(), where fout could be a pager.
- if fp.isatty():
- bufsize = 1 # line buffered
- else:
- bufsize = -1 # system default
- newfp = os.fdopen(fp.fileno(), mode, bufsize)
if newfp is not fp:
setattr(ui, fn, newfp)
setattr(self, cn, newfp)
To: indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list