Mercurial > hg
comparison mercurial/bundle2.py @ 20947:c33d7bf53812
bundle2: feed a unbundle20 to the `processbundle` function
The unbundle can comes from multiple sources. (on disk file, peer, etc) and
(ultimately) of multiple type (bundle10, bundle20). The `processbundle` is no
longer in charge of creating the bundle.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 02 Apr 2014 13:50:57 -0700 |
parents | 6fe95448596d |
children | 329cd74b52bd |
comparison
equal
deleted
inserted
replaced
20946:e910336539f7 | 20947:c33d7bf53812 |
---|---|
181 assert lparttype not in parthandlermapping | 181 assert lparttype not in parthandlermapping |
182 parthandlermapping[lparttype] = func | 182 parthandlermapping[lparttype] = func |
183 return func | 183 return func |
184 return _decorator | 184 return _decorator |
185 | 185 |
186 def processbundle(repo, stream): | 186 def processbundle(repo, unbundler): |
187 """This function process a bundle, apply effect to/from a repo | 187 """This function process a bundle, apply effect to/from a repo |
188 | 188 |
189 Currently it: | 189 It iterates over each part then searches for and uses the proper handling |
190 - parse a stream into an unbundle20 object | 190 code to process the part. Parts are processed in order. |
191 - iterate over each parts then search and use the proper handling code to | |
192 process the part. | |
193 | |
194 Parts are processes in order. | |
195 | 191 |
196 This is very early version of this function that will be strongly reworked | 192 This is very early version of this function that will be strongly reworked |
197 before final usage. | 193 before final usage. |
198 | 194 |
199 Unknown Mandatory part will abort the process. | 195 Unknown Mandatory part will abort the process. |
200 """ | 196 """ |
201 ui = repo.ui | 197 ui = repo.ui |
202 # Extraction of the unbundler object will most likely change. It may be | |
203 # done outside of this function, the unbundler would be passed as argument. | |
204 # in all case the unbundler will eventually be created by a | |
205 # `changegroup.readbundle` style function. | |
206 unbundler = unbundle20(ui, stream) | |
207 # todo: | 198 # todo: |
208 # - replace this is a init function soon. | 199 # - replace this is a init function soon. |
209 # - exception catching | 200 # - exception catching |
210 unbundler.params | 201 unbundler.params |
211 iterparts = iter(unbundler) | 202 iterparts = iter(unbundler) |