context: explicitly return a tuple

In the refactoring of removing localrepo.status, 2edb8648c500, we accidentally
changed the return type from a tuple to a list. Philosophically, this is
incorrect so we explicitly return a tuple again.

--HG--
extra : rebase_source : 57714973f2a3383ceef4e24f34085926bb02d19d
bundle2: rename UnknownPartError to BundleValueError

We are going to raise exceptions for a wider range of cases: unsupported
mandatory stream and part parameters.  We rename the exception with a wider
name.

--HG--
extra : rebase_source : 87b5d8f9449d3e71bdbdd96fb5e8ec98d24430aa
bundle2: move exception classes into the error module

Exceptions should have known their place.

--HG--
extra : rebase_source : 9fe9f57b103f9a5d2d9afd15b8f7710675003f32
bundle2: rename b2x:error:unknownpart to b2x:error:unsupportedcontent

This is a backward compatibility breakage per se. But bundle2 was explicitly
flagged as experimental, and this is one an error path anyway. So the worse
possible outcome from this change is to still have a crash but with a different
message.

--HG--
extra : rebase_source : 0b45a1a08091ad9e6a9b68d6fe792ac7660fac73
bundle2: introduce a parttype attribute to BundleValueError

We will use the Exception for more that just unknown part type.

--HG--
extra : rebase_source : 09a9d5f4a87a131ef803eab62767f6f3c149138b
bundle2: introduce a ``params`` attribute to BundleValueError

We'll first use it for unsupported mandatory parameters on parts.

--HG--
extra : rebase_source : bfa3780a3a7b45a0a8240e7489d45179a76f3e93
bundle2: support transmission of params error over the wire

We picked a null character to split each parameter during the transfer. This is
fragile if the same character is used in parameter name. However other
codes will already behave in a strange way in that case, so we are not
introducing any regression. A better format may be picked for the final
version of the protocol.

--HG--
extra : rebase_source : d9a5729a4dd43961c89abc32445150c772582acb
bundle2: make it possible to declare params handled by a part handler

If we are to enforce the mandatory aspect of parameter, we need a way to
discover what a handler supports. The best option we end up with is this a simple
declaration of known parameters at registration time.

We simply plug the list of parameters on the function object because Python lets
us do that and there is no benefit for a more complicated way.

One of the handlers is updated for example and testing.

--HG--
extra : rebase_source : b60e50f6755b330ccced2cd9429df29c27419889
bundle2: declare supported parameters for all handlers

We now update all existing handlers with the supported parameters information.

--HG--
extra : rebase_source : 8f183124385ea15740a31cbcb0a55af71b433358
bundle2: enforce all parameters in a part to be handled

Once we picked a handler, we check that all mandatory parameter keys are
properly supported. If not we raise an exception.

We added a test for this case.

The code now fails for any part with unknown mandatory parameters. We will
ignore such errors for advisory parts in a later changeset.

--HG--
extra : rebase_source : 1c69bf7af4b90d33bbd45db00f9c84c3047f90a0
bundle2: ignore advisory part with unknown parameters

Advisory parts are advisory. If a handler exists but does not support the
proper parameters, we can safely ignore it.

Test has been updated to include this case.

--HG--
extra : rebase_source : ade522b35efaf188f7dcab9117b46d19eae29f9c
bundle2: support None parttype in BundleValueError

This will be used for errors at the stream level.

--HG--
extra : rebase_source : 58d4ef403645fa2effa9b2a3e5bfee23cf3db02e
bundle2: raise BundleValueError error for stream level unsupported params

This ensures both consistency and smooth propagation over the wire.

--HG--
extra : rebase_source : c2445a43d82dc71895d14080f836112a0f243018
vim: use try catch in vim plugin to avoid conflicts

--HG--
extra : rebase_source : 3747017c34a8e79124ec83d5d26940ef685a0b6e
wireproto: expose the list of getbundle arguments to extensions

For now, getbundle accepts a fixed number of arguments: ``heads``, ``common``
and ``bundlecaps``. We make this list exposed at the module level to let
extensions add content there. This is important for extensions that wish to use
bundle2 for other contents than changegroup.

--HG--
branch : stable
extra : rebase_source : 8b3dc18e662e13b1fde39a422b82218d24dbbc7e
convert: drastically speed up git conversions

We would formerly exec git cat-file once for every commit, plus once for
every tree and file we wnated to read.  This switches to using git
cat-file's batch mode, which is much, much, much faster.

Using this new code, converting the git git repo to hg ran in 106
minutes on my machine.  Using the stock mercurial, it required 1239
minutes.  I believe this to be typical of the speedups we will see
form this patch.

--HG--
extra : rebase_source : 90e3fcd9e6e4e68d7cedb841ea921d6622db29ce
merge with stable