[PATCH 6 of 6 main-line-of-works (22 more patches to go)]] bundle2: hide bundle2 stream debug under a config flag

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu May 28 14:54:23 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1432706777 25200
#      Tue May 26 23:06:17 2015 -0700
# Node ID f5088cab7b299553177fa0c2ad36b6abbb566b8e
# Parent  a6c2d25003affc2378de4ab866e1b72d345a486b
bundle2: hide bundle2 stream debug under a config flag

The old output is very verbose and unsuitable for general debug level. It is
however very useful for debugging bundle2 generation or consumption issues. All
this verbose ouput is hidden under a 'devel.bundle2.debug' flag.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -173,15 +173,17 @@ preferedchunksize = 4096
 
 _parttypeforbidden = re.compile('[^a-zA-Z0-9_:-]')
 
 def outdebug(ui, message):
     """debug regarding output stream (bundling)"""
-    ui.debug('bundle2-output: %s\n' % message)
+    if ui.configbool('devel', 'bundle2.debug', False):
+        ui.debug('bundle2-output: %s\n' % message)
 
 def indebug(ui, message):
     """debug on input stream (unbundling)"""
-    ui.debug('bundle2-input: %s\n' % message)
+    if ui.configbool('devel', 'bundle2.debug', False):
+        ui.debug('bundle2-input: %s\n' % message)
 
 def validateparttype(parttype):
     """raise ValueError if a parttype contains invalid character"""
     if _parttypeforbidden.search(parttype):
         raise ValueError(parttype)
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
@@ -334,11 +334,11 @@ Test unknown mandatory option
 Test debug output
 ---------------------------------------------------
 
 bundling debug
 
-  $ hg bundle2 --debug --param 'e|! 7/=babar%#==tutu' --param simple ../out.hg2 --config progress.debug=true
+  $ hg bundle2 --debug --param 'e|! 7/=babar%#==tutu' --param simple ../out.hg2 --config progress.debug=true --config devel.bundle2.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
@@ -348,11 +348,11 @@ file content is ok
   $ cat ../out.hg2
   HG20\x00\x00\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00\x00\x00 (no-eol) (esc)
 
 unbundling debug
 
-  $ hg statbundle2 --debug --config progress.debug=true < ../out.hg2
+  $ hg statbundle2 --debug --config progress.debug=true --config devel.bundle2.debug=true < ../out.hg2
   bundle2-input: start processing of HG20 stream
   bundle2-input: reading bundle2 stream parameters
   bundle2-input: ignoring unknown parameter 'e|! 7/'
   bundle2-input: ignoring unknown parameter 'simple'
   options count: 2
@@ -382,11 +382,11 @@ bad parameter name
 
 
 Test part
 =================
 
-  $ hg bundle2 --parts ../parts.hg2 --debug --config progress.debug=true
+  $ hg bundle2 --parts ../parts.hg2 --debug --config progress.debug=true --config devel.bundle2.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"
@@ -466,11 +466,11 @@ Test part
       mandatory: 0
       advisory: 0
       payload: 0 bytes
   parts count:   7
 
-  $ hg statbundle2 --debug --config progress.debug=true < ../parts.hg2
+  $ hg statbundle2 --debug --config progress.debug=true --config devel.bundle2.debug=true < ../parts.hg2
   bundle2-input: start processing of HG20 stream
   bundle2-input: reading bundle2 stream parameters
   options count: 0
   bundle2-input: start extraction of bundle2 parts
   bundle2-input: part header size: 17
@@ -547,11 +547,11 @@ Test part
 Test actual unbundling of test part
 =======================================
 
 Process the bundle
 
-  $ hg unbundle2 --debug --config progress.debug=true < ../parts.hg2
+  $ hg unbundle2 --debug --config progress.debug=true --config devel.bundle2.debug=true < ../parts.hg2
   bundle2-input: start processing of HG20 stream
   bundle2-input: reading bundle2 stream parameters
   bundle2-input-bundle: with-transaction
   bundle2-input: start extraction of bundle2 parts
   bundle2-input: part header size: 17
@@ -747,11 +747,11 @@ Support for changegroup
   o  1:cd010b8cd998 draft Nicolas Dumazet <nicdumz.commits at gmail.com>  A
   
   @  0:3903775176ed draft test  a
   
 
-  $ hg bundle2 --debug --config progress.debug=true --rev '8+7+5+4' ../rev.hg2
+  $ hg bundle2 --debug --config progress.debug=true --config devel.bundle2.debug=true --rev '8+7+5+4' ../rev.hg2
   4 changesets found
   list of changesets:
   32af7686d403cf45b5d95f2d70cebea587ac806a
   9520eea781bcca16c1e15acc0ba14335a0e8e5ba
   eea13746799a9e0bfd88f29d3c2e9dc9389f524f


More information about the Mercurial-devel mailing list