Patchwork D1393: bundle2: inline struct operations

login
register
mail settings
Submitter phabricator
Date Nov. 20, 2017, 11:50 p.m.
Message ID <55c59364aa8494840db862b69337d1a9@localhost.localdomain>
Download mbox | patch
Permalink /patch/25694/
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 rHG764e3ad1cf54: bundle2: inline struct operations (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1393?vs=3471&id=3697

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

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
@@ -1196,11 +1196,14 @@ 
     dolog = ui.configbool('devel', 'bundle2.debug')
     debug = ui.debug
 
-    headersize = struct.calcsize(_fpayloadsize)
+    headerstruct = struct.Struct(_fpayloadsize)
+    headersize = headerstruct.size
+    unpack = headerstruct.unpack
+
     readexactly = changegroup.readexactly
     read = fh.read
 
-    chunksize = _unpack(_fpayloadsize, readexactly(fh, headersize))[0]
+    chunksize = unpack(readexactly(fh, headersize))[0]
     indebug(ui, 'payload chunk size: %i' % chunksize)
 
     # changegroup.readexactly() is inlined below for performance.
@@ -1227,7 +1230,7 @@ 
                                 ' (got %d bytes, expected %d)') %
                               (len(s), chunksize))
 
-        chunksize = _unpack(_fpayloadsize, s)[0]
+        chunksize = unpack(s)[0]
 
         # indebug() inlined for performance.
         if dolog: