| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 6 |
<meta name="generator" content="Docutils 0.21.2: https://docutils.sourceforge.io/" /> |
| 7 |
<title>share</title> |
| 8 |
<link rel="stylesheet" href="../style.css" type="text/css" /> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<div class="document" id="share"> |
| 12 |
<span id="ext-share"></span> |
| 13 |
<h1 class="title">share</h1> |
| 14 |
|
| 15 |
<div class="contents htmlonly topic" id="contents"> |
| 16 |
<p class="topic-title"><a class="reference internal" href="#top">Contents</a></p> |
| 17 |
<ul class="simple"> |
| 18 |
<li><a class="reference internal" href="#description" id="toc-entry-1">Description</a><ul> |
| 19 |
<li><a class="reference internal" href="#automatic-pooled-storage-for-clones" id="toc-entry-2">Automatic Pooled Storage for Clones</a></li> |
| 20 |
</ul> |
| 21 |
</li> |
| 22 |
<li><a class="reference internal" href="#commands" id="toc-entry-3">Commands</a><ul> |
| 23 |
<li><a class="reference internal" href="#repository-creation" id="toc-entry-4">Repository creation</a></li> |
| 24 |
<li><a class="reference internal" href="#repository-maintenance" id="toc-entry-5">Repository maintenance</a></li> |
| 25 |
</ul> |
| 26 |
</li> |
| 27 |
</ul> |
| 28 |
</div> |
| 29 |
<p>share a common history between several working directories</p> |
| 30 |
<div class="section" id="description"> |
| 31 |
<h1><a class="toc-backref" href="#contents">Description</a></h1> |
| 32 |
<p>The share extension introduces a new command <a class="reference external" href="hg-share.html"><tt class="docutils literal">hg share</tt></a> to create a new |
| 33 |
working directory. This is similar to <a class="reference external" href="hg-clone.html"><tt class="docutils literal">hg clone</tt></a>, but doesn't involve |
| 34 |
copying or linking the storage of the repository. This allows working on |
| 35 |
different branches or changes in parallel without the associated cost in |
| 36 |
terms of disk space.</p> |
| 37 |
<p>Note: destructive operations or extensions like <a class="reference external" href="hg-rollback.html"><tt class="docutils literal">hg rollback</tt></a> should be |
| 38 |
used with care as they can result in confusing problems.</p> |
| 39 |
<div class="section" id="automatic-pooled-storage-for-clones"> |
| 40 |
<h2><a class="toc-backref" href="#contents">Automatic Pooled Storage for Clones</a></h2> |
| 41 |
<p>When this extension is active, <a class="reference external" href="hg-clone.html"><tt class="docutils literal">hg clone</tt></a> can be configured to |
| 42 |
automatically share/pool storage across multiple clones. This |
| 43 |
mode effectively converts <a class="reference external" href="hg-clone.html"><tt class="docutils literal">hg clone</tt></a> to <a class="reference external" href="hg-clone.html"><tt class="docutils literal">hg clone</tt></a> + <a class="reference external" href="hg-share.html"><tt class="docutils literal">hg share</tt></a>. |
| 44 |
The benefit of using this mode is the automatic management of |
| 45 |
store paths and intelligent pooling of related repositories.</p> |
| 46 |
<p>The following <tt class="docutils literal">share.</tt> config options influence this feature:</p> |
| 47 |
<dl class="docutils"> |
| 48 |
<dt><tt class="docutils literal">share.pool</tt></dt> |
| 49 |
<dd>Filesystem path where shared repository data will be stored. When |
| 50 |
defined, <a class="reference external" href="hg-clone.html"><tt class="docutils literal">hg clone</tt></a> will automatically use shared repository |
| 51 |
storage instead of creating a store inside each clone.</dd> |
| 52 |
<dt><tt class="docutils literal">share.poolnaming</tt></dt> |
| 53 |
<dd><p class="first">How directory names in <tt class="docutils literal">share.pool</tt> are constructed.</p> |
| 54 |
<p>"identity" means the name is derived from the first changeset in the |
| 55 |
repository. In this mode, different remotes share storage if their |
| 56 |
root/initial changeset is identical. In this mode, the local shared |
| 57 |
repository is an aggregate of all encountered remote repositories.</p> |
| 58 |
<p>"remote" means the name is derived from the source repository's |
| 59 |
path or URL. In this mode, storage is only shared if the path or URL |
| 60 |
requested in the <a class="reference external" href="hg-clone.html"><tt class="docutils literal">hg clone</tt></a> command matches exactly to a repository |
| 61 |
that was cloned before.</p> |
| 62 |
<p class="last">The default naming mode is "identity".</p> |
| 63 |
</dd> |
| 64 |
</dl> |
| 65 |
<div class="verbose docutils container"> |
| 66 |
<p>Sharing requirements and configs of source repository with shares:</p> |
| 67 |
<p>By default creating a shared repository only enables sharing a common |
| 68 |
history and does not share requirements and configs between them. This |
| 69 |
may lead to problems in some cases, for example when you upgrade the |
| 70 |
storage format from one repository but does not set related configs |
| 71 |
in the shares.</p> |
| 72 |
<p>Setting <cite>format.exp-share-safe = True</cite> enables sharing configs and |
| 73 |
requirements. This only applies to shares which are done after enabling |
| 74 |
the config option.</p> |
| 75 |
<p>For enabling this in existing shares, enable the config option and reshare.</p> |
| 76 |
<p>For resharing existing shares, make sure your working directory is clean |
| 77 |
and there are no untracked files, delete that share and create a new share.</p> |
| 78 |
</div> |
| 79 |
</div> |
| 80 |
</div> |
| 81 |
<div class="section" id="commands"> |
| 82 |
<h1><a class="toc-backref" href="#contents">Commands</a></h1> |
| 83 |
<div class="section" id="repository-creation"> |
| 84 |
<h2><a class="toc-backref" href="#contents">Repository creation</a></h2> |
| 85 |
<div class="section" id="share-1"> |
| 86 |
<h3>share</h3> |
| 87 |
<p>create a new shared repository:</p> |
| 88 |
<pre class="literal-block"> |
| 89 |
hg share [-U] [-B] SOURCE [DEST] |
| 90 |
</pre> |
| 91 |
<p>Initialize a new repository and working directory that shares its |
| 92 |
history (and optionally bookmarks) with another repository.</p> |
| 93 |
<div class="admonition note"> |
| 94 |
<p class="first admonition-title">Note</p> |
| 95 |
<p class="last">using rollback or extensions that destroy/modify history (mq, |
| 96 |
rebase, etc.) can cause considerable confusion with shared |
| 97 |
clones. In particular, if two shared clones are both updated to |
| 98 |
the same changeset, and one of them destroys that changeset |
| 99 |
with rollback, the other clone will suddenly stop working: all |
| 100 |
operations will fail with "abort: working directory has unknown |
| 101 |
parent". The only known workaround is to use debugsetparents on |
| 102 |
the broken clone to reset it to a changeset that still exists.</p> |
| 103 |
</div> |
| 104 |
<p>Options:</p> |
| 105 |
<table class="docutils option-list" frame="void" rules="none"> |
| 106 |
<col class="option" /> |
| 107 |
<col class="description" /> |
| 108 |
<tbody valign="top"> |
| 109 |
<tr><td class="option-group"> |
| 110 |
<kbd><span class="option">-U</span>, <span class="option">--noupdate</span></kbd></td> |
| 111 |
<td>do not create a working directory</td></tr> |
| 112 |
<tr><td class="option-group" colspan="2"> |
| 113 |
<kbd><span class="option">-B</span>, <span class="option">--bookmarks</span></kbd></td> |
| 114 |
</tr> |
| 115 |
<tr><td> </td><td>also share bookmarks</td></tr> |
| 116 |
<tr><td class="option-group"> |
| 117 |
<kbd><span class="option">--relative</span></kbd></td> |
| 118 |
<td>point to source using a relative path</td></tr> |
| 119 |
</tbody> |
| 120 |
</table> |
| 121 |
</div> |
| 122 |
</div> |
| 123 |
<div class="section" id="repository-maintenance"> |
| 124 |
<h2><a class="toc-backref" href="#contents">Repository maintenance</a></h2> |
| 125 |
<div class="section" id="unshare"> |
| 126 |
<h3>unshare</h3> |
| 127 |
<p>convert a shared repository to a normal one:</p> |
| 128 |
<pre class="literal-block"> |
| 129 |
hg unshare |
| 130 |
</pre> |
| 131 |
<p>Copy the store data to the repo and remove the sharedpath data.</p> |
| 132 |
</div> |
| 133 |
</div> |
| 134 |
</div> |
| 135 |
</div> |
| 136 |
</body> |
| 137 |
</html> |