sshpeer: use `iter(callable, sentinel)` instead of while True
This is functionally equivalent, but is a little more concise.
--- a/mercurial/sshpeer.py Fri Aug 05 14:00:14 2016 -0400
+++ b/mercurial/sshpeer.py Fri Aug 05 14:00:22 2016 -0400
@@ -292,10 +292,7 @@
r = self._call(cmd, **args)
if r:
return '', r
- while True:
- d = fp.read(4096)
- if not d:
- break
+ for d in iter(lambda: fp.read(4096), ''):
self._send(d)
self._send("", flush=True)
r = self._recv()
@@ -308,10 +305,7 @@
if r:
# XXX needs to be made better
raise error.Abort(_('unexpected remote reply: %s') % r)
- while True:
- d = fp.read(4096)
- if not d:
- break
+ for d in iter(lambda: fp.read(4096), ''):
self._send(d)
self._send("", flush=True)
return self.pipei
@@ -353,10 +347,7 @@
d = self._call("addchangegroup")
if d:
self._abort(error.RepoError(_("push refused: %s") % d))
- while True:
- d = cg.read(4096)
- if not d:
- break
+ for d in iter(lambda: cg.read(4096), ''):
self.pipeo.write(d)
self.readerr()