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:
A "bundlespec" string has the following formats:
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.
The following bundle <type> strings are available:
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.
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.
The following bundle <compression> engines can be used:
All Mercurial clients should support this format.
This engine will likely produce smaller bundles than "gzip" but will be significantly slower, both during compression and decompression.
If available, the "zstd" engine can yield similar or better compression at much higher speeds.
All Mercurial clients should support this format. The compression algorithm strikes a reasonable balance between compression ratio and size.
Use this compression engine to explicitly disable compression.
Only supported by Mercurial 4.1 and newer clients.
With the default settings, zstd compression is both faster and yields better compression than "gzip". It also frequently yields better compression than "bzip2" while operating at much higher speeds.
If this engine is available and backwards compatibility is not a concern, it is likely the best available engine.