bundle2: print debug information during bundling
The bundler class is now feed with an ui object and use it to transmit data
about the bundling process.
--- a/mercurial/bundle2.py Wed Mar 19 02:36:21 2014 -0700
+++ b/mercurial/bundle2.py Tue Mar 18 19:07:10 2014 -0700
@@ -97,7 +97,8 @@
This object does not support payload part yet."""
- def __init__(self):
+ def __init__(self, ui):
+ self.ui = ui
self._params = []
self._parts = []
@@ -110,8 +111,10 @@
self._params.append((name, value))
def getchunks(self):
+ self.ui.debug('start emission of %s stream\n' % _magicstring)
yield _magicstring
param = self._paramchunk()
+ self.ui.debug('bundle parameter: %s\n' % param)
yield _pack(_fstreamparamsize, len(param))
if param:
yield param
@@ -119,6 +122,7 @@
# no support for parts
# to be obviously fixed soon.
assert not self._parts
+ self.ui.debug('end of bundle\n')
yield '\0\0'
def _paramchunk(self):
--- a/tests/test-bundle2.t Wed Mar 19 02:36:21 2014 -0700
+++ b/tests/test-bundle2.t Tue Mar 18 19:07:10 2014 -0700
@@ -20,7 +20,7 @@
> '[OUTPUTFILE]')
> def cmdbundle2(ui, repo, path=None, **opts):
> """write a bundle2 container on standard ouput"""
- > bundler = bundle2.bundle20()
+ > bundler = bundle2.bundle20(ui)
> for p in opts['param']:
> p = p.split('=', 1)
> try:
@@ -161,9 +161,11 @@
Test debug output
---------------------------------------------------
-(no debug output yet)
$ hg bundle2 --debug --param 'e|! 7/=babar%#==tutu' --param simple ../out.hg2
+ start emission of HG20 stream
+ bundle parameter: e%7C%21%207/=babar%25%23%3D%3Dtutu simple
+ end of bundle
file content is ok