mercurial/help/bundlespec.txt
author Gregory Szorc <gregory.szorc@gmail.com>
Mon, 13 Nov 2017 21:48:35 -0800
changeset 35118 1fb0846ad792
parent 32573 01280ec5f840
permissions -rw-r--r--
bundle2: inline changegroup.readexactly() Profiling reveals this loop is pretty tight. Literally any function call elimination can make a big difference. This commit inlines the relatively trivial changegroup.readexactly() method inside the loop. The results with `hg perfbundleread` on a bundle of the Firefox repo speak for themselves: ! read(8k) ! wall 0.679730 comb 0.680000 user 0.140000 sys 0.540000 (best of 15) ! read(16k) ! wall 0.577228 comb 0.570000 user 0.080000 sys 0.490000 (best of 17) ! read(32k) ! wall 0.516060 comb 0.520000 user 0.040000 sys 0.480000 (best of 20) ! read(128k) ! wall 0.496378 comb 0.490000 user 0.010000 sys 0.480000 (best of 20) ! bundle2 iterparts() ! wall 3.460903 comb 3.460000 user 2.760000 sys 0.700000 (best of 3) ! wall 3.056811 comb 3.050000 user 2.340000 sys 0.710000 (best of 4) ! bundle2 iterparts() seekable ! wall 4.312722 comb 4.310000 user 3.480000 sys 0.830000 (best of 3) ! wall 4.007676 comb 4.000000 user 3.170000 sys 0.830000 (best of 3) ! bundle2 part seek() ! wall 6.754764 comb 6.740000 user 3.970000 sys 2.770000 (best of 3) ! wall 6.267110 comb 6.250000 user 3.480000 sys 2.770000 (best of 3) ! bundle2 part read(8k) ! wall 3.668004 comb 3.660000 user 2.960000 sys 0.700000 (best of 3) ! wall 3.404164 comb 3.400000 user 2.650000 sys 0.750000 (best of 3) ! bundle2 part read(16k) ! wall 3.489196 comb 3.480000 user 2.750000 sys 0.730000 (best of 3) ! wall 3.197972 comb 3.200000 user 2.490000 sys 0.710000 (best of 4) ! bundle2 part read(32k) ! wall 3.388569 comb 3.380000 user 2.640000 sys 0.740000 (best of 3) ! wall 3.060557 comb 3.060000 user 2.340000 sys 0.720000 (best of 4) ! bundle2 part read(128k) ! wall 3.276415 comb 3.270000 user 2.560000 sys 0.710000 (best of 4) ! wall 2.952209 comb 2.950000 user 2.230000 sys 0.720000 (best of 4) Differential Revision: https://phab.mercurial-scm.org/D1392

Mercurial supports generating standalone "bundle" files that hold repository
data. These "bundles" are typically saved locally and used later or exchanged
between different repositories, possibly on different machines. Example
commands using bundles are :hg:`bundle` and :hg:`unbundle`.

Generation of bundle files is controlled by a "bundle specification"
("bundlespec") string. This string tells the bundle generation process how
to create the bundle.

A "bundlespec" string is composed of the following elements:

type
    A string denoting the bundle format to use.

compression
    Denotes the compression engine to use compressing the raw bundle data.

parameters
    Arbitrary key-value parameters to further control bundle generation.

A "bundlespec" string has the following formats:

<type>
    The literal bundle format string is used.

<compression>-<type>
    The compression engine and format are delimited by a hyphen (``-``).

Optional parameters follow the ``<type>``. Parameters are URI escaped
``key=value`` pairs. Each pair is delimited by a semicolon (``;``). The
first parameter begins after a ``;`` immediately following the ``<type>``
value.

Available Types
===============

The following bundle <type> strings are available:

v1
    Produces a legacy "changegroup" version 1 bundle.

    This format is compatible with nearly all Mercurial clients because it is
    the oldest. However, it has some limitations, which is why it is no longer
    the default for new repositories.

    ``v1`` bundles can be used with modern repositories using the "generaldelta"
    storage format. However, it may take longer to produce the bundle and the
    resulting bundle may be significantly larger than a ``v2`` bundle.

    ``v1`` bundles can only use the ``gzip``, ``bzip2``, and ``none`` compression
    formats.

v2
    Produces a version 2 bundle.

    Version 2 bundles are an extensible format that can store additional
    repository data (such as bookmarks and phases information) and they can
    store data more efficiently, resulting in smaller bundles.

    Version 2 bundles can also use modern compression engines, such as
    ``zstd``, making them faster to compress and often smaller.

Available Compression Engines
=============================

The following bundle <compression> engines can be used:

.. bundlecompressionmarker

Examples
========

``v2``
    Produce a ``v2`` bundle using default options, including compression.

``none-v1``
    Produce a ``v1`` bundle with no compression.

``zstd-v2``
    Produce a ``v2`` bundle with zstandard compression using default
    settings.

``zstd-v1``
    This errors because ``zstd`` is not supported for ``v1`` types.