changeset 25332:0cdd1c811705

bundle2: add generic debug output at the end of bundle processing If we are about to hide the detailed debug output, we need some generic debug message to replace it in a concise way.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 27 May 2015 00:02:49 -0700
parents 53ca47ef645d
children 5bfffdbdc907
files mercurial/bundle2.py tests/test-bundle2-format.t
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundle2.py	Wed May 27 00:00:35 2015 -0700
+++ b/mercurial/bundle2.py	Wed May 27 00:02:49 2015 -0700
@@ -328,13 +328,14 @@
             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 @@
             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):
--- a/tests/test-bundle2-format.t	Wed May 27 00:00:35 2015 -0700
+++ b/tests/test-bundle2-format.t	Wed May 27 00:02:49 2015 -0700
@@ -605,6 +605,7 @@
   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