##// END OF EJS Templates
unbundle20: allow generic dispatch between unbundlers...
Pierre-Yves David -
r24648:5cac3acc default
parent child Browse files
Show More
@@ -525,12 +525,13 b' def getunbundler(ui, fp, header=None):'
525 """return a valid unbundler object for a given header"""
525 """return a valid unbundler object for a given header"""
526 if header is None:
526 if header is None:
527 header = changegroup.readexactly(fp, 4)
527 header = changegroup.readexactly(fp, 4)
528 magic, version = header[0:2], header[2:4]
528 magic, version = header[0:2], header[2:4]
529 if magic != 'HG':
529 if magic != 'HG':
530 raise util.Abort(_('not a Mercurial bundle'))
530 raise util.Abort(_('not a Mercurial bundle'))
531 if version != '2Y':
531 unbundlerclass = formatmap.get(version)
532 raise util.Abort(_('unknown bundle version %s') % version)
532 if unbundlerclass is None:
533 unbundler = unbundle20(ui, fp)
533 raise util.Abort(_('unknown bundle version %s') % version)
534 unbundler = unbundlerclass(ui, fp)
534 ui.debug('start processing of %s stream\n' % header)
535 ui.debug('start processing of %s stream\n' % header)
535 return unbundler
536 return unbundler
536
537
@@ -615,6 +616,8 b' class unbundle20(unpackermixin):'
615 def compressed(self):
616 def compressed(self):
616 return False
617 return False
617
618
619 formatmap = {'2Y': unbundle20}
620
618 class bundlepart(object):
621 class bundlepart(object):
619 """A bundle2 part contains application level payload
622 """A bundle2 part contains application level payload
620
623
General Comments 0
You need to be logged in to leave comments. Login now