diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1278,7 +1278,13 @@ class ui(object): # prompt ' ' must exist; otherwise readline may delete entire line # - http://bugs.python.org/issue12833 with self.timeblockedsection('stdio'): - line = util.bytesinput(self.fin, self.fout, r' ') + sin, sout = sys.stdin, sys.stdout + try: + sys.stdin = encoding.strio(self.fin) + sys.stdout = encoding.strio(self.fout) + line = encoding.strtolocal(pycompat.rawinput(r' ')) + finally: + sys.stdin, sys.stdout = sin, sout # When stdin is in binary mode on Windows, it can cause # raw_input() to emit an extra trailing carriage return diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -212,14 +212,6 @@ def rapply(f, xs): return xs return _rapply(f, xs) -def bytesinput(fin, fout, *args, **kwargs): - sin, sout = sys.stdin, sys.stdout - try: - sys.stdin, sys.stdout = encoding.strio(fin), encoding.strio(fout) - return encoding.strtolocal(pycompat.rawinput(*args, **kwargs)) - finally: - sys.stdin, sys.stdout = sin, sout - def bitsfrom(container): bits = 0 for bit in container: