68 either the pathname of a local repository or the URI of a remote |
32 either the pathname of a local repository or the URI of a remote |
69 repository. There are two available URI protocols, http:// which is |
33 repository. There are two available URI protocols, http:// which is |
70 fast and the old-http:// protocol which is much slower but does not |
34 fast and the old-http:// protocol which is much slower but does not |
71 require a special server on the web host. |
35 require a special server on the web host. |
72 |
36 |
73 COMMANDS |
37 |
74 -------- |
38 include::hg.1.gendoc.txt[] |
75 |
|
76 add [options] [files ...]:: |
|
77 Schedule files to be version controlled and added to the repository. |
|
78 |
|
79 The files will be added to the repository at the next commit. |
|
80 |
|
81 If no names are given, add all files in the current directory and |
|
82 its subdirectories. |
|
83 |
|
84 addremove [options] [files ...]:: |
|
85 Add all new files and remove all missing files from the repository. |
|
86 |
|
87 New files are ignored if they match any of the patterns in .hgignore. As |
|
88 with add, these changes take effect at the next commit. |
|
89 |
|
90 annotate [-r <rev> -u -n -c -d] [files ...]:: |
|
91 List changes in files, showing the revision id responsible for each line |
|
92 |
|
93 This command is useful to discover who did a change or when a change took |
|
94 place. |
|
95 |
|
96 Without the -a option, annotate will avoid processing files it |
|
97 detects as binary. With -a, annotate will generate an annotation |
|
98 anyway, probably with undesirable results. |
|
99 |
|
100 options: |
|
101 -a, --text treat all files as text |
|
102 -I, --include <pat> include names matching the given patterns |
|
103 -X, --exclude <pat> exclude names matching the given patterns |
|
104 -r, --revision <rev> annotate the specified revision |
|
105 -u, --user list the author |
|
106 -d, --date list the commit date |
|
107 -c, --changeset list the changeset |
|
108 -n, --number list the revision number (default) |
|
109 |
|
110 bundle <file> <other>:: |
|
111 (EXPERIMENTAL) |
|
112 |
|
113 Generate a compressed changegroup file collecting all changesets |
|
114 not found in the other repository. |
|
115 |
|
116 This file can then be transferred using conventional means and |
|
117 applied to another repository with the unbundle command. This is |
|
118 useful when native push and pull are not available or when |
|
119 exporting an entire repository is undesirable. The standard file |
|
120 extension is ".hg". |
|
121 |
|
122 Unlike import/export, this exactly preserves all changeset |
|
123 contents including permissions, rename data, and revision history. |
|
124 |
|
125 cat [options] <file ...>:: |
|
126 Print the specified files as they were at the given revision. |
|
127 If no revision is given then the tip is used. |
|
128 |
|
129 Output may be to a file, in which case the name of the file is |
|
130 given using a format string. The formatting rules are the same as |
|
131 for the export command, with the following additions: |
|
132 |
|
133 %s basename of file being printed |
|
134 %d dirname of file being printed, or '.' if in repo root |
|
135 %p root-relative path name of file being printed |
|
136 |
|
137 options: |
|
138 -I, --include <pat> include names matching the given patterns |
|
139 -X, --exclude <pat> exclude names matching the given patterns |
|
140 -o, --output <filespec> print output to file with formatted name |
|
141 -r, --rev <rev> print the given revision |
|
142 |
|
143 clone [options] <source> [dest]:: |
|
144 Create a copy of an existing repository in a new directory. |
|
145 |
|
146 If no destination directory name is specified, it defaults to the |
|
147 basename of the source. |
|
148 |
|
149 The location of the source is added to the new repository's |
|
150 .hg/hgrc file, as the default to be used for future pulls. |
|
151 |
|
152 For efficiency, hardlinks are used for cloning whenever the source |
|
153 and destination are on the same filesystem. Some filesystems, |
|
154 such as AFS, implement hardlinking incorrectly, but do not report |
|
155 errors. In these cases, use the --pull option to avoid |
|
156 hardlinking. |
|
157 |
|
158 See pull for valid source format details. |
|
159 |
|
160 options: |
|
161 -U, --noupdate do not update the new working directory |
|
162 --pull use pull protocol to copy metadata |
|
163 -e, --ssh specify ssh command to use |
|
164 --remotecmd specify hg command to run on the remote side |
|
165 |
|
166 commit [options] [files...]:: |
|
167 Commit changes to the given files into the repository. |
|
168 |
|
169 If a list of files is omitted, all changes reported by "hg status" |
|
170 from the root of the repository will be commited. |
|
171 |
|
172 The HGEDITOR or EDITOR environment variables are used to start an |
|
173 editor to add a commit comment. |
|
174 |
|
175 Options: |
|
176 |
|
177 -A, --addremove run addremove during commit |
|
178 -I, --include <pat> include names matching the given patterns |
|
179 -X, --exclude <pat> exclude names matching the given patterns |
|
180 -m, --message <text> use <text> as commit message |
|
181 -l, --logfile <file> read the commit message from <file> |
|
182 -d, --date <datecode> record datecode as commit date |
|
183 -u, --user <user> record user as commiter |
|
184 |
|
185 aliases: ci |
|
186 |
|
187 copy <source ...> <dest>:: |
|
188 Mark dest as having copies of source files. If dest is a |
|
189 directory, copies are put in that directory. If dest is a file, |
|
190 there can only be one source. |
|
191 |
|
192 By default, this command copies the contents of files as they |
|
193 stand in the working directory. If invoked with --after, the |
|
194 operation is recorded, but no copying is performed. |
|
195 |
|
196 This command takes effect in the next commit. |
|
197 |
|
198 NOTE: This command should be treated as experimental. While it |
|
199 should properly record copied files, this information is not yet |
|
200 fully used by merge, nor fully reported by log. |
|
201 |
|
202 Options: |
|
203 -A, --after record a copy that has already occurred |
|
204 -I, --include <pat> include names matching the given patterns |
|
205 -X, --exclude <pat> exclude names matching the given patterns |
|
206 -f, --force forcibly copy over an existing managed file |
|
207 |
|
208 aliases: cp |
|
209 |
|
210 diff [-a] [-r revision] [-r revision] [files ...]:: |
|
211 Show differences between revisions for the specified files. |
|
212 |
|
213 Differences between files are shown using the unified diff format. |
|
214 |
|
215 When two revision arguments are given, then changes are shown |
|
216 between those revisions. If only one revision is specified then |
|
217 that revision is compared to the working directory, and, when no |
|
218 revisions are specified, the working directory files are compared |
|
219 to its parent. |
|
220 |
|
221 Without the -a option, diff will avoid generating diffs of files |
|
222 it detects as binary. With -a, diff will generate a diff anyway, |
|
223 probably with undesirable results. |
|
224 |
|
225 options: |
|
226 -a, --text treat all files as text |
|
227 -I, --include <pat> include names matching the given patterns |
|
228 -p, --show-function show which function each change is in |
|
229 -X, --exclude <pat> exclude names matching the given patterns |
|
230 -w, --ignore-all-space ignore white space when comparing lines |
|
231 |
|
232 export [-o filespec] [revision] ...:: |
|
233 Print the changeset header and diffs for one or more revisions. |
|
234 |
|
235 The information shown in the changeset header is: author, |
|
236 changeset hash, parent and commit comment. |
|
237 |
|
238 Output may be to a file, in which case the name of the file is |
|
239 given using a format string. The formatting rules are as follows: |
|
240 |
|
241 %% literal "%" character |
|
242 %H changeset hash (40 bytes of hexadecimal) |
|
243 %N number of patches being generated |
|
244 %R changeset revision number |
|
245 %b basename of the exporting repository |
|
246 %h short-form changeset hash (12 bytes of hexadecimal) |
|
247 %n zero-padded sequence number, starting at 1 |
|
248 %r zero-padded changeset revision number |
|
249 |
|
250 Without the -a option, export will avoid generating diffs of files |
|
251 it detects as binary. With -a, export will generate a diff anyway, |
|
252 probably with undesirable results. |
|
253 |
|
254 options: |
|
255 -a, --text treat all files as text |
|
256 -o, --output <filespec> print output to file with formatted name |
|
257 |
|
258 forget [options] [files]:: |
|
259 Undo an 'hg add' scheduled for the next commit. |
|
260 |
|
261 options: |
|
262 -I, --include <pat> include names matching the given patterns |
|
263 -X, --exclude <pat> exclude names matching the given patterns |
|
264 |
|
265 grep [options] pattern [files]:: |
|
266 Search revisions of files for a regular expression. |
|
267 |
|
268 This command behaves differently than Unix grep. It only accepts |
|
269 Python/Perl regexps. It searches repository history, not the |
|
270 working directory. It always prints the revision number in which |
|
271 a match appears. |
|
272 |
|
273 By default, grep only prints output for the first revision of a |
|
274 file in which it finds a match. To get it to print every revision |
|
275 that contains a change in match status ("-" for a match that |
|
276 becomes a non-match, or "+" for a non-match that becomes a match), |
|
277 use the --all flag. |
|
278 |
|
279 options: |
|
280 -0, --print0 end fields with NUL |
|
281 -I, --include <pat> include names matching the given patterns |
|
282 -X, --exclude <pat> exclude names matching the given patterns |
|
283 --all print all revisions that match |
|
284 -i, --ignore-case ignore case when matching |
|
285 -l, --files-with-matches print only filenames and revs that match |
|
286 -n, --line-number print matching line numbers |
|
287 -r <rev>, --rev <rev> search in given revision range |
|
288 -u, --user print user who committed change |
|
289 |
|
290 heads:: |
|
291 Show all repository head changesets. |
|
292 |
|
293 Repository "heads" are changesets that don't have children |
|
294 changesets. They are where development generally takes place and |
|
295 are the usual targets for update and merge operations. |
|
296 |
|
297 identify:: |
|
298 Print a short summary of the current state of the repo. |
|
299 |
|
300 This summary identifies the repository state using one or two parent |
|
301 hash identifiers, followed by a "+" if there are uncommitted changes |
|
302 in the working directory, followed by a list of tags for this revision. |
|
303 |
|
304 aliases: id |
|
305 |
|
306 import [-p <n> -b <base> -f] <patches>:: |
|
307 Import a list of patches and commit them individually. |
|
308 |
|
309 If there are outstanding changes in the working directory, import |
|
310 will abort unless given the -f flag. |
|
311 |
|
312 If a patch looks like a mail message (its first line starts with |
|
313 "From " or looks like an RFC822 header), it will not be applied |
|
314 unless the -f option is used. The importer neither parses nor |
|
315 discards mail headers, so use -f only to override the "mailness" |
|
316 safety check, not to import a real mail message. |
|
317 |
|
318 options: |
|
319 -p, --strip <n> directory strip option for patch. This has the same |
|
320 meaning as the corresponding patch option |
|
321 -b <path> base directory to read patches from |
|
322 -f, --force skip check for outstanding uncommitted changes |
|
323 |
|
324 aliases: patch |
|
325 |
|
326 incoming [-p] [source]:: |
|
327 Show new changesets found in the specified repo or the default |
|
328 pull repo. These are the changesets that would be pulled if a pull |
|
329 was requested. |
|
330 |
|
331 Currently only local repositories are supported. |
|
332 |
|
333 options: |
|
334 -p, --patch show patch |
|
335 |
|
336 aliases: in |
|
337 |
|
338 init [dest]:: |
|
339 Initialize a new repository in the given directory. If the given |
|
340 directory does not exist, it is created. |
|
341 |
|
342 If no directory is given, the current directory is used. |
|
343 |
|
344 locate [options] [files]:: |
|
345 Print all files under Mercurial control whose names match the |
|
346 given patterns. |
|
347 |
|
348 This command searches the current directory and its |
|
349 subdirectories. To search an entire repository, move to the root |
|
350 of the repository. |
|
351 |
|
352 If no patterns are given to match, this command prints all file |
|
353 names. |
|
354 |
|
355 If you want to feed the output of this command into the "xargs" |
|
356 command, use the "-0" option to both this command and "xargs". |
|
357 This will avoid the problem of "xargs" treating single filenames |
|
358 that contain white space as multiple filenames. |
|
359 |
|
360 options: |
|
361 |
|
362 -0, --print0 end filenames with NUL, for use with xargs |
|
363 -f, --fullpath print complete paths from the filesystem root |
|
364 -I, --include <pat> include names matching the given patterns |
|
365 -r, --rev <rev> search the repository as it stood at rev |
|
366 -X, --exclude <pat> exclude names matching the given patterns |
|
367 |
|
368 log [-r revision ...] [-p] [files]:: |
|
369 Print the revision history of the specified files or the entire project. |
|
370 |
|
371 By default this command outputs: changeset id and hash, tags, |
|
372 parents, user, date and time, and a summary for each commit. The |
|
373 -v switch adds some more detail, such as changed files, manifest |
|
374 hashes or message signatures. |
|
375 |
|
376 options: |
|
377 -I, --include <pat> include names matching the given patterns |
|
378 -X, --exclude <pat> exclude names matching the given patterns |
|
379 -b, --branch show branches |
|
380 -k, --keyword <str> search for keywords |
|
381 -l, --limit <num> print no more than this many changes |
|
382 -M, --no-merges do not show merges |
|
383 -m, --only-merges only show merges |
|
384 -r, --rev <A> show the specified revision or range |
|
385 -p, --patch show patch |
|
386 |
|
387 aliases: history |
|
388 |
|
389 manifest [revision]:: |
|
390 Print a list of version controlled files for the given revision. |
|
391 |
|
392 The manifest is the list of files being version controlled. If no revision |
|
393 is given then the tip is used. |
|
394 |
|
395 outgoing [-p] [dest]:: |
|
396 Show changesets not found in the specified destination repo or the |
|
397 default push repo. These are the changesets that would be pushed |
|
398 if a push was requested. |
|
399 |
|
400 See pull for valid source format details. |
|
401 |
|
402 options: |
|
403 -p, --patch show patch |
|
404 |
|
405 aliases: out |
|
406 |
|
407 parents:: |
|
408 Print the working directory's parent revisions. |
|
409 |
|
410 paths [NAME]:: |
|
411 Show definition of symbolic path name NAME. If no name is given, show |
|
412 definition of available names. |
|
413 |
|
414 Path names are defined in the [paths] section of /etc/mercurial/hgrc |
|
415 and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too. |
|
416 |
|
417 pull <repository path>:: |
|
418 Pull changes from a remote repository to a local one. |
|
419 |
|
420 This finds all changes from the repository at the specified path |
|
421 or URL and adds them to the local repository. By default, this |
|
422 does not update the copy of the project in the working directory. |
|
423 |
|
424 Valid URLs are of the form: |
|
425 |
|
426 local/filesystem/path |
|
427 http://[user@]host[:port][/path] |
|
428 https://[user@]host[:port][/path] |
|
429 ssh://[user@]host[:port][/path] |
|
430 |
|
431 SSH requires an accessible shell account on the destination machine |
|
432 and a copy of hg in the remote path. With SSH, paths are relative |
|
433 to the remote user's home directory by default; use two slashes at |
|
434 the start of a path to specify it as relative to the filesystem root. |
|
435 |
|
436 options: |
|
437 -u, --update update the working directory to tip after pull |
|
438 -e, --ssh specify ssh command to use |
|
439 --remotecmd specify hg command to run on the remote side |
|
440 |
|
441 push <destination>:: |
|
442 Push changes from the local repository to the given destination. |
|
443 |
|
444 This is the symmetrical operation for pull. It helps to move |
|
445 changes from the current repository to a different one. If the |
|
446 destination is local this is identical to a pull in that directory |
|
447 from the current one. |
|
448 |
|
449 By default, push will refuse to run if it detects the result would |
|
450 increase the number of remote heads. This generally indicates the |
|
451 the client has forgotten to sync and merge before pushing. |
|
452 |
|
453 Valid URLs are of the form: |
|
454 |
|
455 local/filesystem/path |
|
456 ssh://[user@]host[:port][/path] |
|
457 |
|
458 SSH requires an accessible shell account on the destination |
|
459 machine and a copy of hg in the remote path. |
|
460 |
|
461 options: |
|
462 |
|
463 -f, --force force update |
|
464 -e, --ssh specify ssh command to use |
|
465 --remotecmd specify hg command to run on the remote side |
|
466 |
|
467 rawcommit [-p -d -u -F -m -l]:: |
|
468 Lowlevel commit, for use in helper scripts. (DEPRECATED) |
|
469 |
|
470 This command is not intended to be used by normal users, as it is |
|
471 primarily useful for importing from other SCMs. |
|
472 |
|
473 This command is now deprecated and will be removed in a future |
|
474 release, please use debugsetparents and commit instead. |
|
475 |
|
476 recover:: |
|
477 Recover from an interrupted commit or pull. |
|
478 |
|
479 This command tries to fix the repository status after an interrupted |
|
480 operation. It should only be necessary when Mercurial suggests it. |
|
481 |
|
482 remove [options] [files ...]:: |
|
483 Schedule the indicated files for removal from the repository. |
|
484 |
|
485 This command schedules the files to be removed at the next commit. |
|
486 This only removes files from the current branch, not from the |
|
487 entire project history. If the files still exist in the working |
|
488 directory, they will be deleted from it. |
|
489 |
|
490 aliases: rm |
|
491 |
|
492 rename <source ...> <dest>:: |
|
493 Mark dest as copies of sources; mark sources for deletion. If |
|
494 dest is a directory, copies are put in that directory. If dest is |
|
495 a file, there can only be one source. |
|
496 |
|
497 By default, this command copies the contents of files as they |
|
498 stand in the working directory. If invoked with --after, the |
|
499 operation is recorded, but no copying is performed. |
|
500 |
|
501 This command takes effect in the next commit. |
|
502 |
|
503 NOTE: This command should be treated as experimental. While it |
|
504 should properly record rename files, this information is not yet |
|
505 fully used by merge, nor fully reported by log. |
|
506 |
|
507 Options: |
|
508 -A, --after record a rename that has already occurred |
|
509 -f, --force forcibly copy over an existing managed file |
|
510 |
|
511 aliases: mv |
|
512 |
|
513 revert [names ...]:: |
|
514 The revert command has two modes of operation. |
|
515 |
|
516 In its default mode, it reverts any uncommitted modifications made |
|
517 to the named files or directories. This restores the contents of |
|
518 the affected files to an unmodified state. |
|
519 |
|
520 Using the -r option, it reverts the given files or directories to |
|
521 their state as of an earlier revision. This can be helpful to "roll |
|
522 back" some or all of a change that should not have been committed. |
|
523 |
|
524 Revert modifies the working directory. It does not commit any |
|
525 changes, or change the parent of the current working directory. |
|
526 |
|
527 If a file has been deleted, it is recreated. If the executable |
|
528 mode of a file was changed, it is reset. |
|
529 |
|
530 If a directory is given, all files in that directory and its |
|
531 subdirectories are reverted. |
|
532 |
|
533 If no arguments are given, all files in the current directory and |
|
534 its subdirectories are reverted. |
|
535 |
|
536 options: |
|
537 -r, --rev <rev> revision to revert to |
|
538 -n, --nonrecursive do not recurse into subdirectories |
|
539 |
|
540 root:: |
|
541 Print the root directory of the current repository. |
|
542 |
|
543 serve [options]:: |
|
544 Start a local HTTP repository browser and pull server. |
|
545 |
|
546 By default, the server logs accesses to stdout and errors to |
|
547 stderr. Use the "-A" and "-E" options to log to files. |
|
548 |
|
549 options: |
|
550 -A, --accesslog <file> name of access log file to write to |
|
551 -d, --daemon run server in background, as a daemon |
|
552 -E, --errorlog <file> name of error log file to write to |
|
553 -a, --address <addr> address to use |
|
554 -p, --port <n> port to use (default: 8000) |
|
555 -n, --name <name> name to show in web pages (default: working dir) |
|
556 --pid-file <file> write server process ID to given file |
|
557 -t, --templatedir <path> web templates to use |
|
558 -6, --ipv6 use IPv6 in addition to IPv4 |
|
559 |
|
560 status [options] [files]:: |
|
561 Show changed files in the working directory. If no names are |
|
562 given, all files are shown. Otherwise, only files matching the |
|
563 given names are shown. |
|
564 |
|
565 The codes used to show the status of files are: |
|
566 |
|
567 M = changed |
|
568 A = added |
|
569 R = removed |
|
570 ? = not tracked |
|
571 |
|
572 options: |
|
573 |
|
574 -m, --modified show only modified files |
|
575 -a, --added show only added files |
|
576 -r, --removed show only removed files |
|
577 -u, --unknown show only unknown (not tracked) files |
|
578 -n, --no-status hide status prefix |
|
579 -0, --print0 end filenames with NUL, for use with xargs |
|
580 -I, --include <pat> include names matching the given patterns |
|
581 -X, --exclude <pat> exclude names matching the given patterns |
|
582 |
|
583 tag [-l -m <text> -d <datecode> -u <user>] <name> [revision]:: |
|
584 Name a particular revision using <name>. |
|
585 |
|
586 Tags are used to name particular revisions of the repository and are |
|
587 very useful to compare different revision, to go back to significant |
|
588 earlier versions or to mark branch points as releases, etc. |
|
589 |
|
590 If no revision is given, the tip is used. |
|
591 |
|
592 To facilitate version control, distribution, and merging of tags, |
|
593 they are stored as a file named ".hgtags" which is managed |
|
594 similarly to other project files and can be hand-edited if |
|
595 necessary. |
|
596 |
|
597 options: |
|
598 -l, --local make the tag local |
|
599 -m, --message <text> message for tag commit log entry |
|
600 -d, --date <datecode> datecode for commit |
|
601 -u, --user <user> user for commit |
|
602 |
|
603 Note: Local tags are not version-controlled or distributed and are |
|
604 stored in the .hg/localtags file. If there exists a local tag and |
|
605 a public tag with the same name, local tag is used. |
|
606 |
|
607 tags:: |
|
608 List the repository tags. |
|
609 |
|
610 This lists both regular and local tags. |
|
611 |
|
612 tip [-p]:: |
|
613 Show the tip revision. |
|
614 |
|
615 options: |
|
616 -p, --patch show patch |
|
617 |
|
618 unbundle <file>:: |
|
619 (EXPERIMENTAL) |
|
620 |
|
621 Apply a compressed changegroup file generated by the bundle |
|
622 command. |
|
623 |
|
624 undo:: |
|
625 Undo the last commit or pull transaction. |
|
626 |
|
627 Roll back the last pull or commit transaction on the |
|
628 repository, restoring the project to its earlier state. |
|
629 |
|
630 This command should be used with care. There is only one level of |
|
631 undo and there is no redo. |
|
632 |
|
633 This command is not intended for use on public repositories. Once |
|
634 a change is visible for pull by other users, undoing it locally is |
|
635 ineffective. |
|
636 |
|
637 update [-m -C] [revision]:: |
|
638 Update the working directory to the specified revision. |
|
639 |
|
640 By default, update will refuse to run if doing so would require |
|
641 merging or discarding local changes. |
|
642 |
|
643 With the -m option, a merge will be performed. |
|
644 |
|
645 With the -C option, local changes will be lost. |
|
646 |
|
647 options: |
|
648 -m, --merge allow merging of branches |
|
649 -C, --clean overwrite locally modified files |
|
650 |
|
651 aliases: up checkout co |
|
652 |
|
653 verify:: |
|
654 Verify the integrity of the current repository. |
|
655 |
|
656 This will perform an extensive check of the repository's |
|
657 integrity, validating the hashes and checksums of each entry in |
|
658 the changelog, manifest, and tracked files, as well as the |
|
659 integrity of their crosslinks and indices. |
|
660 |
39 |
661 FILE NAME PATTERNS |
40 FILE NAME PATTERNS |
662 ------------------ |
41 ------------------ |
663 |
42 |
664 Mercurial accepts several notations for identifying one or more |
43 Mercurial accepts several notations for identifying one or more |