Show More
@@ -373,21 +373,11 b' class bundle20(object):' | |||||
373 | blocks.append(par) |
|
373 | blocks.append(par) | |
374 | return ' '.join(blocks) |
|
374 | return ' '.join(blocks) | |
375 |
|
375 | |||
376 |
class un |
|
376 | class unpackermixin(object): | |
377 | """interpret a bundle2 stream |
|
377 | """A mixin to extract bytes and struct data from a stream""" | |
378 |
|
378 | |||
379 | (this will eventually yield parts)""" |
|
379 | def __init__(self, fp): | |
380 |
|
||||
381 | def __init__(self, ui, fp): |
|
|||
382 | self.ui = ui |
|
|||
383 | self._fp = fp |
|
380 | self._fp = fp | |
384 | header = self._readexact(4) |
|
|||
385 | magic, version = header[0:2], header[2:4] |
|
|||
386 | if magic != 'HG': |
|
|||
387 | raise util.Abort(_('not a Mercurial bundle')) |
|
|||
388 | if version != '20': |
|
|||
389 | raise util.Abort(_('unknown bundle version %s') % version) |
|
|||
390 | self.ui.debug('start processing of %s stream\n' % header) |
|
|||
391 |
|
381 | |||
392 | def _unpack(self, format): |
|
382 | def _unpack(self, format): | |
393 | """unpack this struct format from the stream""" |
|
383 | """unpack this struct format from the stream""" | |
@@ -398,6 +388,23 b' class unbundle20(object):' | |||||
398 | """read exactly <size> bytes from the stream""" |
|
388 | """read exactly <size> bytes from the stream""" | |
399 | return changegroup.readexactly(self._fp, size) |
|
389 | return changegroup.readexactly(self._fp, size) | |
400 |
|
390 | |||
|
391 | ||||
|
392 | class unbundle20(unpackermixin): | |||
|
393 | """interpret a bundle2 stream | |||
|
394 | ||||
|
395 | (this will eventually yield parts)""" | |||
|
396 | ||||
|
397 | def __init__(self, ui, fp): | |||
|
398 | self.ui = ui | |||
|
399 | super(unbundle20, self).__init__(fp) | |||
|
400 | header = self._readexact(4) | |||
|
401 | magic, version = header[0:2], header[2:4] | |||
|
402 | if magic != 'HG': | |||
|
403 | raise util.Abort(_('not a Mercurial bundle')) | |||
|
404 | if version != '20': | |||
|
405 | raise util.Abort(_('unknown bundle version %s') % version) | |||
|
406 | self.ui.debug('start processing of %s stream\n' % header) | |||
|
407 | ||||
401 | @util.propertycache |
|
408 | @util.propertycache | |
402 | def params(self): |
|
409 | def params(self): | |
403 | """dictionnary of stream level parameters""" |
|
410 | """dictionnary of stream level parameters""" |
General Comments 0
You need to be logged in to leave comments.
Login now