Commit Graph

226 Commits

Author SHA1 Message Date
Pierre-Yves David
15e3869bad bundle2: introduce a bundleoperation object
This object will hold all data and state gathered through the processing of a
bundle. This will allow:

- each handler to be aware of the things unbundled so far
- the caller to retrieve data about the execution
- bear useful object and logic (like repo, transaction)
- bear possible bundle2 reply triggered by the unbundling.

For now the object is very simple but it will grow at the same time as the
bundle2 implementation.
2014-04-02 22:24:44 -07:00
Pierre-Yves David
ef32c25a27 bundle2: feed a unbundle20 to the processbundle function
The unbundle can comes from multiple sources. (on disk file, peer, etc) and
(ultimately) of multiple type (bundle10, bundle20). The `processbundle` is no
longer in charge of creating the bundle.
2014-04-02 13:50:57 -07:00
Pierre-Yves David
9e7aaa60ee bundle2: read the whole bundle from stream on abort
When the bundle processing abort on unknown mandatory parts, we now makes sure
all the bundle content is read. This avoid leaving the communication channel in
an unrecoverable state.
2014-03-24 17:20:15 -07:00
Pierre-Yves David
d0833349ae bundle2: add some distinction between mandatory and advisory part
Mandatory part cannot be ignored when unknown. We raise a simple KeyError
exception when this happen.

This is very early version of this logic, see inline comment for future
improvement lead.
2014-03-24 13:02:02 -07:00
Pierre-Yves David
074a113388 bundle2: introduce a parthandler decorator
Simple syntax sugar to register an handler for a new part type.
2014-03-24 15:51:00 -07:00
Pierre-Yves David
61eb0495c2 bundle2: first version of a bundle processing
We now have a function that interpret part content.

This is a version early version of this function. It'll see major changes in
scope and API in future development. As for previous I'm just focussing on
getting minimal logic setup. Refining will happen with real world usage.
2014-03-24 12:25:33 -07:00
Pierre-Yves David
6c017016a8 bundle2: safely read unpack data from part header
We use the same approach that the other unpack, as function is given the struct
format and his both responsible for reading the right amount of data from the
header and unpack the struct.

This give use flexibility if we decide to change the size of something in the
format before the release.
2014-04-01 00:08:15 -07:00
Pierre-Yves David
d9d35475e7 bundle2: part params 2014-03-20 01:24:45 -07:00
Pierre-Yves David
307f4468ab bundle2: support for bundling and unbundling payload
We add the ability to bundle and unbundle a payload in parts. The payload is the
actual binary data of the part. It is used to convey all the applicative data.
For now we stick to very simple implementation with all the data fit in single
chunk. This open the door to some bundle2 testing usage. This will be improved before
bundle2 get used for real. We need to be able to stream the payload in multiple
part to exchange any changegroup efficiently. This simple version will do for
now.

Bundling and unbundling are done in the same changeset because the test for
parts is less modular. However, the result is not too complex.
2014-03-19 23:36:15 -07:00
Pierre-Yves David
875acaf161 bundle2: support unbundling empty part
We augment the unbundler to make it able to unbundle the empty part we are now
able to bundle.
2014-03-19 23:04:03 -07:00
Pierre-Yves David
72d1282e60 bundle2: support bundling of empty part (with a type)
Here start the work on bundle2 parts. Our first step is to be able to bundle a simplistic
part that just have a type, no parameters, empty payload.
2014-03-18 14:29:33 -07:00
Pierre-Yves David
63355bceee bundle2: implement the mandatory/advisory logic for parameter
Parameter starting with an upper case are mandatory, the one starting with a
lower case are advisory and may be ignored.
2014-03-19 17:53:45 -07:00
Pierre-Yves David
335e57b78f bundle2: print debug information during unbundling
The unbundler class is now feed with an ui object and use it to transmit data
about the unbundling process.
2014-03-19 17:11:49 -07:00
Pierre-Yves David
9f528702b6 bundle2: print debug information during bundling
The bundler class is now feed with an ui object and use it to transmit data
about the bundling process.
2014-03-18 19:07:10 -07:00
Pierre-Yves David
8f763dcc63 bundle2: force the first char of parameter to be an letter.
We need a case sensitive character to convey mandatory/advisory parameter
semantic in a later patches.
2014-03-18 18:56:08 -07:00
Pierre-Yves David
8e900f2ca1 bundle2: refuse empty parameter name
The bundle2 now raise value error when seeing invalid parameter names. The first
introduced rules is: no empty parameter.

The test extension is improve to properly abort when ValueError are encountered.
2014-03-18 18:40:31 -07:00
Pierre-Yves David
dbf034c8a1 bundle2: urlunquote stream parameter name and value during unbundling
Align to new escaping used during bundling.
2014-03-18 17:43:08 -07:00
Pierre-Yves David
a54bdce8f6 bundle2: urlquote stream parameter name and value
This introduces support for arbitrary characters in stream parameters name and
value.  The urlquote format has been chosen because it is:

- simple,
- standard,
- no-op on simple alphanumerical entry.
2014-03-18 17:38:11 -07:00
Pierre-Yves David
246773194a bundle2: support for unbundling parameter value
The unbundler now understand parameter value. introduced in the previous
changeset.
2014-03-18 16:12:33 -07:00
Pierre-Yves David
51dbd8dd60 bundle2: support for bundling parameter value
Parameter can now have a value. We use a `<name>=<value>` form inspired from
capabilities.

There is still no kind of escaping in the name or value, yet.
2014-03-18 16:05:06 -07:00
Pierre-Yves David
6b98362873 bundle2: clarify stream parameter design in the documentation
Stream level parameter have very restricted use case. Clarify why we chosen a
textual format and point that applicative data goes in applicative parts.
2014-03-20 13:18:34 -07:00
Pierre-Yves David
c9ee8e68ae bundle2: support for unbundling simple parameter
the unbundler now understand simple list of parameter.
2014-03-18 15:56:24 -07:00
Pierre-Yves David
d7d49ad3b9 bundle2: support bundling simple parameter
This changeset add bundling capacity for simple parameters, not value or any
special case are handled.
2014-03-19 14:52:03 -07:00
Pierre-Yves David
0a30072db3 bundle2: make sure the unbundler refuse non bundle2 stream
We now make use of the magic string at the beginning of the file.
2014-03-18 16:35:34 -07:00
Pierre-Yves David
111c1061ba bundle2: a very first version of bundle2 unbundler
This changeset introduce an unbundler class to match the bundle2 bundler. It is
currently able to unbundle an empty bundle2 only and will gain more feature at
the same pace than the bundler.

It also comes with its special extension command in test.
2014-03-18 14:28:42 -07:00
Pierre-Yves David
b5e3ef023e bundle2: very first version of a bundle2 bundler
This changeset is the very first of a long series. It create a new bundle2
module and add a simple class that generate and empty bundle2 container.

The module is documented with the current state of the implementation. For
information about the final goal you may want to consult the mercurial wiki
page:

    http://mercurial.selenic.com/wiki/BundleFormat2

The documentation of the module will be updated with later patches adding more and
more feature to the format.

This patches also introduce a test case. This test case build and use its own
small extension that use the new bundle2 module. Since the new format is unable
to do anything right now, we could not use real mercurial code to test it.
Moreover, some advanced feature of the bundle2 spec will not be used by core
mercurial at all. So we need to have them tested.
2014-03-18 14:00:50 -07:00