util: log readinto() I/O
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 03 Mar 2018 09:34:06 -0500
changeset 36630 29128309c52d
parent 36629 c98d1c6763a6
child 36631 8395fddde46c
util: log readinto() I/O Differential Revision: https://phab.mercurial-scm.org/D2583
mercurial/util.py
--- a/mercurial/util.py	Fri Mar 02 22:47:18 2018 -0500
+++ b/mercurial/util.py	Sat Mar 03 09:34:06 2018 -0500
@@ -749,6 +749,15 @@
         self.fh.write('%s> readline() -> %d' % (self.name, len(res)))
         self._writedata(res)
 
+    def readinto(self, res, dest):
+        if not self.reads:
+            return
+
+        self.fh.write('%s> readinto(%d) -> %r' % (self.name, len(dest),
+                                                  res))
+        data = dest[0:res] if res is not None else b''
+        self._writedata(data)
+
     def write(self, res, data):
         if not self.writes:
             return