bundle2: add generic debug output regarding processed part payload
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 26 May 2015 23:58:38 -0700
changeset 25334 76cba1ecf55f
parent 25333 5bfffdbdc907
child 25335 8f7137a85a0e
bundle2: add generic debug output regarding processed part payload If we are about to hide the detailed debug output, we need some generic debug message to replace it in a concise way.
mercurial/bundle2.py
tests/test-bundle2-format.t
--- a/mercurial/bundle2.py	Tue May 26 23:36:31 2015 -0700
+++ b/mercurial/bundle2.py	Tue May 26 23:58:38 2015 -0700
@@ -1060,9 +1060,12 @@
             data = self._payloadstream.read()
         else:
             data = self._payloadstream.read(size)
+        self._pos += len(data)
         if size is None or len(data) < size:
+            if not self.consumed and self._pos:
+                self.ui.debug('bundle2-input-part: total payload size %i\n'
+                              % self._pos)
             self.consumed = True
-        self._pos += len(data)
         return data
 
     def tell(self):
--- a/tests/test-bundle2-format.t	Tue May 26 23:36:31 2015 -0700
+++ b/tests/test-bundle2-format.t	Tue May 26 23:58:38 2015 -0700
@@ -500,6 +500,7 @@
       advisory: 0
   bundle2-input: payload chunk size: 178
   bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 178
       payload: 178 bytes
   bundle2-input: part header size: 22
   bundle2-input: part type: "test:debugreply"
@@ -519,6 +520,7 @@
       advisory: 1
   bundle2-input: payload chunk size: 2
   bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 2
       payload: 2 bytes
   bundle2-input: part header size: 29
   bundle2-input: part type: "test:song"
@@ -575,6 +577,7 @@
   The choir starts singing:
   bundle2-input: payload chunk size: 178
   bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 178
       Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
       Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
       Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
@@ -594,6 +597,7 @@
   bundle2-input-part: "test:math" (advisory) (params: 2 mandatory 2 advisory) unsupported-type
   bundle2-input: payload chunk size: 2
   bundle2-input: payload chunk size: 0
+  bundle2-input-part: total payload size 2
   bundle2-input: part header size: 29
   bundle2-input: part type: "test:song"
   bundle2-input: part id: "5"