| 1 |
.TH HG CLONE "" "" "" |
| 2 |
.SH NAME |
| 3 |
hg clone \- make a copy of an existing repository |
| 4 |
.\" Man page generated from reStructuredText. |
| 5 |
. |
| 6 |
.SH SYNOPSIS |
| 7 |
.sp |
| 8 |
.nf |
| 9 |
.ft C |
| 10 |
hg clone [OPTION]... SOURCE [DEST] |
| 11 |
.ft P |
| 12 |
.fi |
| 13 |
.SH DESCRIPTION |
| 14 |
.sp |
| 15 |
Create a copy of an existing repository in a new directory. |
| 16 |
.sp |
| 17 |
If no destination directory name is specified, it defaults to the |
| 18 |
basename of the source. |
| 19 |
.sp |
| 20 |
The location of the source is added to the new repository\(aqs |
| 21 |
\fB.hg/hgrc\fP file, as the default to be used for future pulls. |
| 22 |
.sp |
| 23 |
Only local paths and \fBssh://\fP URLs are supported as |
| 24 |
destinations. For \fBssh://\fP destinations, no working directory or |
| 25 |
\fB.hg/hgrc\fP will be created on the remote side. |
| 26 |
.sp |
| 27 |
If the source repository has a bookmark called \(aq@\(aq set, that |
| 28 |
revision will be checked out in the new repository by default. |
| 29 |
.sp |
| 30 |
To check out a particular version, use \-u/\-\-update, or |
| 31 |
\-U/\-\-noupdate to create a clone with no working directory. |
| 32 |
.sp |
| 33 |
To pull only a subset of changesets, specify one or more revisions |
| 34 |
identifiers with \-r/\-\-rev or branches with \-b/\-\-branch. The |
| 35 |
resulting clone will contain only the specified changesets and |
| 36 |
their ancestors. These options (or \(aqclone src#rev dest\(aq) imply |
| 37 |
\-\-pull, even for local source repositories. |
| 38 |
.sp |
| 39 |
In normal clone mode, the remote normalizes repository data into a common |
| 40 |
exchange format and the receiving end translates this data into its local |
| 41 |
storage format. \-\-stream activates a different clone mode that essentially |
| 42 |
copies repository files from the remote with minimal data processing. This |
| 43 |
significantly reduces the CPU cost of a clone both remotely and locally. |
| 44 |
However, it often increases the transferred data size by 30\-40%. This can |
| 45 |
result in substantially faster clones where I/O throughput is plentiful, |
| 46 |
especially for larger repositories. A side\-effect of \-\-stream clones is |
| 47 |
that storage settings and requirements on the remote are applied locally: |
| 48 |
a modern client may inherit legacy or inefficient storage used by the |
| 49 |
remote or a legacy Mercurial client may not be able to clone from a |
| 50 |
modern Mercurial remote. |
| 51 |
.IP Note |
| 52 |
. |
| 53 |
Specifying a tag will include the tagged changeset but not the |
| 54 |
changeset containing the tag. |
| 55 |
.RE |
| 56 |
.sp |
| 57 |
For efficiency, hardlinks are used for cloning whenever the |
| 58 |
source and destination are on the same filesystem (note this |
| 59 |
applies only to the repository data, not to the working |
| 60 |
directory). Some filesystems, such as AFS, implement hardlinking |
| 61 |
incorrectly, but do not report errors. In these cases, use the |
| 62 |
\-\-pull option to avoid hardlinking. |
| 63 |
.sp |
| 64 |
Mercurial will update the working directory to the first applicable |
| 65 |
revision from this list: |
| 66 |
.INDENT 0.0 |
| 67 |
.IP a. 3 |
| 68 |
. |
| 69 |
null if \-U or the source repository has no changesets |
| 70 |
.IP b. 3 |
| 71 |
. |
| 72 |
if \-u . and the source repository is local, the first parent of |
| 73 |
the source repository\(aqs working directory |
| 74 |
.IP c. 3 |
| 75 |
. |
| 76 |
the changeset specified with \-u (if a branch name, this means the |
| 77 |
latest head of that branch) |
| 78 |
.IP d. 3 |
| 79 |
. |
| 80 |
the changeset specified with \-r |
| 81 |
.IP e. 3 |
| 82 |
. |
| 83 |
the tipmost head specified with \-b |
| 84 |
.IP f. 3 |
| 85 |
. |
| 86 |
the tipmost head specified with the url#branch source syntax |
| 87 |
.IP g. 3 |
| 88 |
. |
| 89 |
the revision marked with the \(aq@\(aq bookmark, if present |
| 90 |
.IP h. 3 |
| 91 |
. |
| 92 |
the tipmost head of the default branch |
| 93 |
.IP i. 3 |
| 94 |
. |
| 95 |
tip |
| 96 |
.UNINDENT |
| 97 |
.sp |
| 98 |
When cloning from servers that support it, Mercurial may fetch |
| 99 |
pre\-generated data from a server\-advertised URL or inline from the |
| 100 |
same stream. When this is done, hooks operating on incoming changesets |
| 101 |
and changegroups may fire more than once, once for each pre\-generated |
| 102 |
bundle and as well as for any additional remaining data. In addition, |
| 103 |
if an error occurs, the repository may be rolled back to a partial |
| 104 |
clone. This behavior may change in future releases. |
| 105 |
See \%\fBhg help \-e clonebundles\fP\: for more. |
| 106 |
.sp |
| 107 |
Examples: |
| 108 |
.INDENT 0.0 |
| 109 |
.IP \(bu 2 |
| 110 |
. |
| 111 |
clone a remote repository to a new directory named hg/: |
| 112 |
.sp |
| 113 |
.nf |
| 114 |
.ft C |
| 115 |
hg clone https://www.mercurial\-scm.org/repo/hg/ |
| 116 |
.ft P |
| 117 |
.fi |
| 118 |
.IP \(bu 2 |
| 119 |
. |
| 120 |
create a lightweight local clone: |
| 121 |
.sp |
| 122 |
.nf |
| 123 |
.ft C |
| 124 |
hg clone project/ project\-feature/ |
| 125 |
.ft P |
| 126 |
.fi |
| 127 |
.IP \(bu 2 |
| 128 |
. |
| 129 |
clone from an absolute path on an ssh server (note double\-slash): |
| 130 |
.sp |
| 131 |
.nf |
| 132 |
.ft C |
| 133 |
hg clone ssh://user@server//home/projects/alpha/ |
| 134 |
.ft P |
| 135 |
.fi |
| 136 |
.IP \(bu 2 |
| 137 |
. |
| 138 |
do a streaming clone while checking out a specified version: |
| 139 |
.sp |
| 140 |
.nf |
| 141 |
.ft C |
| 142 |
hg clone \-\-stream http://server/repo \-u 1.5 |
| 143 |
.ft P |
| 144 |
.fi |
| 145 |
.IP \(bu 2 |
| 146 |
. |
| 147 |
create a repository without changesets after a particular revision: |
| 148 |
.sp |
| 149 |
.nf |
| 150 |
.ft C |
| 151 |
hg clone \-r 04e544 experimental/ good/ |
| 152 |
.ft P |
| 153 |
.fi |
| 154 |
.IP \(bu 2 |
| 155 |
. |
| 156 |
clone (and track) a particular named branch: |
| 157 |
.sp |
| 158 |
.nf |
| 159 |
.ft C |
| 160 |
hg clone https://www.mercurial\-scm.org/repo/hg/#stable |
| 161 |
.ft P |
| 162 |
.fi |
| 163 |
.UNINDENT |
| 164 |
.sp |
| 165 |
See \%\fBhg help urls\fP\: for details on specifying URLs. |
| 166 |
.sp |
| 167 |
Returns 0 on success. |
| 168 |
.SH OPTIONS |
| 169 |
.INDENT 0.0 |
| 170 |
.TP |
| 171 |
.B \-U, \-\-noupdate |
| 172 |
. |
| 173 |
the clone will include an empty working directory (only a repository) |
| 174 |
.TP |
| 175 |
.BI \-u, \-\-updaterev \ <REV> |
| 176 |
. |
| 177 |
revision, tag, or branch to check out |
| 178 |
.TP |
| 179 |
.BI \-r, \-\-rev \ <REV[+]> |
| 180 |
. |
| 181 |
do not clone everything, but include this changeset and its ancestors |
| 182 |
.TP |
| 183 |
.BI \-b, \-\-branch \ <BRANCH[+]> |
| 184 |
. |
| 185 |
do not clone everything, but include this branch\(aqs changesets and their ancestors |
| 186 |
.TP |
| 187 |
.B \-\-pull |
| 188 |
. |
| 189 |
use pull protocol to copy metadata |
| 190 |
.TP |
| 191 |
.B \-\-uncompressed |
| 192 |
. |
| 193 |
an alias to \-\-stream (DEPRECATED) |
| 194 |
.TP |
| 195 |
.B \-\-stream |
| 196 |
. |
| 197 |
clone with minimal data processing |
| 198 |
.TP |
| 199 |
.BI \-e, \-\-ssh \ <CMD> |
| 200 |
. |
| 201 |
specify ssh command to use |
| 202 |
.TP |
| 203 |
.BI \-\-remotecmd \ <CMD> |
| 204 |
. |
| 205 |
specify hg command to run on the remote side |
| 206 |
.TP |
| 207 |
.B \-\-insecure |
| 208 |
. |
| 209 |
do not verify server certificate (ignoring web.cacerts config) |
| 210 |
.UNINDENT |
| 211 |
.sp |
| 212 |
[+] marked option can be specified multiple times |
| 213 |
.\" Generated by docutils manpage writer. |
| 214 |
.\" |
| 215 |
. |