# HG changeset patch # User Pierre-Yves David # Date 1432705743 25200 # Node ID 8f2c362bcb58fa8917181f7bd191a6de886e5af5 # Parent ee02728dd5f9710db6dd56882a330ddff3f4b591 bundle2: introduce a specific function for bundling debug message The bundling process is very verbose, we would like to be able to hide such output behind a configuration flag and have it more explicitly referencing bundle2. The first step is to gather all these messages in a dedicated function. The same gathering will be later do for debug message issue by unbundling. diff -r ee02728dd5f9 -r 8f2c362bcb58 mercurial/bundle2.py --- a/mercurial/bundle2.py Wed May 27 17:01:43 2015 -0700 +++ b/mercurial/bundle2.py Tue May 26 22:49:03 2015 -0700 @@ -173,6 +173,10 @@ _parttypeforbidden = re.compile('[^a-zA-Z0-9_:-]') +def outdebug(ui, message): + """debug regarding output stream (bundling)""" + ui.debug(message) + def validateparttype(parttype): """raise ValueError if a parttype contains invalid character""" if _parttypeforbidden.search(parttype): @@ -464,20 +468,20 @@ # methods used to generate the bundle2 stream def getchunks(self): - self.ui.debug('start emission of %s stream\n' % self._magicstring) + outdebug(self.ui, 'start emission of %s stream\n' % self._magicstring) yield self._magicstring param = self._paramchunk() - self.ui.debug('bundle parameter: %s\n' % param) + outdebug(self.ui, 'bundle parameter: %s\n' % param) yield _pack(_fstreamparamsize, len(param)) if param: yield param - self.ui.debug('start of parts\n') + outdebug(self.ui, 'start of parts\n') for part in self._parts: - self.ui.debug('bundle part: "%s"\n' % part.type) + outdebug(self.ui, 'bundle part: "%s"\n' % part.type) for chunk in part.getchunks(): yield chunk - self.ui.debug('end of bundle\n') + outdebug(self.ui, 'end of bundle\n') yield _pack(_fpartheadersize, 0) def _paramchunk(self):