##// 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 self._headeroffset += size
559 self._headeroffset += size
560 return data
560 return data
561
561
562 def _unpackheader(self, format):
563 """read given format from header
564
565 This automatically compute the size of the format to read."""
566 data = self._fromheader(struct.calcsize(format))
567 return _unpack(format, data)
568
562 def _readdata(self):
569 def _readdata(self):
563 """read the header and setup the object"""
570 """read the header and setup the object"""
564 # some utility to help reading from the header block
571 # some utility to help reading from the header block
565 def unpackheader(format):
566 """read given format from header
567
572
568 This automatically compute the size of the format to read."""
573 typesize = self._unpackheader(_fparttypesize)[0]
569 data = self._fromheader(struct.calcsize(format))
570 return _unpack(format, data)
571
572 typesize = unpackheader(_fparttypesize)[0]
573 self.type = self._fromheader(typesize)
574 self.type = self._fromheader(typesize)
574 self.ui.debug('part type: "%s"\n' % self.type)
575 self.ui.debug('part type: "%s"\n' % self.type)
575 self.id = unpackheader(_fpartid)[0]
576 self.id = self._unpackheader(_fpartid)[0]
576 self.ui.debug('part id: "%s"\n' % self.id)
577 self.ui.debug('part id: "%s"\n' % self.id)
577 ## reading parameters
578 ## reading parameters
578 # param count
579 # param count
579 mancount, advcount = unpackheader(_fpartparamcount)
580 mancount, advcount = self._unpackheader(_fpartparamcount)
580 self.ui.debug('part parameters: %i\n' % (mancount + advcount))
581 self.ui.debug('part parameters: %i\n' % (mancount + advcount))
581 # param size
582 # param size
582 paramsizes = unpackheader(_makefpartparamsizes(mancount + advcount))
583 fparamsizes = _makefpartparamsizes(mancount + advcount)
584 paramsizes = self._unpackheader(fparamsizes)
583 # make it a list of couple again
585 # make it a list of couple again
584 paramsizes = zip(paramsizes[::2], paramsizes[1::2])
586 paramsizes = zip(paramsizes[::2], paramsizes[1::2])
585 # split mandatory from advisory
587 # split mandatory from advisory
General Comments 0
You need to be logged in to leave comments. Login now