Show More
@@ -661,13 +661,15 b' class unbundle20(unpackermixin):' | |||||
661 | raise ValueError('empty parameter name') |
|
661 | raise ValueError('empty parameter name') | |
662 | if name[0] not in string.letters: |
|
662 | if name[0] not in string.letters: | |
663 | raise ValueError('non letter first character: %r' % name) |
|
663 | raise ValueError('non letter first character: %r' % name) | |
664 | # Some logic will be later added here to try to process the option for |
|
664 | try: | |
665 | # a dict of known parameter. |
|
665 | handler = b2streamparamsmap[name.lower()] | |
|
666 | except KeyError: | |||
666 | if name[0].islower(): |
|
667 | if name[0].islower(): | |
667 | indebug(self.ui, "ignoring unknown parameter %r" % name) |
|
668 | indebug(self.ui, "ignoring unknown parameter %r" % name) | |
668 | else: |
|
669 | else: | |
669 | raise error.BundleUnknownFeatureError(params=(name,)) |
|
670 | raise error.BundleUnknownFeatureError(params=(name,)) | |
670 |
|
671 | else: | ||
|
672 | handler(self, name, value) | |||
671 |
|
673 | |||
672 | def iterparts(self): |
|
674 | def iterparts(self): | |
673 | """yield all parts contained in the stream""" |
|
675 | """yield all parts contained in the stream""" | |
@@ -700,6 +702,16 b' class unbundle20(unpackermixin):' | |||||
700 |
|
702 | |||
701 | formatmap = {'20': unbundle20} |
|
703 | formatmap = {'20': unbundle20} | |
702 |
|
704 | |||
|
705 | b2streamparamsmap = {} | |||
|
706 | ||||
|
707 | def b2streamparamhandler(name): | |||
|
708 | """register a handler for a stream level parameter""" | |||
|
709 | def decorator(func): | |||
|
710 | assert name not in formatmap | |||
|
711 | b2streamparamsmap[name] = func | |||
|
712 | return func | |||
|
713 | return decorator | |||
|
714 | ||||
703 | class bundlepart(object): |
|
715 | class bundlepart(object): | |
704 | """A bundle2 part contains application level payload |
|
716 | """A bundle2 part contains application level payload | |
705 |
|
717 |
General Comments 0
You need to be logged in to leave comments.
Login now