Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.py @ 21600:5e08f3b65510
bundle2: update all ``addpart`` callers to ``newpart``
The new method is what we want in all current cases.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 23 May 2014 15:59:19 -0700 |
parents | 57cd844d7a5b |
children | 7ff01befc7ec |
comparison
equal
deleted
inserted
replaced
21599:57cd844d7a5b | 21600:5e08f3b65510 |
---|---|
319 handler(op, part) | 319 handler(op, part) |
320 finally: | 320 finally: |
321 if output is not None: | 321 if output is not None: |
322 output = op.ui.popbuffer() | 322 output = op.ui.popbuffer() |
323 if output: | 323 if output: |
324 outpart = bundlepart('b2x:output', | 324 op.reply.newpart('b2x:output', |
325 advisoryparams=[('in-reply-to', | 325 advisoryparams=[('in-reply-to', |
326 str(part.id))], | 326 str(part.id))], |
327 data=output) | 327 data=output) |
328 op.reply.addpart(outpart) | |
329 part.read() | 328 part.read() |
330 except Exception, exc: | 329 except Exception, exc: |
331 if part is not None: | 330 if part is not None: |
332 # consume the bundle content | 331 # consume the bundle content |
333 part.read() | 332 part.read() |
407 assert part.id is None | 406 assert part.id is None |
408 part.id = len(self._parts) # very cheap counter | 407 part.id = len(self._parts) # very cheap counter |
409 self._parts.append(part) | 408 self._parts.append(part) |
410 | 409 |
411 def newpart(self, typeid, *args, **kwargs): | 410 def newpart(self, typeid, *args, **kwargs): |
412 """create a new part for the containers""" | 411 """create a new part and add it to the containers""" |
413 part = bundlepart(typeid, *args, **kwargs) | 412 part = bundlepart(typeid, *args, **kwargs) |
414 self.addpart(part) | 413 self.addpart(part) |
415 return part | 414 return part |
416 | 415 |
417 # methods used to generate the bundle2 stream | 416 # methods used to generate the bundle2 stream |