changeset 25455:dc02a284e034

sshpeer: rename 'size' to 'data' in doublepipe We are about to add 'write' support, the argument will be either an int or a string.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 20 May 2015 17:40:47 -0500
parents b5a8bc09b0db
children 408b7979bf03
files mercurial/sshpeer.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/sshpeer.py	Fri Jun 05 14:34:58 2015 -0400
+++ b/mercurial/sshpeer.py	Wed May 20 17:40:47 2015 -0500
@@ -81,10 +81,11 @@
     def readline(self):
         return self._call('readline')
 
-    def _call(self, methname, size=None):
+    def _call(self, methname, data=None):
         """call <methname> on "main", forward output of "side" while blocking
         """
-        if size == 0 or self._main.closed:
+        # data can be '' or 0
+        if (data is not None and not data) or self._main.closed:
             _forwardoutput(self._ui, self._side)
             return ''
         while True:
@@ -93,10 +94,10 @@
                 _forwardoutput(self._ui, self._side)
             if mainready:
                 meth = getattr(self._main, methname)
-                if size is None:
+                if data is None:
                     return meth()
                 else:
-                    return meth(size)
+                    return meth(data)
 
     def close(self):
         return self._main.close()