changeset 21608:3cb96ca90c17

bundle2: introduce an ``_initparams`` method The handling of parameters will become much more sophisticated in the coming changesets. So we extract the logic in a function to not pollute the generic logic.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 28 May 2014 10:04:02 -0700
parents 054fa5176fa7
children 63cc2594ef8a
files mercurial/bundle2.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundle2.py	Thu May 22 12:52:09 2014 -0700
+++ b/mercurial/bundle2.py	Wed May 28 10:04:02 2014 -0700
@@ -706,6 +706,11 @@
         data = self._fromheader(struct.calcsize(format))
         return _unpack(format, data)
 
+    def _initparams(self, mandatoryparams, advisoryparams):
+        """internal function to setup all logic related parameters"""
+        self.mandatoryparams = mandatoryparams
+        self.advisoryparams  = advisoryparams
+
     def _readheader(self):
         """read the header and setup the object"""
         typesize = self._unpackheader(_fparttypesize)[0]
@@ -732,8 +737,7 @@
         advparams = []
         for key, value in advsizes:
             advparams.append((self._fromheader(key), self._fromheader(value)))
-        self.mandatoryparams = manparams
-        self.advisoryparams  = advparams
+        self._initparams(manparams, advparams)
         ## part payload
         def payloadchunks():
             payloadsize = self._unpack(_fpayloadsize)[0]