##// END OF EJS Templates
bundle2: move unpackheader closure into the class...
Pierre-Yves David -
r21016:b477afb1 default
parent child Browse files
Show More
@@ -559,27 +559,29 b' class unbundlepart(unpackermixin):'
559 559 self._headeroffset += size
560 560 return data
561 561
562 def _readdata(self):
563 """read the header and setup the object"""
564 # some utility to help reading from the header block
565 def unpackheader(format):
562 def _unpackheader(self, format):
566 563 """read given format from header
567 564
568 565 This automatically compute the size of the format to read."""
569 566 data = self._fromheader(struct.calcsize(format))
570 567 return _unpack(format, data)
571 568
572 typesize = unpackheader(_fparttypesize)[0]
569 def _readdata(self):
570 """read the header and setup the object"""
571 # some utility to help reading from the header block
572
573 typesize = self._unpackheader(_fparttypesize)[0]
573 574 self.type = self._fromheader(typesize)
574 575 self.ui.debug('part type: "%s"\n' % self.type)
575 self.id = unpackheader(_fpartid)[0]
576 self.id = self._unpackheader(_fpartid)[0]
576 577 self.ui.debug('part id: "%s"\n' % self.id)
577 578 ## reading parameters
578 579 # param count
579 mancount, advcount = unpackheader(_fpartparamcount)
580 mancount, advcount = self._unpackheader(_fpartparamcount)
580 581 self.ui.debug('part parameters: %i\n' % (mancount + advcount))
581 582 # param size
582 paramsizes = unpackheader(_makefpartparamsizes(mancount + advcount))
583 fparamsizes = _makefpartparamsizes(mancount + advcount)
584 paramsizes = self._unpackheader(fparamsizes)
583 585 # make it a list of couple again
584 586 paramsizes = zip(paramsizes[::2], paramsizes[1::2])
585 587 # split mandatory from advisory
General Comments 0
You need to be logged in to leave comments. Login now