comparison mercurial/bundle2.py @ 21130:1ff06386217f

bundle2: introduce `replycaps` part for on-demand reply The bundle2 processing does not create a bundle2 reply by default anymore. It is only done if the client requests it with a `replycaps` part. This part is called `replycaps` as it will eventually contain data about which bundle2 capabilities are supported by the client. We have to add a flag to the test command to control whether a reply is generated or not.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 16 Apr 2014 14:09:35 -0400
parents 07bcbf326c8d
children b7435117d951
comparison
equal deleted inserted replaced
21129:07bcbf326c8d 21130:1ff06386217f
277 before final usage. 277 before final usage.
278 278
279 Unknown Mandatory part will abort the process. 279 Unknown Mandatory part will abort the process.
280 """ 280 """
281 op = bundleoperation(repo, transactiongetter) 281 op = bundleoperation(repo, transactiongetter)
282 # todo:
283 # - only create reply bundle if requested.
284 op.reply = bundle20(op.ui)
285 # todo: 282 # todo:
286 # - replace this is a init function soon. 283 # - replace this is a init function soon.
287 # - exception catching 284 # - exception catching
288 unbundler.params 285 unbundler.params
289 iterparts = unbundler.iterparts() 286 iterparts = unbundler.iterparts()
672 heads.append(h) 669 heads.append(h)
673 h = inpart.read(20) 670 h = inpart.read(20)
674 assert not h 671 assert not h
675 if heads != op.repo.heads(): 672 if heads != op.repo.heads():
676 raise exchange.PushRaced() 673 raise exchange.PushRaced()
674
675 @parthandler('replycaps')
676 def handlereplycaps(op, inpart):
677 """Notify that a reply bundle should be created
678
679 Will convey bundle capability at some point too."""
680 if op.reply is None:
681 op.reply = bundle20(op.ui)