bundle2: hide bundle2 stream debug under a config flag
authorPierre-Yves David <pierre-yves.david@fb.com>
Tue, 26 May 2015 23:06:17 -0700
changeset 25336 7c60a42265fb
parent 25335 8f7137a85a0e
child 25337 636b1f1b9f8d
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.
mercurial/bundle2.py
tests/test-bundle2-format.t
--- a/mercurial/bundle2.py	Tue May 26 23:47:19 2015 -0700
+++ b/mercurial/bundle2.py	Tue May 26 23:06:17 2015 -0700
@@ -175,11 +175,13 @@
 
 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"""
--- a/tests/test-bundle2-format.t	Tue May 26 23:47:19 2015 -0700
+++ b/tests/test-bundle2-format.t	Tue May 26 23:06:17 2015 -0700
@@ -336,7 +336,7 @@
 
 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
@@ -350,7 +350,7 @@
 
 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/'
@@ -384,7 +384,7 @@
 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: 
@@ -468,7 +468,7 @@
       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
@@ -549,7 +549,7 @@
 
 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
@@ -749,7 +749,7 @@
   @  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