share extension#
share a common history between several working directories
The share extension introduces a new command `hg share` to create a new working directory. This is similar to `hg clone`, but doesn't involve copying or linking the storage of the repository. This allows working on different branches or changes in parallel without the associated cost in terms of disk space.
Note: destructive operations or extensions like `hg rollback` should be used with care as they can result in confusing problems.
Automatic Pooled Storage for Clones#
When this extension is active, `hg clone` can be configured to automatically share/pool storage across multiple clones. This mode effectively converts `hg clone` to `hg clone` + `hg share`. The benefit of using this mode is the automatic management of store paths and intelligent pooling of related repositories.
The following share. config options influence this feature:
share.poolFilesystem path where shared repository data will be stored. When defined, `hg clone` will automatically use shared repository storage instead of creating a store inside each clone.
share.poolnamingHow directory names in
share.poolare constructed."identity" means the name is derived from the first changeset in the repository. In this mode, different remotes share storage if their root/initial changeset is identical. In this mode, the local shared repository is an aggregate of all encountered remote repositories.
"remote" means the name is derived from the source repository's path or URL. In this mode, storage is only shared if the path or URL requested in the `hg clone` command matches exactly to a repository that was cloned before.
The default naming mode is "identity".
Sharing requirements and configs of source repository with shares:
By default creating a shared repository only enables sharing a common history and does not share requirements and configs between them. This may lead to problems in some cases, for example when you upgrade the storage format from one repository but does not set related configs in the shares.
Setting format.exp-share-safe = True enables sharing configs and requirements. This only applies to shares which are done after enabling the config option.
For enabling this in existing shares, enable the config option and reshare.
For resharing existing shares, make sure your working directory is clean and there are no untracked files, delete that share and create a new share.
Commands