Patchwork [6,of,8] bundle2: add generic debug output regarding generated bundle

login
register
mail settings
Submitter Pierre-Yves David
Date May 29, 2015, 9:21 p.m.
Message ID <1f7c0403f8be6b4b0a3c.1432934519@waste.org>
Download mbox | patch
Permalink /patch/9393/
State Accepted
Headers show

Comments

Pierre-Yves David - May 29, 2015, 9:21 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1432710630 25200
#      Wed May 27 00:10:30 2015 -0700
# Node ID 1f7c0403f8be6b4b0a3c315853559580cc5e612d
# Parent  b44ee346211fad97f4f2497b705dc9fda6cfd092
bundle2: add generic debug output regarding generated bundle

If we are about to hide the detailed debug output, we need some generic debug
message to replace it in a more compact way.

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -472,6 +472,12 @@ 
 
     # methods used to generate the bundle2 stream
     def getchunks(self):
+        if self.ui.debugflag:
+            msg = ['bundle2-output-bundle: "%s",' % self._magicstring]
+            if self._params:
+                msg.append(' (%i params)' % len(self._params))
+            msg.append(' %i parts total\n' % len(self._parts))
+            self.ui.debug(''.join(msg))
         outdebug(self.ui, 'start emission of %s stream' % self._magicstring)
         yield self._magicstring
         param = self._paramchunk()
diff --git a/tests/test-bundle2-format.t b/tests/test-bundle2-format.t
--- a/tests/test-bundle2-format.t
+++ b/tests/test-bundle2-format.t
@@ -337,6 +337,7 @@ 
 bundling debug
 
   $ hg bundle2 --debug --param 'e|! 7/=babar%#==tutu' --param simple ../out.hg2 --config progress.debug=true
+  bundle2-output-bundle: "HG20", (2 params) 0 parts total
   bundle2-output: start emission of HG20 stream
   bundle2-output: bundle parameter: e%7C%21%207/=babar%25%23%3D%3Dtutu simple
   bundle2-output: start of parts
@@ -384,6 +385,7 @@ 
 =================
 
   $ hg bundle2 --parts ../parts.hg2 --debug --config progress.debug=true
+  bundle2-output-bundle: "HG20", 7 parts total
   bundle2-output: start emission of HG20 stream
   bundle2-output: bundle parameter: 
   bundle2-output: start of parts
@@ -734,6 +736,7 @@ 
   9520eea781bcca16c1e15acc0ba14335a0e8e5ba
   eea13746799a9e0bfd88f29d3c2e9dc9389f524f
   02de42196ebee42ef284b6780a87cdc96e8eaab6
+  bundle2-output-bundle: "HG20", 1 parts total
   bundle2-output: start emission of HG20 stream
   bundle2-output: bundle parameter: 
   bundle2-output: start of parts