[PATCH 1 of 4] sshpeer: rename 'size' to 'data' in doublepipe

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


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1432161647 18000
#      Wed May 20 17:40:47 2015 -0500
# Node ID f3b870f69c3a131e6bf4f54fb58dcb4ac91b290e
# Parent  51e7acc34b0ab0e540dffdb22127914f2353d5e2
sshpeer: rename 'size' to 'data' in doublepipe

We are about to add 'write' support, the argument will be either an int or a
string.

diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -79,26 +79,27 @@ class doublepipe(object):
         return self._call('read', size)
 
     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:
             mainready, sideready = self._wait()
             if sideready:
                 _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()
 
 class sshpeer(wireproto.wirepeer):


More information about the Mercurial-devel mailing list