Mercurial > public > mercurial-scm > hg
comparison mercurial/chgserver.py @ 48902:1ba11c8f3430
chgserver: remove Python 2 branch
Differential Revision: https://phab.mercurial-scm.org/D12305
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 21 Feb 2022 10:40:58 -0700 |
parents | 6000f5b25c9b |
children | 0bb28b7736bc |
comparison
equal
deleted
inserted
replaced
48901:cc0e059d2af8 | 48902:1ba11c8f3430 |
---|---|
406 # to see output immediately on pager, the mode stays unchanged | 406 # to see output immediately on pager, the mode stays unchanged |
407 # when client re-attached. ferr is unchanged because it should | 407 # when client re-attached. ferr is unchanged because it should |
408 # be unbuffered no matter if it is a tty or not. | 408 # be unbuffered no matter if it is a tty or not. |
409 if fn == b'ferr': | 409 if fn == b'ferr': |
410 newfp = fp | 410 newfp = fp |
411 elif pycompat.ispy3: | 411 else: |
412 # On Python 3, the standard library doesn't offer line-buffered | 412 # On Python 3, the standard library doesn't offer line-buffered |
413 # binary streams, so wrap/unwrap it. | 413 # binary streams, so wrap/unwrap it. |
414 if fp.isatty(): | 414 if fp.isatty(): |
415 newfp = procutil.make_line_buffered(fp) | 415 newfp = procutil.make_line_buffered(fp) |
416 else: | 416 else: |
417 newfp = procutil.unwrap_line_buffered(fp) | 417 newfp = procutil.unwrap_line_buffered(fp) |
418 else: | |
419 # Python 2 uses the I/O streams provided by the C library, so | |
420 # make it line-buffered explicitly. Otherwise the default would | |
421 # be decided on first write(), where fout could be a pager. | |
422 if fp.isatty(): | |
423 bufsize = 1 # line buffered | |
424 else: | |
425 bufsize = -1 # system default | |
426 newfp = os.fdopen(fp.fileno(), mode, bufsize) | |
427 if newfp is not fp: | 418 if newfp is not fp: |
428 setattr(ui, fn, newfp) | 419 setattr(ui, fn, newfp) |
429 setattr(self, cn, newfp) | 420 setattr(self, cn, newfp) |
430 | 421 |
431 self._ioattached = True | 422 self._ioattached = True |