changeset 36630:29128309c52d

util: log readinto() I/O Differential Revision: https://phab.mercurial-scm.org/D2583
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 03 Mar 2018 09:34:06 -0500
parents c98d1c6763a6
children 8395fddde46c
files mercurial/util.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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