exchange: reinsert comment in the right place

Unrelated new code was inserted between the original comment and the related
code block.

--HG--
extra : rebase_source : cdf73fc4e31eb00a1105d3cb70f5e725b032e2f7
bundle2: introduce a bundle2caps function

The process of decoding remote bundle2caps blob into a dictionary is cumbersome.
We move it into a small helper function. This will clarify code that reads
bundle2 capabilities of peers and helps using it in new places.

--HG--
extra : rebase_source : d179e3b39c507a7e016094b1cba21c2a9e34b4be
bundle2: introduce a ``caps20to10`` function

This function factors the creation of appropriate entries to use in
``bundlecaps`` argument of ``getbundle``. This cleans up code calling
``getbundle`` and helps its usage in more part of the code.

--HG--
extra : rebase_source : d557f8cb5eebccbe5f0641d598a8e9bcab4481ca
getbundle: declare type of parameters

In addition to listing the expected options for ``getbundle``, we also list their
types and handle the encoding/decoding automatically. This should make it easier
for extensions to transmit additional information to getbundle.

--HG--
extra : rebase_source : e768a7cb3b81481f4de9217f27e8abeb8572fe97
bundle2: use a smarter template for test

We use a more compact template that includes phase information.

--HG--
extra : rebase_source : 67ddd18139f9313fd678b713b68cd897e13298d4
bundle2: use non-publishing repo in test

If we are going to test usage of bundle for phases exchange, we need some phase movements
to be exchanged.

--HG--
extra : rebase_source : 35c939995439ab7ebf3662ede0ff1625fe558cd5
bundle2: add more phase movement in the test

To test phase exchange with bundle2 we need some phase movement to happen.
Appropriate logging is added to track those changes.

--HG--
extra : rebase_source : 3e7cb518c5705c55be4fd248eafe267b85e98081
pushkey: introduce an ``encodekeys`` function

This function provides a standardized way to exchange pushkey content over
the wire.

--HG--
extra : rebase_source : d3addd21464d41470f72e6d6fc83f6679fe1d045
wireproto: use pushkey.encodekey

--HG--
extra : rebase_source : faa4ebe750ef7d24744431f90976f9019d44319f
pushkey: introduce an ``decodekeys`` function

This function provides a standardized way to exchange pushkey content over
the wire.

--HG--
extra : rebase_source : cf6d2ae93703d3933aad730acb63e2ed8cdab2e6
wireproto: use pushkey.decodekey

--HG--
extra : rebase_source : f64856667b7866c4636b0e7709da556c545b9739
pull: split remote phases retrieval from actual application

We want to be able to retrieve phases information through bundle2. The logic to
apply remote phases will not change.

--HG--
extra : rebase_source : e746aa4ae88a153a73a7560c50e0c15ba15d3bc8
bundle: introduce a listkey handler

This makes it possible to handle listkeys-related data stored in a bundle2.
There are no producers yet.

--HG--
extra : rebase_source : d13ec62cc36c62b1dc87c79d4f8751e5b1673815
getbundle: raise error if extra arguments are provided for bundle10

New arguments are most likely to be supported by bundle20 (and above) only.

--HG--
extra : rebase_source : 406c99a90f20b4433f7f2fcc7804ebcd27ee1803
extra : amend_source : e18410989ba0e3bd0211f00425fcf2cd09dc2f13
getbundle: support of listkeys argument when bundle2 is used

A new ``listkeys`` is supported by getbundle. It is a list of namespaces whose
content should be included in the bundle.

An appropriate entry has been added to the wireproto map of getbundle arguments
and a new bundle2 capability is advertised.

There are still no codes that request such parts in core mercurial.

--HG--
extra : rebase_source : 60c9aba3668e855c23e3d53173100f5a1f2d0823
pull: when remote supports it, pull phase data alongside changesets

We use bundle2 to retrieve the remote phase data at the same time as
changesets. This reduces the amount of requestis and should improve consistency
as the server can ensure nothing changed between the retrieval of those parts.

--HG--
extra : rebase_source : a447eb68322820803f677003e46bee5869e1ffab
pushkey: add a ``decode`` function

This function is just a shorthand for ``decoding.fromlocal``. It will help
hiding the encoding business from other code exchanging pushkey data over the
wire.

--HG--
extra : rebase_source : fa972ea8195044c754de76d2c1b807aa2768c77d
bundle2: add ``pushkey`` support

After ``listkeys`` we can now include ``pushkey`` request in a bundle2. The part
uses a very simple scheme closest as possible to the current wireproto command
for ``pushkey``. We may eventually decide for a more sophisticated part format
before the protocol becomes final.

--HG--
extra : rebase_source : 045ff8a2e4adf58b704003602481498f49ded5b5
pushkey: add an ``encode`` function

This function is just a shorthand for ``encoding.fromlocal``. It will help
hiding the encoding business from other code exchanging pushkey data over the
wire.

--HG--
extra : rebase_source : ac2f0178a44cd1ad30a25357cbd915e728bccd5f
push: use bundle2 to push phases when available

We now use a bundle2 container to push all phase updates at the same time. This
is a significant step forward, even if further refactoring is needed to unify
phase push with the changeset push.

--HG--
extra : rebase_source : 239fc0847fa533a9911eb6663c2b3439bf2aea63