Mercurial > public > mercurial-scm > hg-stable
diff mercurial/wireproto.py @ 30482:39d13b8c101d
py3: bulk replace sys.stdin/out/err by util's
Almost all sys.stdin/out/err in hgext/ and mercurial/ are replaced by util's.
There are a few exceptions:
- lsprof.py and statprof.py are untouched since they are a kind of vendor
code and they never import mercurial modules right now.
- ui._readline() needs to replace sys.stdin and stdout to pass them to
raw_input(). We'll need another workaround here.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 20 Oct 2016 23:53:36 +0900 |
parents | 2add671bf55b |
children | e118233172fe |
line wrap: on
line diff
--- a/mercurial/wireproto.py Thu Oct 20 23:40:24 2016 +0900 +++ b/mercurial/wireproto.py Thu Oct 20 23:53:36 2016 +0900 @@ -10,7 +10,6 @@ import hashlib import itertools import os -import sys import tempfile from .i18n import _ @@ -575,8 +574,8 @@ opts[k] = others[k] del others[k] if others: - sys.stderr.write("warning: %s ignored unexpected arguments %s\n" - % (cmd, ",".join(others))) + util.stderr.write("warning: %s ignored unexpected arguments %s\n" + % (cmd, ",".join(others))) return opts def bundle1allowed(repo, action): @@ -907,11 +906,11 @@ try: raise except error.Abort: - # The old code we moved used sys.stderr directly. + # The old code we moved used util.stderr directly. # We did not change it to minimise code change. # This need to be moved to something proper. # Feel free to do it. - sys.stderr.write("abort: %s\n" % exc) + util.stderr.write("abort: %s\n" % exc) return pushres(0) except error.PushRaced: return pusherr(str(exc))