view mercurial/help/bundlespec.txt @ 40626:87a872555e90

revlog: detect incomplete revlog reads _readsegment() is supposed to return N bytes of revlog revision data starting at a file offset. Surprisingly, its behavior before this patch never verified that it actually read and returned N bytes! Instead, it would perform the read(), then return whatever data was available. And even more surprisingly, nothing in the call chain appears to have been validating that it received all the data it was expecting. This behavior could lead to partial or incomplete revision chunks being operated on. This could result in e.g. cached deltas being applied against incomplete base revisions. The delta application process would happily perform this operation. Only hash verification would detect the corruption and save us. This commit changes the behavior of raw revlog reading to validate that we actually read() the number of bytes that were requested. We will raise a more specific error faster, rather than possibly have it go undetected or manifest later in the call stack, at delta application or hash verification. Differential Revision: https://phab.mercurial-scm.org/D5266
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 13 Nov 2018 12:30:59 -0800
parents 01280ec5f840
children
line wrap: on
line source

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.