bundle2: decorate exception raised during bundle processing

This is a small hack to help us do some graceful error handling in bundle2
without major refactoring. See embedded comment for details.

--HG--
branch : stable
bundle2: gracefully handle abort during unbundle

Clients expect a bundle2 reply to their bundle2 submission. So we
catch the Abort error and turn it into a bundle2 containing a part
transporting the exception data. The unbundling of this reply will
raise the error again.

--HG--
branch : stable
bundle2: make error testing more modular

We have more than Abort to test.

--HG--
branch : stable
bundle2: use a more specific UnknownPartError when no handler is found

KeyError is very generic, we need something more specific for proper error
handling.

--HG--
branch : stable
bundle2: catch UnknownPartError during push

We narrow the exception catching while unbundling the push reply.

--HG--
branch : stable
bundle2: catch UnknownPartError during pull

We narrow the exception catching while pulling.

--HG--
branch : stable
bundle2: catch UnknownPartError during local push

When doing local push, UnknownPartError from the server will be raised directly
to the client. We need to catch them too.

--HG--
branch : stable
bundle2: gracefully handle UnknownPartError during unbundle

Same as for Abort error, we catch the error, encode it into a bundle2 reply
(expected by the client) and stream this reply. The client processing of the
error will raise the exception again.

--HG--
branch : stable
bundle2: fix raising errors during heads checking

If the heads on the server differ from the ones reported seen by the client at
bundle time, we raise a PushRaced exception. However, the part raising the
exception was broken.

To fix it, we move the PushRaced class in the error module so it can be
accessible everywhere without an import cycle.

A test is also added to prevent regression.

--HG--
branch : stable
bundle2: add an error message to push race error

Errors with no explanations makes my uncle Bob sad.

--HG--
branch : stable
bundle2: gracefully handle PushRaced error during unbundle

Same drill again. We catch the PushRaced error, check if it cames from
a bundle2 processing, if so we turn it into a bundle2 with a part
transporting error information to be reraised client side.

--HG--
branch : stable
extra : amend_source : 07192353b2213e5369f430868f308885270067d3
bundle2: gracefully handle hook abort

We make sure any exceptions raised during the whole span of handling bundle2
processing are decorated. This let us catch exceptions raised by hooks prior to
transaction commit.

--HG--
branch : stable
extra : rebase_source : 6394d44e4eae25ead548117aff52d47e844abedc