Mercurial > hg
diff tests/test-bundle2-format.t @ 45055:4c1b4805db57
pycompat: change users of pycompat.{stdin,stdout,stderr} to use procutil.std*
On Python 3, pycompat.{stdin,stdout,stderr} are usually block-buffered even if
connected to a TTY. procutil.{stdin,stdout,stderr} provide consistent behavior
across platforms and Python versions.
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Mon, 06 Jul 2020 17:44:25 +0200 |
parents | bad37041fc1e |
children | a736ab681b78 |
line wrap: on
line diff
--- a/tests/test-bundle2-format.t Mon Jul 06 10:30:55 2020 +0200 +++ b/tests/test-bundle2-format.t Mon Jul 06 17:44:25 2020 +0200 @@ -22,8 +22,8 @@ > from mercurial import changegroup > from mercurial import error > from mercurial import obsolete - > from mercurial import pycompat > from mercurial import registrar + > from mercurial.utils import procutil > > > try: @@ -148,7 +148,7 @@ > bundler.newpart(b'output', data=genraise(), mandatory=False) > > if path is None: - > file = pycompat.stdout + > file = procutil.stdout > else: > file = open(path, 'wb') > @@ -181,7 +181,7 @@ > lock = repo.lock() > tr = repo.transaction(b'processbundle') > try: - > unbundler = bundle2.getunbundler(ui, pycompat.stdin) + > unbundler = bundle2.getunbundler(ui, procutil.stdin) > op = bundle2.processbundle(repo, unbundler, lambda: tr) > tr.close() > except error.BundleValueError as exc: @@ -192,7 +192,7 @@ > if tr is not None: > tr.release() > lock.release() - > remains = pycompat.stdin.read() + > remains = procutil.stdin.read() > ui.write(b'%i unread bytes\n' % len(remains)) > if op.records[b'song']: > totalverses = sum(r[b'verses'] for r in op.records[b'song']) @@ -207,7 +207,7 @@ > @command(b'statbundle2', [], b'') > def cmdstatbundle2(ui, repo): > """print statistic on the bundle2 container read from stdin""" - > unbundler = bundle2.getunbundler(ui, pycompat.stdin) + > unbundler = bundle2.getunbundler(ui, procutil.stdin) > try: > params = unbundler.params > except error.BundleValueError as exc: