Show More
@@ -373,21 +373,11 class bundle20(object): | |||
|
373 | 373 | blocks.append(par) |
|
374 | 374 | return ' '.join(blocks) |
|
375 | 375 | |
|
376 |
class un |
|
|
377 | """interpret a bundle2 stream | |
|
376 | class unpackermixin(object): | |
|
377 | """A mixin to extract bytes and struct data from a stream""" | |
|
378 | 378 | |
|
379 | (this will eventually yield parts)""" | |
|
380 | ||
|
381 | def __init__(self, ui, fp): | |
|
382 | self.ui = ui | |
|
379 | def __init__(self, fp): | |
|
383 | 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 | 382 | def _unpack(self, format): |
|
393 | 383 | """unpack this struct format from the stream""" |
@@ -398,6 +388,23 class unbundle20(object): | |||
|
398 | 388 | """read exactly <size> bytes from the stream""" |
|
399 | 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 | 408 | @util.propertycache |
|
402 | 409 | def params(self): |
|
403 | 410 | """dictionnary of stream level parameters""" |
General Comments 0
You need to be logged in to leave comments.
Login now