streamclone: support for producing and consuming stream clone bundles
Up to this point, stream clones only existed as a dynamically generated
data format produced and consumed during streaming clones. In order to
support this efficient cloning format with the clone bundles feature, we
need a more formal, on disk representation of the streaming clone data.
This patch introduces a new "bundle" type for streaming clones. Unlike
existing bundles, it does not contain changegroup data. It does,
however, share the same concepts like the 4 byte header which identifies
the type of data that follows and the 2 byte abbreviation for
compression types (of which only "UN" is currently supported).
The new bundle format is essentially the existing stream clone version 1
data format with some headers at the beginning.
Content negotiation at stream clone request time checked for repository
format/requirements compatibility before initiating a stream clone. We
can't do active content negotiation when using clone bundles. So, we put
this set of requirements inside the payload so consumers have a built-in
mechanism for checking compatibility before reading and applying lots of
data. Of course, we will also advertise this requirements set in clone
bundles. But that's for another patch.
We currently don't have a mechanism to produce and consume this new
bundle format. This will be implemented in upcoming patches.
It's worth noting that if a legacy client attempts to `hg unbundle` a
stream clone bundle (with the "HGS1" header), it will abort with:
"unknown bundle version S1," which seems appropriate.
$ hg debugextensions
$ debugpath=`pwd`/extwithoutinfos.py
$ cat > extwithoutinfos.py <<EOF
> EOF
$ cat >> $HGRCPATH <<EOF
> [extensions]
> color=
> histedit=
> patchbomb=
> rebase=
> mq=
> ext1 = $debugpath
> EOF
$ hg debugextensions
color
ext1 (untested!)
histedit
mq
patchbomb
rebase
$ hg debugextensions -v
color
location: */hgext/color.pyc (glob)
tested with: internal
ext1
location: */extwithoutinfos.pyc (glob)
histedit
location: */hgext/histedit.pyc (glob)
tested with: internal
mq
location: */hgext/mq.pyc (glob)
tested with: internal
patchbomb
location: */hgext/patchbomb.pyc (glob)
tested with: internal
rebase
location: */hgext/rebase.pyc (glob)
tested with: internal
$ hg debugextensions -Tjson | sed 's|\\\\|/|g'
[
{
"buglink": "",
"name": "color",
"source": "*/hgext/color.pyc", (glob)
"testedwith": "internal"
},
{
"buglink": "",
"name": "ext1",
"source": "*/extwithoutinfos.pyc", (glob)
"testedwith": ""
},
{
"buglink": "",
"name": "histedit",
"source": "*/hgext/histedit.pyc", (glob)
"testedwith": "internal"
},
{
"buglink": "",
"name": "mq",
"source": "*/hgext/mq.pyc", (glob)
"testedwith": "internal"
},
{
"buglink": "",
"name": "patchbomb",
"source": "*/hgext/patchbomb.pyc", (glob)
"testedwith": "internal"
},
{
"buglink": "",
"name": "rebase",
"source": "*/hgext/rebase.pyc", (glob)
"testedwith": "internal"
}
]