author | mpm@selenic.com |
Tue, 28 Jun 2005 02:03:25 -0800 | |
changeset 501 | 7ea1c88792bf |
parent 498 | 8cf3999b3d03 |
child 505 | dc1f735dfaac |
permissions | -rw-r--r-- |
177 | 1 |
HG(1) |
2 |
===== |
|
3 |
Matt Mackall <mpm@selenic.com> |
|
4 |
||
5 |
NAME |
|
6 |
---- |
|
438 | 7 |
hg - Mercurial source code management system |
177 | 8 |
|
9 |
SYNOPSIS |
|
10 |
-------- |
|
11 |
'hg' [-v -d -q -y] <command> [command options] [files] |
|
12 |
||
13 |
DESCRIPTION |
|
14 |
----------- |
|
15 |
The hg(1) command provides a command line interface to the Mercurial system. |
|
16 |
||
17 |
OPTIONS |
|
18 |
------- |
|
438 | 19 |
|
177 | 20 |
--debug, -d:: |
21 |
enable debugging output |
|
22 |
||
23 |
--quiet, -q:: |
|
24 |
suppress output |
|
25 |
||
26 |
--verbose, -v:: |
|
27 |
enable additional output |
|
28 |
||
29 |
--noninteractive, -y:: |
|
30 |
do not prompt, assume 'yes' for any required answers |
|
31 |
||
32 |
COMMAND ELEMENTS |
|
33 |
---------------- |
|
34 |
||
35 |
files ...:: |
|
36 |
indicates one or more filename or relative path filenames |
|
37 |
||
38 |
path:: |
|
39 |
indicates a path on the local machine |
|
40 |
||
478
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
41 |
revision:: |
438 | 42 |
indicates a changeset which can be specified as a changeset revision |
43 |
number, a tag, or a unique substring of the changeset hash value |
|
177 | 44 |
|
45 |
repository path:: |
|
498 | 46 |
either the pathname of a local repository or the URI of a remote |
181
038e4d8602bd
updated for .hgpaths and http/old-http protocol name change
jake@edge2.net
parents:
177
diff
changeset
|
47 |
repository. There are two available URI protocols, http:// which is |
478
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
48 |
fast and the old-http:// protocol which is much slower but does not |
438 | 49 |
require a special server on the web host. |
177 | 50 |
|
51 |
COMMANDS |
|
52 |
-------- |
|
438 | 53 |
|
177 | 54 |
add [files ...]:: |
497 | 55 |
Schedule files to be version controlled and added to the repository. |
56 |
||
498 | 57 |
The files will be added to the repository at the next commit. |
177 | 58 |
|
59 |
addremove:: |
|
497 | 60 |
Add all new files and remove all missing files from the repository. |
61 |
||
62 |
New files are ignored if they match any of the patterns in .hgignore. As |
|
498 | 63 |
with add, these changes take effect at the next commit. |
177 | 64 |
|
438 | 65 |
annotate [-r <rev> -u -n -c] [files ...]:: |
497 | 66 |
List changes in files, showing the revision id responsible for each line |
67 |
||
68 |
This command is useful to discover who did a change or when a change took |
|
69 |
place. |
|
70 |
||
438 | 71 |
options: |
72 |
-r, --revision <rev> annotate the specified revision |
|
73 |
-u, --user list the author |
|
74 |
-c, --changeset list the changeset |
|
75 |
-n, --number list the revision number (default) |
|
177 | 76 |
|
438 | 77 |
cat <file> [revision]:: |
497 | 78 |
Output to stdout the given revision for the specified file. |
79 |
||
498 | 80 |
If no revision is given then the tip is used. |
177 | 81 |
|
485 | 82 |
clone [-U] <source> [dest]:: |
497 | 83 |
Create a copy of an existing repository in a new directory. |
84 |
||
498 | 85 |
If the destination directory is specified but doesn't exist, it is |
497 | 86 |
created. If no destination directory is specified, it defaults to the |
87 |
current directory. |
|
88 |
||
498 | 89 |
The source is added to the new repository's .hg/hgrc file to be used in |
497 | 90 |
future pulls. |
91 |
||
498 | 92 |
For efficiency, hardlinks are used for cloning whenever the |
93 |
source and destination are on the same filesystem. |
|
497 | 94 |
|
95 |
options: |
|
96 |
-U, --no-update do not update the new working directory |
|
97 |
||
98 |
commit [-A -t -l <file> -t <text> -u <user> -d <datecode>] [files...]:: |
|
498 | 99 |
Commit changes to the given files into the repository. |
497 | 100 |
|
498 | 101 |
If a list of files is omitted, all changes reported by "hg status" |
102 |
will be commited. |
|
497 | 103 |
|
498 | 104 |
The HGEDITOR or EDITOR environment variables are used to start an |
105 |
editor to add a commit comment. |
|
497 | 106 |
|
107 |
Options: |
|
108 |
||
109 |
-A, --addremove run addremove during commit |
|
110 |
-t, --text <text> use <text> as commit message |
|
111 |
-l, --logfile <file> show the commit message for the given file |
|
112 |
-d, --date <datecode> record datecode as commit date |
|
113 |
-u, --user <user> record user as commiter |
|
114 |
||
115 |
aliases: ci |
|
116 |
||
117 |
copy <source> <dest>:: |
|
118 |
Mark <dest> file as a copy or rename of a <source> one |
|
119 |
||
120 |
This command takes effect for the next commit. |
|
121 |
||
122 |
diff [-r revision] [-r revision] [files ...]:: |
|
123 |
Show differences between revisions for the specified files. |
|
124 |
||
125 |
Differences between files are shown using the unified diff format. |
|
126 |
||
498 | 127 |
When two revision arguments are given, then changes are shown |
128 |
between those revisions. If only one revision is specified then |
|
129 |
that revision is compared to the working directory, and, when no |
|
130 |
revisions are specified, the working directory files are compared |
|
131 |
to its parent. |
|
497 | 132 |
|
133 |
export [revision]:: |
|
134 |
Print the changeset header and diffs for a particular revision. |
|
135 |
||
136 |
The information shown in the changeset header is: author, changeset hash, |
|
137 |
parent and commit comment. |
|
138 |
||
139 |
forget [files]:: |
|
140 |
Undo an 'hg add' scheduled for the next commit. |
|
141 |
||
142 |
heads:: |
|
143 |
Show all repository head changesets. |
|
144 |
||
498 | 145 |
Repository "heads" are changesets that don't have children |
146 |
changesets. They are where development generally takes place and |
|
147 |
are the usual targets for update and merge operations. |
|
497 | 148 |
|
149 |
history:: |
|
150 |
Print a log of the revision history of the repository. |
|
151 |
||
498 | 152 |
By default this command outputs: changeset id and hash, tags, |
153 |
parents, user, date and time, and a summary for each commit. The |
|
154 |
-v switch adds some more detail, such as changed files, manifest |
|
497 | 155 |
hashes or message signatures. |
156 |
||
157 |
To display the history of a given file, see the log command. |
|
158 |
||
159 |
identify:: |
|
160 |
Print a short summary of the current state of the repo. |
|
161 |
||
162 |
This summary identifies the repository state using one or two parent |
|
163 |
hash identifiers, followed by a "+" if there are uncommitted changes |
|
164 |
in the working directory, followed by a list of tags for this revision. |
|
165 |
||
166 |
aliases: id |
|
167 |
||
168 |
import [-p <n> -b <base> -q] <patches>:: |
|
169 |
Import a list of patches and commit them individually. |
|
170 |
||
171 |
options: |
|
172 |
-p, --strip <n> directory strip option for patch. This has the same |
|
173 |
meaning as the correnponding patch option |
|
174 |
-b <path> base directory to read patches from |
|
175 |
||
176 |
aliases: patch |
|
177 |
||
496 | 178 |
init:: |
179 |
Initialize a new repository in the current directory. |
|
177 | 180 |
|
181 |
log <file>:: |
|
438 | 182 |
Print the revision history of the specified file. |
177 | 183 |
|
497 | 184 |
To display the revision history for the whole repository, use the history |
185 |
command. |
|
186 |
||
438 | 187 |
manifest [revision]:: |
497 | 188 |
Print a list of version controlled files for the given revision. |
189 |
||
190 |
The manifest is the list of files being version controlled. If no revision |
|
191 |
is given then the tip is used. |
|
438 | 192 |
|
193 |
parents:: |
|
194 |
Print the working directory's parent revisions. |
|
195 |
||
196 |
pull <repository path>:: |
|
498 | 197 |
Pull changes from a remote repository to a local one. |
497 | 198 |
|
498 | 199 |
This finds all changes from the repository at the specified path |
200 |
or URL and adds them to the local repository. By default, this |
|
201 |
does not update the copy of the project in the working directory. |
|
438 | 202 |
|
203 |
options: |
|
204 |
-u, --update update the working directory to tip after pull |
|
205 |
||
206 |
push <destination>:: |
|
497 | 207 |
Push changes from the local repository to the given destination. |
208 |
||
498 | 209 |
This is the symmetrical operation for pull. It helps to move |
210 |
changes from the current repository to a different one. If the |
|
211 |
destination is local this is identical to a pull in that directory |
|
212 |
from the current one. |
|
438 | 213 |
|
214 |
The other currently available push method is SSH. This requires an |
|
215 |
accessible shell account on the destination machine and a copy of |
|
216 |
hg in the remote path. Destinations are specified in the following |
|
217 |
form: |
|
218 |
||
219 |
ssh://[user@]host[:port]/path |
|
220 |
||
221 |
rawcommit [-p -d -u -F -t -l]:: |
|
497 | 222 |
Lowlevel commit, for use in helper scripts. |
223 |
||
224 |
This command is not intended to be used by normal users, as it is |
|
225 |
primarily useful for importing from other SCMs. |
|
177 | 226 |
|
196
48827121af7e
add export, recover, and undo to the man page
jake@edge2.net
parents:
182
diff
changeset
|
227 |
recover:: |
497 | 228 |
Recover from an interrupted commit or pull. |
229 |
||
230 |
This command tries to fix the repository status after an interrupted |
|
231 |
operation. It should only be necessary when Mercurial suggests it. |
|
196
48827121af7e
add export, recover, and undo to the man page
jake@edge2.net
parents:
182
diff
changeset
|
232 |
|
177 | 233 |
remove [files ...]:: |
497 | 234 |
Schedule the indicated files for removal from the repository. |
235 |
||
498 | 236 |
This command shedules the files to be removed at the next commit. |
237 |
This only removes files from the current branch, not from the |
|
238 |
entire project history. |
|
478
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
239 |
|
438 | 240 |
aliases: rm |
177 | 241 |
|
478
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
242 |
root:: |
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
243 |
Print the root directory of the current repository. |
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
244 |
|
177 | 245 |
serve [-a addr -n name -p port -t templatedir]:: |
438 | 246 |
Start a local HTTP repository browser and pull server. |
247 |
||
248 |
options: |
|
249 |
-a, --address <addr> address to use |
|
250 |
-p, --port <n> port to use (default: 8000) |
|
251 |
-n, --name <name> name to show in web pages (default: working dir) |
|
252 |
-t, --templatedir <path> web templates to use |
|
177 | 253 |
|
254 |
status:: |
|
438 | 255 |
Show changed files in the working directory. |
256 |
||
497 | 257 |
The codes used to show the status of files are: |
258 |
||
438 | 259 |
C = changed |
260 |
A = added |
|
261 |
R = removed |
|
262 |
? = not tracked |
|
263 |
||
264 |
tag [-t <text> -d <datecode> -u <user>] <name> [revision]:: |
|
497 | 265 |
Name a particular revision using <name>. |
266 |
||
267 |
Tags are used to name particular revisions of the repository and are |
|
268 |
very useful to compare different revision, to go back to significant |
|
498 | 269 |
earlier versions or to mark branch points as releases, etc. |
497 | 270 |
|
498 | 271 |
If no revision is given, the tip is used. |
438 | 272 |
|
498 | 273 |
To facilitate version control, distribution, and merging of tags, |
274 |
they are stored as a file named ".hgtags" which is managed |
|
275 |
similarly to other project files and can be hand-edited if |
|
276 |
necessary. |
|
277 |
||
438 | 278 |
options: |
279 |
-t, --text <text> message for tag commit log entry |
|
280 |
-d, --date <datecode> datecode for commit |
|
281 |
-u, --user <user> user for commit |
|
177 | 282 |
|
498 | 283 |
Note: Mercurial also has support for "local tags" that are not |
284 |
version-controlled or distributed which are stored in the .hg/hgrc |
|
285 |
file. |
|
286 |
||
177 | 287 |
tags:: |
478
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
288 |
List the repository tags. |
438 | 289 |
|
498 | 290 |
This lists both regular and local tags. |
497 | 291 |
|
438 | 292 |
tip:: |
478
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
293 |
Show the tip revision. |
177 | 294 |
|
196
48827121af7e
add export, recover, and undo to the man page
jake@edge2.net
parents:
182
diff
changeset
|
295 |
undo:: |
438 | 296 |
Undo the last commit or pull transaction. |
297 |
||
298 |
update [-m -C] [revision]:: |
|
498 | 299 |
Update the working directory to the specified revision. |
438 | 300 |
|
498 | 301 |
By default, update will refuse to run if doing so would require |
302 |
merging or discarding local changes. |
|
303 |
||
304 |
With the -m option, a merge will be performed. |
|
305 |
||
306 |
With the -C option, local changes will be lost. |
|
497 | 307 |
|
438 | 308 |
options: |
309 |
-m, --merge allow merging of branches |
|
310 |
-C, --clean overwrite locally modified files |
|
311 |
||
312 |
aliases: up checkout co |
|
313 |
||
314 |
verify:: |
|
315 |
Verify the integrity of the current repository. |
|
316 |
||
317 |
This will perform an extensive check of the repository's |
|
318 |
integrity, validating the hashes and checksums of each entry in |
|
319 |
the changelog, manifest, and tracked files, as well as the |
|
320 |
integrity of their crosslinks and indices. |
|
321 |
||
196
48827121af7e
add export, recover, and undo to the man page
jake@edge2.net
parents:
182
diff
changeset
|
322 |
|
177 | 323 |
ENVIRONMENT VARIABLES |
324 |
--------------------- |
|
438 | 325 |
|
478
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
326 |
HGEDITOR:: |
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
327 |
This is the name of the editor to use when committing. Defaults to the |
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
328 |
value of EDITOR. |
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
329 |
|
177 | 330 |
HGMERGE:: |
498 | 331 |
An executable to use for resolving merge conflicts. The program |
438 | 332 |
will be executed with three arguments: local file, remote file, |
333 |
ancestor file. |
|
334 |
||
335 |
The default program is "hgmerge", which is a shell script provided |
|
336 |
by Mercurial with some sensible defaults. |
|
177 | 337 |
|
338 |
HGUSER:: |
|
438 | 339 |
This is the string used for the author of a commit. |
177 | 340 |
|
341 |
EMAIL:: |
|
438 | 342 |
If HGUSER is not set, this will be used as the author for a commit. |
177 | 343 |
|
344 |
LOGNAME:: |
|
478
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
345 |
If neither HGUSER nor EMAIL is set, LOGNAME will be used (with |
438 | 346 |
'@hostname' appended) as the author value for a commit. |
177 | 347 |
|
348 |
EDITOR:: |
|
478
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
349 |
This is the name of the editor used in the hgmerge script. It will be |
498 | 350 |
used for commit messages if HGEDITOR isn't set. Defaults to 'vi'. |
438 | 351 |
|
352 |
PYTHONPATH:: |
|
353 |
This is used by Python to find imported modules and may need to be set |
|
354 |
appropriately if Mercurial is not installed system-wide. |
|
177 | 355 |
|
356 |
FILES |
|
357 |
----- |
|
358 |
.hgignore:: |
|
438 | 359 |
This file contains regular expressions (one per line) that describe file |
478
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
360 |
names that should be ignored by hg. |
177 | 361 |
|
362 |
.hgtags:: |
|
438 | 363 |
This file contains changeset hash values and text tag names (one of each |
177 | 364 |
seperated by spaces) that correspond to tagged versions of the repository |
365 |
contents. |
|
366 |
||
438 | 367 |
$HOME/.hgrc, .hg/hgrc:: |
368 |
This file contains defaults and configuration. Values in .hg/hgrc |
|
369 |
override those in .hgrc. |
|
370 |
||
371 |
NAMED REPOSITORIES |
|
372 |
------------------ |
|
373 |
||
487 | 374 |
To give symbolic names to a repository, create a section in .hgrc |
375 |
or .hg/hgrc containing assignments of names to paths. Example: |
|
438 | 376 |
|
487 | 377 |
----------------- |
438 | 378 |
[paths] |
379 |
hg = http://selenic.com/hg |
|
478
f1804f2e7f35
Update of doc/hg.1.txt
Thomas Arendsen Hein <thomas@intevation.de>
parents:
438
diff
changeset
|
380 |
tah = http://hg.intevation.org/mercurial-tah/ |
487 | 381 |
----------------- |
382 |
||
383 |
||
498 | 384 |
LOCAL TAGS |
385 |
---------- |
|
386 |
||
387 |
To create tags that are local to the repository and not distributed or |
|
388 |
version-controlled, create an hgrc section like the following: |
|
389 |
||
390 |
---------------- |
|
391 |
[tags] |
|
392 |
working = 2dcced388cab3677a8f543c3c47a0ad34ac9d435 |
|
393 |
tested = 12e0fdbc57a0be78f0e817fd1d170a3615cd35da |
|
394 |
---------------- |
|
395 |
||
396 |
||
487 | 397 |
HOOKS |
398 |
----- |
|
399 |
||
400 |
Mercurial supports a set of 'hook', commands that get automatically |
|
401 |
executed by various actions such as starting or finishing a commit. To |
|
402 |
specify a hook, simply create an hgrc section like the following: |
|
403 |
||
404 |
----------------- |
|
405 |
[hooks] |
|
406 |
precommit = echo "this hook gets executed immediately before a commit" |
|
407 |
commit = hg export $NODE | mail -s "new commit $NODE" commit-list |
|
408 |
----------------- |
|
409 |
||
181
038e4d8602bd
updated for .hgpaths and http/old-http protocol name change
jake@edge2.net
parents:
177
diff
changeset
|
410 |
|
321 | 411 |
NON_TRANSPARENT PROXY SUPPORT |
438 | 412 |
----------------------------- |
321 | 413 |
|
487 | 414 |
To access a Mercurial repository through a proxy, create a file |
415 |
$HOME/.hgrc in the following format: |
|
321 | 416 |
|
487 | 417 |
-------------- |
321 | 418 |
[http_proxy] |
419 |
host=myproxy:8080 |
|
420 |
user=<username> |
|
421 |
passwd=<password> |
|
422 |
no=<localhost1>,<localhost2>,<localhost3>,... |
|
487 | 423 |
-------------- |
321 | 424 |
|
498 | 425 |
"user" and "passwd" fields are used for authenticating proxies, "no" is a |
426 |
comma-separated list of local host names to not proxy. |
|
321 | 427 |
|
177 | 428 |
BUGS |
429 |
---- |
|
430 |
Probably lots, please post them to the mailing list (See Resources below) |
|
431 |
when you find them. |
|
432 |
||
433 |
AUTHOR |
|
434 |
------ |
|
435 |
Written by Matt Mackall <mpm@selenic.com> |
|
436 |
||
437 |
RESOURCES |
|
438 |
--------- |
|
439 |
http://selenic.com/mercurial[Main Web Site] |
|
440 |
||
441 |
http://selenic.com/hg[Source code repository] |
|
442 |
||
443 |
http://selenic.com/mailman/listinfo/mercurial[Mailing list] |
|
444 |
||
445 |
COPYING |
|
446 |
------- |
|
447 |
Copyright (C) 2005 Matt Mackall. |
|
448 |
Free use of this software is granted under the terms of the GNU General |
|
449 |
Public License (GPL). |