Details
Details
- Reviewers
Alphare - Group Reviewers
hg-reviewers - Commits
- rHG1ba11c8f3430: chgserver: remove Python 2 branch
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
( )
Alphare |
hg-reviewers |
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/chgserver.py (11 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
265adbf11228 | 7071938fa2a3 | Gregory Szorc | Feb 21 2022, 12:40 PM |
if self._ioattached: | if self._ioattached: | ||||
continue | continue | ||||
# reset buffering mode when client is first attached. as we want | # reset buffering mode when client is first attached. as we want | ||||
# to see output immediately on pager, the mode stays unchanged | # to see output immediately on pager, the mode stays unchanged | ||||
# when client re-attached. ferr is unchanged because it should | # when client re-attached. ferr is unchanged because it should | ||||
# be unbuffered no matter if it is a tty or not. | # be unbuffered no matter if it is a tty or not. | ||||
if fn == b'ferr': | if fn == b'ferr': | ||||
newfp = fp | newfp = fp | ||||
elif pycompat.ispy3: | else: | ||||
# On Python 3, the standard library doesn't offer line-buffered | # On Python 3, the standard library doesn't offer line-buffered | ||||
# binary streams, so wrap/unwrap it. | # binary streams, so wrap/unwrap it. | ||||
if fp.isatty(): | if fp.isatty(): | ||||
newfp = procutil.make_line_buffered(fp) | newfp = procutil.make_line_buffered(fp) | ||||
else: | else: | ||||
newfp = procutil.unwrap_line_buffered(fp) | 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: | if newfp is not fp: | ||||
setattr(ui, fn, newfp) | setattr(ui, fn, newfp) | ||||
setattr(self, cn, newfp) | setattr(self, cn, newfp) | ||||
self._ioattached = True | self._ioattached = True | ||||
self.cresult.write(struct.pack(b'>i', len(clientfds))) | self.cresult.write(struct.pack(b'>i', len(clientfds))) | ||||
def _saveio(self): | def _saveio(self): |