Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/bundle2.py Wed Apr 16 18:41:48 2014 -0400 +++ b/mercurial/bundle2.py Wed Apr 16 14:09:35 2014 -0400 @@ -280,9 +280,6 @@ """ op = bundleoperation(repo, transactiongetter) # todo: - # - only create reply bundle if requested. - op.reply = bundle20(op.ui) - # todo: # - replace this is a init function soon. # - exception catching unbundler.params @@ -674,3 +671,11 @@ assert not h if heads != op.repo.heads(): raise exchange.PushRaced() + +@parthandler('replycaps') +def handlereplycaps(op, inpart): + """Notify that a reply bundle should be created + + Will convey bundle capability at some point too.""" + if op.reply is None: + op.reply = bundle20(op.ui)