[PATCH 3 of 4] sshpeer: allow doublepipe on unbuffered main pipe

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Jun 5 13:19:15 CDT 2015

# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1433505263 25200
#      Fri Jun 05 04:54:23 2015 -0700
# Node ID 326294c728893275d7f40e3179f45ac0c1a888df
# Parent  b47406fc7d16c72606a95712a8e84c47848874ac
sshpeer: allow doublepipe on unbuffered main pipe

The output pipe does not have manually managed read buffer (actually, no read
anything). To also use the doublepipe for outgoing write (useful to consume
remote output when pushing large set of data) we need the doublepipe to work on
standard pipe too.

diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -63,11 +63,11 @@ class doublepipe(object):
         return a pair of boolean (ismainready, issideready)
         (This will only wait for data if the setup is supported by `util.poll`)
-        if self._main.hasbuffer:
+        if getattr(self._main, 'hasbuffer', False): # getattr for classic pipe
             return (True, True) # main has data, assume side is worth poking at.
         fds = [self._main.fileno(), self._side.fileno()]
             act = util.poll(fds)
         except NotImplementedError:

More information about the Mercurial-devel mailing list