comparison mercurial/bundle2.py @ 21005:3d38ebb586fe

bundle2: rename part to bundlepart We are going to introduce an `unbundlepart` dedicated to reading bundle. So we need to rename the one used to create bundle. Even if dedicated to creation, this is still used for unbundling until we get the new class.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 11 Apr 2014 07:36:14 -0700
parents 27ab4b8d2503
children a813caca89b3
comparison
equal deleted inserted replaced
21004:27ab4b8d2503 21005:3d38ebb586fe
501 while payloadsize: 501 while payloadsize:
502 payload.append(self._readexact(payloadsize)) 502 payload.append(self._readexact(payloadsize))
503 payloadsize = self._unpack(_fpayloadsize)[0] 503 payloadsize = self._unpack(_fpayloadsize)[0]
504 self.ui.debug('payload chunk size: %i\n' % payloadsize) 504 self.ui.debug('payload chunk size: %i\n' % payloadsize)
505 payload = ''.join(payload) 505 payload = ''.join(payload)
506 current = part(parttype, manparams, advparams, data=payload) 506 current = bundlepart(parttype, manparams, advparams, data=payload)
507 current.id = partid 507 current.id = partid
508 return current 508 return current
509 509
510 510
511 class part(object): 511 class bundlepart(object):
512 """A bundle2 part contains application level payload 512 """A bundle2 part contains application level payload
513 513
514 The part `type` is used to route the part to the application level 514 The part `type` is used to route the part to the application level
515 handler. 515 handler.
516 """ 516 """
596 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2') 596 ret = changegroup.addchangegroup(op.repo, cg, 'bundle2', 'bundle2')
597 op.records.add('changegroup', {'return': ret}) 597 op.records.add('changegroup', {'return': ret})
598 if op.reply is not None: 598 if op.reply is not None:
599 # This is definitly not the final form of this 599 # This is definitly not the final form of this
600 # return. But one need to start somewhere. 600 # return. But one need to start somewhere.
601 op.reply.addpart(part('reply:changegroup', (), 601 op.reply.addpart(bundlepart('reply:changegroup', (),
602 [('in-reply-to', str(inpart.id)), 602 [('in-reply-to', str(inpart.id)),
603 ('return', '%i' % ret)])) 603 ('return', '%i' % ret)]))
604 604
605 @parthandler('reply:changegroup') 605 @parthandler('reply:changegroup')
606 def handlechangegroup(op, inpart): 606 def handlechangegroup(op, inpart):
607 p = dict(inpart.advisoryparams) 607 p = dict(inpart.advisoryparams)
608 ret = int(p['return']) 608 ret = int(p['return'])