equal
deleted
inserted
replaced
146 The number parameters is variable so we need to build that format |
146 The number parameters is variable so we need to build that format |
147 dynamically. |
147 dynamically. |
148 """ |
148 """ |
149 return '>'+('BB'*nbparams) |
149 return '>'+('BB'*nbparams) |
150 |
150 |
151 |
|
152 parthandlermapping = {} |
151 parthandlermapping = {} |
|
152 |
|
153 def parthandler(parttype): |
|
154 """decorator that register a function as a bundle2 part handler |
|
155 |
|
156 eg:: |
|
157 |
|
158 @parthandler('myparttype') |
|
159 def myparttypehandler(...): |
|
160 '''process a part of type "my part".''' |
|
161 ... |
|
162 """ |
|
163 def _decorator(func): |
|
164 assert parttype not in parthandlermapping |
|
165 parthandlermapping[parttype] = func |
|
166 return func |
|
167 return _decorator |
153 |
168 |
154 def processbundle(repo, stream): |
169 def processbundle(repo, stream): |
155 """This function process a bundle, apply effect to/from a repo |
170 """This function process a bundle, apply effect to/from a repo |
156 |
171 |
157 Currently it: |
172 Currently it: |