Patchwork [5,of,7,main-line-of-works,(28,more,patches,to,go)] ] bundle2: add generic debug output regarding generated bundle

login
register
mail settings
Submitter Pierre-Yves David
Date May 28, 2015, 4:53 p.m.
Message ID <5c49e274aa63196c3d8e.1432831996@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/9328/
State Accepted
Headers show

Comments

Pierre-Yves David - May 28, 2015, 4:53 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 5c49e274aa63196c3d8e20b2f28c7b185e10f47b
# Parent  5fef62c3e3e5a2b525fcb721084546931475b1b6
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
@@ -470,10 +470,16 @@  class bundle20(object):
         self.addpart(part)
         return part
 
     # 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()
         outdebug(self.ui, 'bundle parameter: %s' % param)
         yield _pack(_fstreamparamsize, len(param))
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
@@ -335,10 +335,11 @@  Test debug output
 ---------------------------------------------------
 
 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
   bundle2-output: end of bundle
 
@@ -382,10 +383,11 @@  bad parameter name
 
 Test part
 =================
 
   $ 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
   bundle2-output: bundle part: "test:empty"
   bundle2-output: part 0: "test:empty"
@@ -732,10 +734,11 @@  Support for changegroup
   list of changesets:
   32af7686d403cf45b5d95f2d70cebea587ac806a
   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
   bundle2-output: bundle part: "changegroup"
   bundle2-output: part 0: "changegroup"