--- a/mercurial/wireproto.py Wed Feb 07 20:17:05 2018 -0800
+++ b/mercurial/wireproto.py Wed Feb 07 20:17:47 2018 -0800
@@ -978,20 +978,12 @@
else:
new = encoding.tolocal(new) # normal path
- if util.safehasattr(proto, 'restore'):
-
- proto.redirect()
-
+ with proto.mayberedirectstdio() as output:
r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key),
encoding.tolocal(old), new) or False
- output = proto.restore()
-
- return '%s\n%s' % (int(r), output)
-
- r = repo.pushkey(encoding.tolocal(namespace), encoding.tolocal(key),
- encoding.tolocal(old), new)
- return '%s\n' % int(r)
+ output = output.getvalue() if output else ''
+ return '%s\n%s' % (int(r), output)
@wireprotocommand('stream_out')
def stream(repo, proto):