diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -328,13 +328,14 @@ def processbundle(repo, unbundler, trans msg.append(' with-transaction') msg.append('\n') repo.ui.debug(''.join(msg)) - iterparts = unbundler.iterparts() + iterparts = enumerate(unbundler.iterparts()) part = None + nbpart = 0 try: - for part in iterparts: + for nbpart, part in iterparts: _processpart(op, part) except BaseException, exc: - for part in iterparts: + for nbpart, part in iterparts: # consume the bundle content part.seek(0, 2) # Small hack to let caller code distinguish exceptions from bundle2 @@ -348,6 +349,9 @@ def processbundle(repo, unbundler, trans salvaged = op.reply.salvageoutput() exc._bundle2salvagedoutput = salvaged raise + finally: + repo.ui.debug('bundle2-input-bundle: %i parts total\n' % nbpart) + return op def _processpart(op, part): 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 @@ -605,6 +605,7 @@ Process the bundle bundle2-input: payload chunk size: 0 bundle2-input: part header size: 0 bundle2-input: end of bundle2 stream + bundle2-input-bundle: 6 parts total 0 unread bytes 3 total verses sung