Differences between revisions 7 and 8
Revision 7 as of 2009-09-05 11:15:28
Size: 2809
Editor: JoelRosdahl
Comment:
Revision 8 as of 2009-09-06 21:34:01
Size: 2869
Editor: youshe
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

(Other Languages : [[FrenchShareExtension|Français]])

Share Extension

(Other Languages : Français)

This extension is distributed with Mercurial 1.3 and later

Author: Matt Mackall

0.1. Overview

This extension allows for sharing the 'store' (ie history) portion of a repository with one or more other locally-accessible repositories while maintaining an independent working directory state. This can make creating a working directory for a branch faster and less expensive. It can also be used for a simple collaboration mode as all commits immediately appear in the history of sharing repositories without the need for push or pull.

$ hg share project project-branch
updating working directory
1040 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg share /path/to/network/project  # creates 'project'
5298 files updated, 0 files merged, 0 files removed, 0 files unresolved

0.2. Caveats

Note that an operation performed in any shared repository will immediately affect all of its peers. In effect, it is as though commit instantly and atomically pushes to the repository's parent and all of its siblings (i.e. any other shared clones of the same parent). But, of course, there is no push: commit simply writes in the .hg/store directory shared by all peers.

In particular, operations that destroy or modify history -- strip, rebase, etc. -- will also destroy or modify history in all of the shared clone's peers. For example, if you accidentally strip too many revisions in a shared clone, poof! you've just stripped those revisions from all of its peers. If you are experimenting with destructive operations, you should make a full clone and play around in it first.

Also, think carefully about the interaction between Mercurial Queues (MqExtension). Because .hg/patches is not shared between repositories, it's possible for different shared repositories to have independent patch queues. But MQ commands like qpush and qpop create and destroy history, so pushing/popping patches will affect all of the shared clone's peers. It's probably not a good idea to mix MQ and shared clones; if you do so, you should definitely avoid pushing/popping patches in one clone while another clone has patches applied.

In short, this is a small modification that deeply affects Mercurial's usual "clones are independent" contract. Make sure you understand what it does before you shoot yourself in the foot!

0.3. Configuration

Configure your .hgrc to enable the extension by adding following lines:

[extensions]
share =

0.4. See also


CategoryExtension

ShareExtension (last edited 2022-08-21 00:49:52 by JeffCutsinger)