diff mercurial/bundle2.py @ 25323:21a25fb81d2c

bundle2: add generic debug output regarding generated parts 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 Wed, 27 May 2015 00:19:16 -0700
parents 1f7c0403f8be
children deed9c6b12d2
line wrap: on
line diff
--- a/mercurial/bundle2.py	Wed May 27 00:10:30 2015 -0700
+++ b/mercurial/bundle2.py	Wed May 27 00:19:16 2015 -0700
@@ -736,6 +736,29 @@
         if self._generated is not None:
             raise RuntimeError('part can only be consumed once')
         self._generated = False
+
+        if ui.debugflag:
+            msg = ['bundle2-output-part: "%s"' % self.type]
+            if not self.mandatory:
+                msg.append(' (advisory)')
+            nbmp = len(self.mandatoryparams)
+            nbap = len(self.advisoryparams)
+            if nbmp or nbap:
+                msg.append(' (params:')
+                if nbmp:
+                    msg.append(' %i mandatory' % nbmp)
+                if nbap:
+                    msg.append(' %i advisory' % nbmp)
+                msg.append(')')
+            if not self.data:
+                msg.append(' empty payload')
+            elif util.safehasattr(self.data, 'next'):
+                msg.append(' streamed payload')
+            else:
+                msg.append(' %i bytes payload' % len(self.data))
+            msg.append('\n')
+            ui.debug(''.join(msg))
+
         #### header
         if self.mandatory:
             parttype = self.type.upper()