--- a/mercurial/util.py Wed Jul 26 23:33:26 2017 -0400
+++ b/mercurial/util.py Mon Jul 24 14:38:40 2017 -0400
@@ -172,6 +172,18 @@
def safehasattr(thing, attr):
return getattr(thing, attr, _notset) is not _notset
+def bytesinput(fin, fout, *args, **kwargs):
+ sin, sout = sys.stdin, sys.stdout
+ try:
+ if pycompat.ispy3:
+ sys.stdin, sys.stdout = encoding.strio(fin), encoding.strio(fout)
+ return encoding.strtolocal(input(*args, **kwargs))
+ else:
+ sys.stdin, sys.stdout = fin, fout
+ return raw_input(*args, **kwargs)
+ finally:
+ sys.stdin, sys.stdout = sin, sout
+
def bitsfrom(container):
bits = 0
for bit in container: