changeset 25334:76cba1ecf55f

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 26 May 2015 23:58:38 -0700
parents 5bfffdbdc907
children 8f7137a85a0e
files mercurial/bundle2.py tests/test-bundle2-format.t
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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"