Patchwork D1391: bundle2: inline debug logging

login
register
mail settings
Submitter phabricator
Date Nov. 20, 2017, 11:50 p.m.
Message ID <75dcff4a0c3ef784b4ee187231f81711@localhost.localdomain>
Download mbox | patch
Permalink /patch/25692/
State Not Applicable
Headers show

Comments

phabricator - Nov. 20, 2017, 11:50 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG589eed45a452: bundle2: inline debug logging (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1391?vs=3469&id=3695

REVISION DETAIL
  https://phab.mercurial-scm.org/D1391

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS




To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -1193,6 +1193,9 @@ 
     Part payload data consists of framed chunks. This function takes
     a file handle and emits those chunks.
     """
+    dolog = ui.configbool('devel', 'bundle2.debug')
+    debug = ui.debug
+
     headersize = struct.calcsize(_fpayloadsize)
     readexactly = changegroup.readexactly
 
@@ -1211,7 +1214,10 @@ 
                 'negative payload chunk size: %s' % chunksize)
 
         chunksize = _unpack(_fpayloadsize, readexactly(fh, headersize))[0]
-        indebug(ui, 'payload chunk size: %i' % chunksize)
+
+        # indebug() inlined for performance.
+        if dolog:
+            debug('bundle2-input: payload chunk size: %i\n' % chunksize)
 
 class unbundlepart(unpackermixin):
     """a bundle part read from a bundle"""