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 options: |
|
298 -b, --branches show branches |
|
299 -r, --rev <rev> show only heads which are descendants of rev |
|
300 --style <style> display using style map file |
|
301 --template <tpl> display using template |
|
302 |
|
303 identify:: |
|
304 Print a short summary of the current state of the repo. |
|
305 |
|
306 This summary identifies the repository state using one or two parent |
|
307 hash identifiers, followed by a "+" if there are uncommitted changes |
|
308 in the working directory, followed by a list of tags for this revision. |
|
309 |
|
310 aliases: id |
|
311 |
|
312 import [-p <n> -b <base> -f] <patches>:: |
|
313 Import a list of patches and commit them individually. |
|
314 |
|
315 If there are outstanding changes in the working directory, import |
|
316 will abort unless given the -f flag. |
|
317 |
|
318 If a patch looks like a mail message (its first line starts with |
|
319 "From " or looks like an RFC822 header), it will not be applied |
|
320 unless the -f option is used. The importer neither parses nor |
|
321 discards mail headers, so use -f only to override the "mailness" |
|
322 safety check, not to import a real mail message. |
|
323 |
|
324 options: |
|
325 -p, --strip <n> directory strip option for patch. This has the same |
|
326 meaning as the corresponding patch option |
|
327 -b <path> base directory to read patches from |
|
328 -f, --force skip check for outstanding uncommitted changes |
|
329 |
|
330 aliases: patch |
|
331 |
|
332 incoming [-p] [source]:: |
|
333 Show new changesets found in the specified repo or the default |
|
334 pull repo. These are the changesets that would be pulled if a pull |
|
335 was requested. |
|
336 |
|
337 Currently only local repositories are supported. |
|
338 |
|
339 options: |
|
340 -M, --no-merges do not show merges |
|
341 -n, --newest-first show newest records first |
|
342 -p, --patch show patch |
|
343 --style <style> display using style map file |
|
344 --template <tpl> display using template |
|
345 |
|
346 aliases: in |
|
347 |
|
348 init [dest]:: |
|
349 Initialize a new repository in the given directory. If the given |
|
350 directory does not exist, it is created. |
|
351 |
|
352 If no directory is given, the current directory is used. |
|
353 |
|
354 locate [options] [files]:: |
|
355 Print all files under Mercurial control whose names match the |
|
356 given patterns. |
|
357 |
|
358 This command searches the current directory and its |
|
359 subdirectories. To search an entire repository, move to the root |
|
360 of the repository. |
|
361 |
|
362 If no patterns are given to match, this command prints all file |
|
363 names. |
|
364 |
|
365 If you want to feed the output of this command into the "xargs" |
|
366 command, use the "-0" option to both this command and "xargs". |
|
367 This will avoid the problem of "xargs" treating single filenames |
|
368 that contain white space as multiple filenames. |
|
369 |
|
370 options: |
|
371 |
|
372 -0, --print0 end filenames with NUL, for use with xargs |
|
373 -f, --fullpath print complete paths from the filesystem root |
|
374 -I, --include <pat> include names matching the given patterns |
|
375 -r, --rev <rev> search the repository as it stood at rev |
|
376 -X, --exclude <pat> exclude names matching the given patterns |
|
377 |
|
378 log [-r revision ...] [-p] [files]:: |
|
379 Print the revision history of the specified files or the entire project. |
|
380 |
|
381 By default this command outputs: changeset id and hash, tags, |
|
382 parents, user, date and time, and a summary for each commit. The |
|
383 -v switch adds some more detail, such as changed files, manifest |
|
384 hashes or message signatures. |
|
385 |
|
386 options: |
|
387 -I, --include <pat> include names matching the given patterns |
|
388 -X, --exclude <pat> exclude names matching the given patterns |
|
389 -b, --branch show branches |
|
390 -k, --keyword <str> search for keywords |
|
391 -l, --limit <num> print no more than this many changes |
|
392 -M, --no-merges do not show merges |
|
393 -m, --only-merges only show merges |
|
394 -r, --rev <A> show the specified revision or range |
|
395 -p, --patch show patch |
|
396 --style <style> display using style map file |
|
397 --template <tpl> display using template |
|
398 |
|
399 aliases: history |
|
400 |
|
401 manifest [revision]:: |
|
402 Print a list of version controlled files for the given revision. |
|
403 |
|
404 The manifest is the list of files being version controlled. If no revision |
|
405 is given then the tip is used. |
|
406 |
|
407 outgoing [-p] [dest]:: |
|
408 Show changesets not found in the specified destination repo or the |
|
409 default push repo. These are the changesets that would be pushed |
|
410 if a push was requested. |
|
411 |
|
412 See pull for valid source format details. |
|
413 |
|
414 options: |
|
415 -M, --no-merges do not show merges |
|
416 -p, --patch show patch |
|
417 -n, --newest-first show newest records first |
|
418 --style <style> display using style map file |
|
419 --template <tpl> display using template |
|
420 |
|
421 aliases: out |
|
422 |
|
423 parents:: |
|
424 Print the working directory's parent revisions. |
|
425 |
|
426 options: |
|
427 -b, --branches show branches |
|
428 --style <style> display using style map file |
|
429 --template <tpl> display using template |
|
430 |
|
431 paths [NAME]:: |
|
432 Show definition of symbolic path name NAME. If no name is given, show |
|
433 definition of available names. |
|
434 |
|
435 Path names are defined in the [paths] section of /etc/mercurial/hgrc |
|
436 and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too. |
|
437 |
|
438 pull <repository path>:: |
|
439 Pull changes from a remote repository to a local one. |
|
440 |
|
441 This finds all changes from the repository at the specified path |
|
442 or URL and adds them to the local repository. By default, this |
|
443 does not update the copy of the project in the working directory. |
|
444 |
|
445 Valid URLs are of the form: |
|
446 |
|
447 local/filesystem/path |
|
448 http://[user@]host[:port][/path] |
|
449 https://[user@]host[:port][/path] |
|
450 ssh://[user@]host[:port][/path] |
|
451 |
|
452 SSH requires an accessible shell account on the destination machine |
|
453 and a copy of hg in the remote path. With SSH, paths are relative |
|
454 to the remote user's home directory by default; use two slashes at |
|
455 the start of a path to specify it as relative to the filesystem root. |
|
456 |
|
457 options: |
|
458 -u, --update update the working directory to tip after pull |
|
459 -e, --ssh specify ssh command to use |
|
460 --remotecmd specify hg command to run on the remote side |
|
461 |
|
462 push <destination>:: |
|
463 Push changes from the local repository to the given destination. |
|
464 |
|
465 This is the symmetrical operation for pull. It helps to move |
|
466 changes from the current repository to a different one. If the |
|
467 destination is local this is identical to a pull in that directory |
|
468 from the current one. |
|
469 |
|
470 By default, push will refuse to run if it detects the result would |
|
471 increase the number of remote heads. This generally indicates the |
|
472 the client has forgotten to sync and merge before pushing. |
|
473 |
|
474 Valid URLs are of the form: |
|
475 |
|
476 local/filesystem/path |
|
477 ssh://[user@]host[:port][/path] |
|
478 |
|
479 SSH requires an accessible shell account on the destination |
|
480 machine and a copy of hg in the remote path. |
|
481 |
|
482 options: |
|
483 |
|
484 -f, --force force update |
|
485 -e, --ssh specify ssh command to use |
|
486 --remotecmd specify hg command to run on the remote side |
|
487 |
|
488 rawcommit [-p -d -u -F -m -l]:: |
|
489 Lowlevel commit, for use in helper scripts. (DEPRECATED) |
|
490 |
|
491 This command is not intended to be used by normal users, as it is |
|
492 primarily useful for importing from other SCMs. |
|
493 |
|
494 This command is now deprecated and will be removed in a future |
|
495 release, please use debugsetparents and commit instead. |
|
496 |
|
497 recover:: |
|
498 Recover from an interrupted commit or pull. |
|
499 |
|
500 This command tries to fix the repository status after an interrupted |
|
501 operation. It should only be necessary when Mercurial suggests it. |
|
502 |
|
503 remove [options] [files ...]:: |
|
504 Schedule the indicated files for removal from the repository. |
|
505 |
|
506 This command schedules the files to be removed at the next commit. |
|
507 This only removes files from the current branch, not from the |
|
508 entire project history. If the files still exist in the working |
|
509 directory, they will be deleted from it. |
|
510 |
|
511 aliases: rm |
|
512 |
|
513 rename <source ...> <dest>:: |
|
514 Mark dest as copies of sources; mark sources for deletion. If |
|
515 dest is a directory, copies are put in that directory. If dest is |
|
516 a file, there can only be one source. |
|
517 |
|
518 By default, this command copies the contents of files as they |
|
519 stand in the working directory. If invoked with --after, the |
|
520 operation is recorded, but no copying is performed. |
|
521 |
|
522 This command takes effect in the next commit. |
|
523 |
|
524 NOTE: This command should be treated as experimental. While it |
|
525 should properly record rename files, this information is not yet |
|
526 fully used by merge, nor fully reported by log. |
|
527 |
|
528 Options: |
|
529 -A, --after record a rename that has already occurred |
|
530 -f, --force forcibly copy over an existing managed file |
|
531 |
|
532 aliases: mv |
|
533 |
|
534 revert [names ...]:: |
|
535 The revert command has two modes of operation. |
|
536 |
|
537 In its default mode, it reverts any uncommitted modifications made |
|
538 to the named files or directories. This restores the contents of |
|
539 the affected files to an unmodified state. |
|
540 |
|
541 Using the -r option, it reverts the given files or directories to |
|
542 their state as of an earlier revision. This can be helpful to "roll |
|
543 back" some or all of a change that should not have been committed. |
|
544 |
|
545 Revert modifies the working directory. It does not commit any |
|
546 changes, or change the parent of the current working directory. |
|
547 |
|
548 If a file has been deleted, it is recreated. If the executable |
|
549 mode of a file was changed, it is reset. |
|
550 |
|
551 If a directory is given, all files in that directory and its |
|
552 subdirectories are reverted. |
|
553 |
|
554 If no arguments are given, all files in the current directory and |
|
555 its subdirectories are reverted. |
|
556 |
|
557 options: |
|
558 -r, --rev <rev> revision to revert to |
|
559 -n, --nonrecursive do not recurse into subdirectories |
|
560 |
|
561 root:: |
|
562 Print the root directory of the current repository. |
|
563 |
|
564 serve [options]:: |
|
565 Start a local HTTP repository browser and pull server. |
|
566 |
|
567 By default, the server logs accesses to stdout and errors to |
|
568 stderr. Use the "-A" and "-E" options to log to files. |
|
569 |
|
570 options: |
|
571 -A, --accesslog <file> name of access log file to write to |
|
572 -d, --daemon run server in background, as a daemon |
|
573 -E, --errorlog <file> name of error log file to write to |
|
574 -a, --address <addr> address to use |
|
575 -p, --port <n> port to use (default: 8000) |
|
576 -n, --name <name> name to show in web pages (default: working dir) |
|
577 --pid-file <file> write server process ID to given file |
|
578 -t, --templatedir <path> web templates to use |
|
579 -6, --ipv6 use IPv6 in addition to IPv4 |
|
580 |
|
581 status [options] [files]:: |
|
582 Show changed files in the working directory. If no names are |
|
583 given, all files are shown. Otherwise, only files matching the |
|
584 given names are shown. |
|
585 |
|
586 The codes used to show the status of files are: |
|
587 |
|
588 M = changed |
|
589 A = added |
|
590 R = removed |
|
591 ? = not tracked |
|
592 |
|
593 options: |
|
594 |
|
595 -m, --modified show only modified files |
|
596 -a, --added show only added files |
|
597 -r, --removed show only removed files |
|
598 -u, --unknown show only unknown (not tracked) files |
|
599 -n, --no-status hide status prefix |
|
600 -0, --print0 end filenames with NUL, for use with xargs |
|
601 -I, --include <pat> include names matching the given patterns |
|
602 -X, --exclude <pat> exclude names matching the given patterns |
|
603 |
|
604 tag [-l -m <text> -d <datecode> -u <user>] <name> [revision]:: |
|
605 Name a particular revision using <name>. |
|
606 |
|
607 Tags are used to name particular revisions of the repository and are |
|
608 very useful to compare different revision, to go back to significant |
|
609 earlier versions or to mark branch points as releases, etc. |
|
610 |
|
611 If no revision is given, the tip is used. |
|
612 |
|
613 To facilitate version control, distribution, and merging of tags, |
|
614 they are stored as a file named ".hgtags" which is managed |
|
615 similarly to other project files and can be hand-edited if |
|
616 necessary. |
|
617 |
|
618 options: |
|
619 -l, --local make the tag local |
|
620 -m, --message <text> message for tag commit log entry |
|
621 -d, --date <datecode> datecode for commit |
|
622 -u, --user <user> user for commit |
|
623 |
|
624 Note: Local tags are not version-controlled or distributed and are |
|
625 stored in the .hg/localtags file. If there exists a local tag and |
|
626 a public tag with the same name, local tag is used. |
|
627 |
|
628 tags:: |
|
629 List the repository tags. |
|
630 |
|
631 This lists both regular and local tags. |
|
632 |
|
633 tip [-p]:: |
|
634 Show the tip revision. |
|
635 |
|
636 options: |
|
637 -b, --branches show branches |
|
638 -p, --patch show patch |
|
639 --style <style> display using style map file |
|
640 --template <tpl> display using template |
|
641 |
|
642 unbundle <file>:: |
|
643 (EXPERIMENTAL) |
|
644 |
|
645 Apply a compressed changegroup file generated by the bundle |
|
646 command. |
|
647 |
|
648 undo:: |
|
649 Undo the last commit or pull transaction. |
|
650 |
|
651 Roll back the last pull or commit transaction on the |
|
652 repository, restoring the project to its earlier state. |
|
653 |
|
654 This command should be used with care. There is only one level of |
|
655 undo and there is no redo. |
|
656 |
|
657 This command is not intended for use on public repositories. Once |
|
658 a change is visible for pull by other users, undoing it locally is |
|
659 ineffective. |
|
660 |
|
661 update [-m -C] [revision]:: |
|
662 Update the working directory to the specified revision. |
|
663 |
|
664 By default, update will refuse to run if doing so would require |
|
665 merging or discarding local changes. |
|
666 |
|
667 With the -m option, a merge will be performed. |
|
668 |
|
669 With the -C option, local changes will be lost. |
|
670 |
|
671 options: |
|
672 -m, --merge allow merging of branches |
|
673 -C, --clean overwrite locally modified files |
|
674 |
|
675 aliases: up checkout co |
|
676 |
|
677 verify:: |
|
678 Verify the integrity of the current repository. |
|
679 |
|
680 This will perform an extensive check of the repository's |
|
681 integrity, validating the hashes and checksums of each entry in |
|
682 the changelog, manifest, and tracked files, as well as the |
|
683 integrity of their crosslinks and indices. |
|
684 |
39 |
685 FILE NAME PATTERNS |
40 FILE NAME PATTERNS |
686 ------------------ |
41 ------------------ |
687 |
42 |
688 Mercurial accepts several notations for identifying one or more |
43 Mercurial accepts several notations for identifying one or more |