Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 9051:f8e25885d975
commands: wrapped docstrings at 78 characters
We have always had a left margin of 4 characters -- probably just
because that's how docstrings for top-level functions turn out by
default, but it also looks nice in the built-in help.
The docstrings were wrapped at 70 characters, which is the default for
Emacs. However, this gives a right margin of 10 characters in a
standard 80 character terminal.
I've now wrapped the relevant docstrings at 78 characters, effectively
killing the right margin. The asymmetric margins looked a bit odd and
some of the text looked cramped with a right margin, so Dirkjan and I
felt that it was best to remove it entirely. The two character gap was
kept to have some space between the border of the terminal -- it will
also make diffs involving the docstrings fit in a 80 character line.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Tue, 07 Jul 2009 23:54:30 +0200 |
parents | 32e678f9045f |
children | 5d6c42f33b71 |
comparison
equal
deleted
inserted
replaced
9050:77324df822e2 | 9051:f8e25885d975 |
---|---|
18 # Commands start here, listed alphabetically | 18 # Commands start here, listed alphabetically |
19 | 19 |
20 def add(ui, repo, *pats, **opts): | 20 def add(ui, repo, *pats, **opts): |
21 """add the specified files on the next commit | 21 """add the specified files on the next commit |
22 | 22 |
23 Schedule files to be version controlled and added to the | 23 Schedule files to be version controlled and added to the repository. |
24 repository. | 24 |
25 | 25 The files will be added to the repository at the next commit. To undo an |
26 The files will be added to the repository at the next commit. To | 26 add before that, see hg forget. |
27 undo an add before that, see hg forget. | |
28 | 27 |
29 If no names are given, add all files to the repository. | 28 If no names are given, add all files to the repository. |
30 """ | 29 """ |
31 | 30 |
32 bad = [] | 31 bad = [] |
47 return bad and 1 or 0 | 46 return bad and 1 or 0 |
48 | 47 |
49 def addremove(ui, repo, *pats, **opts): | 48 def addremove(ui, repo, *pats, **opts): |
50 """add all new files, delete all missing files | 49 """add all new files, delete all missing files |
51 | 50 |
52 Add all new files and remove all missing files from the | 51 Add all new files and remove all missing files from the repository. |
53 repository. | 52 |
54 | 53 New files are ignored if they match any of the patterns in .hgignore. As |
55 New files are ignored if they match any of the patterns in | 54 with add, these changes take effect at the next commit. |
56 .hgignore. As with add, these changes take effect at the next | 55 |
57 commit. | 56 Use the -s/--similarity option to detect renamed files. With a parameter > |
58 | 57 0, this compares every removed file with every added file and records |
59 Use the -s/--similarity option to detect renamed files. With a | 58 those similar enough as renames. This option takes a percentage between 0 |
60 parameter > 0, this compares every removed file with every added | 59 (disabled) and 100 (files must be identical) as its parameter. Detecting |
61 file and records those similar enough as renames. This option | 60 renamed files this way can be expensive. |
62 takes a percentage between 0 (disabled) and 100 (files must be | |
63 identical) as its parameter. Detecting renamed files this way can | |
64 be expensive. | |
65 """ | 61 """ |
66 try: | 62 try: |
67 sim = float(opts.get('similarity') or 0) | 63 sim = float(opts.get('similarity') or 0) |
68 except ValueError: | 64 except ValueError: |
69 raise util.Abort(_('similarity must be a number')) | 65 raise util.Abort(_('similarity must be a number')) |
72 return cmdutil.addremove(repo, pats, opts, similarity=sim/100.) | 68 return cmdutil.addremove(repo, pats, opts, similarity=sim/100.) |
73 | 69 |
74 def annotate(ui, repo, *pats, **opts): | 70 def annotate(ui, repo, *pats, **opts): |
75 """show changeset information by line for each file | 71 """show changeset information by line for each file |
76 | 72 |
77 List changes in files, showing the revision id responsible for | 73 List changes in files, showing the revision id responsible for each line |
78 each line | 74 |
79 | 75 This command is useful for discovering when a change was made and by whom. |
80 This command is useful for discovering when a change was made and | 76 |
81 by whom. | 77 Without the -a/--text option, annotate will avoid processing files it |
82 | 78 detects as binary. With -a, annotate will annotate the file anyway, |
83 Without the -a/--text option, annotate will avoid processing files | 79 although the results will probably be neither useful nor desirable. |
84 it detects as binary. With -a, annotate will annotate the file | |
85 anyway, although the results will probably be neither useful | |
86 nor desirable. | |
87 """ | 80 """ |
88 datefunc = ui.quiet and util.shortdate or util.datestr | 81 datefunc = ui.quiet and util.shortdate or util.datestr |
89 getdate = util.cachefunc(lambda x: datefunc(x[0].date())) | 82 getdate = util.cachefunc(lambda x: datefunc(x[0].date())) |
90 | 83 |
91 if not pats: | 84 if not pats: |
135 ui.write("%s: %s" % (" ".join(p), l[1])) | 128 ui.write("%s: %s" % (" ".join(p), l[1])) |
136 | 129 |
137 def archive(ui, repo, dest, **opts): | 130 def archive(ui, repo, dest, **opts): |
138 '''create an unversioned archive of a repository revision | 131 '''create an unversioned archive of a repository revision |
139 | 132 |
140 By default, the revision used is the parent of the working | 133 By default, the revision used is the parent of the working directory; use |
141 directory; use -r/--rev to specify a different revision. | 134 -r/--rev to specify a different revision. |
142 | 135 |
143 To specify the type of archive to create, use -t/--type. Valid | 136 To specify the type of archive to create, use -t/--type. Valid types are: |
144 types are: | |
145 | 137 |
146 "files" (default): a directory full of files | 138 "files" (default): a directory full of files |
147 "tar": tar archive, uncompressed | 139 "tar": tar archive, uncompressed |
148 "tbz2": tar archive, compressed using bzip2 | 140 "tbz2": tar archive, compressed using bzip2 |
149 "tgz": tar archive, compressed using gzip | 141 "tgz": tar archive, compressed using gzip |
150 "uzip": zip archive, uncompressed | 142 "uzip": zip archive, uncompressed |
151 "zip": zip archive, compressed using deflate | 143 "zip": zip archive, compressed using deflate |
152 | 144 |
153 The exact name of the destination archive or directory is given | 145 The exact name of the destination archive or directory is given using a |
154 using a format string; see 'hg help export' for details. | 146 format string; see 'hg help export' for details. |
155 | 147 |
156 Each member added to an archive file has a directory prefix | 148 Each member added to an archive file has a directory prefix prepended. Use |
157 prepended. Use -p/--prefix to specify a format string for the | 149 -p/--prefix to specify a format string for the prefix. The default is the |
158 prefix. The default is the basename of the archive, with suffixes | 150 basename of the archive, with suffixes removed. |
159 removed. | |
160 ''' | 151 ''' |
161 | 152 |
162 ctx = repo[opts.get('rev')] | 153 ctx = repo[opts.get('rev')] |
163 if not ctx: | 154 if not ctx: |
164 raise util.Abort(_('no working directory: please specify a revision')) | 155 raise util.Abort(_('no working directory: please specify a revision')) |
179 matchfn, prefix) | 170 matchfn, prefix) |
180 | 171 |
181 def backout(ui, repo, node=None, rev=None, **opts): | 172 def backout(ui, repo, node=None, rev=None, **opts): |
182 '''reverse effect of earlier changeset | 173 '''reverse effect of earlier changeset |
183 | 174 |
184 Commit the backed out changes as a new changeset. The new | 175 Commit the backed out changes as a new changeset. The new changeset is a |
185 changeset is a child of the backed out changeset. | 176 child of the backed out changeset. |
186 | 177 |
187 If you backout a changeset other than the tip, a new head is | 178 If you backout a changeset other than the tip, a new head is created. This |
188 created. This head will be the new tip and you should merge this | 179 head will be the new tip and you should merge this backout changeset with |
189 backout changeset with another head. | 180 another head. |
190 | 181 |
191 The --merge option remembers the parent of the working directory | 182 The --merge option remembers the parent of the working directory before |
192 before starting the backout, then merges the new head with that | 183 starting the backout, then merges the new head with that changeset |
193 changeset afterwards. This saves you from doing the merge by hand. | 184 afterwards. This saves you from doing the merge by hand. The result of |
194 The result of this merge is not committed, as with a normal merge. | 185 this merge is not committed, as with a normal merge. |
195 | 186 |
196 See 'hg help dates' for a list of formats valid for -d/--date. | 187 See 'hg help dates' for a list of formats valid for -d/--date. |
197 ''' | 188 ''' |
198 if rev and node: | 189 if rev and node: |
199 raise util.Abort(_("please specify just one revision")) | 190 raise util.Abort(_("please specify just one revision")) |
266 | 257 |
267 def bisect(ui, repo, rev=None, extra=None, command=None, | 258 def bisect(ui, repo, rev=None, extra=None, command=None, |
268 reset=None, good=None, bad=None, skip=None, noupdate=None): | 259 reset=None, good=None, bad=None, skip=None, noupdate=None): |
269 """subdivision search of changesets | 260 """subdivision search of changesets |
270 | 261 |
271 This command helps to find changesets which introduce problems. To | 262 This command helps to find changesets which introduce problems. To use, |
272 use, mark the earliest changeset you know exhibits the problem as | 263 mark the earliest changeset you know exhibits the problem as bad, then |
273 bad, then mark the latest changeset which is free from the problem | 264 mark the latest changeset which is free from the problem as good. Bisect |
274 as good. Bisect will update your working directory to a revision | 265 will update your working directory to a revision for testing (unless the |
275 for testing (unless the -U/--noupdate option is specified). Once | 266 -U/--noupdate option is specified). Once you have performed tests, mark |
276 you have performed tests, mark the working directory as good or | 267 the working directory as good or bad, and bisect will either update to |
277 bad, and bisect will either update to another candidate changeset | 268 another candidate changeset or announce that it has found the bad |
278 or announce that it has found the bad revision. | 269 revision. |
279 | 270 |
280 As a shortcut, you can also use the revision argument to mark a | 271 As a shortcut, you can also use the revision argument to mark a revision |
281 revision as good or bad without checking it out first. | 272 as good or bad without checking it out first. |
282 | 273 |
283 If you supply a command, it will be used for automatic bisection. | 274 If you supply a command, it will be used for automatic bisection. Its exit |
284 Its exit status will be used to mark revisions as good or bad: | 275 status will be used to mark revisions as good or bad: status 0 means good, |
285 status 0 means good, 125 means to skip the revision, 127 | 276 125 means to skip the revision, 127 (command not found) will abort the |
286 (command not found) will abort the bisection, and any other | 277 bisection, and any other non-zero exit status means the revision is bad. |
287 non-zero exit status means the revision is bad. | |
288 """ | 278 """ |
289 def print_result(nodes, good): | 279 def print_result(nodes, good): |
290 displayer = cmdutil.show_changeset(ui, repo, {}) | 280 displayer = cmdutil.show_changeset(ui, repo, {}) |
291 if len(nodes) == 1: | 281 if len(nodes) == 1: |
292 # narrowed it down to a single revision | 282 # narrowed it down to a single revision |
404 return hg.clean(repo, node) | 394 return hg.clean(repo, node) |
405 | 395 |
406 def branch(ui, repo, label=None, **opts): | 396 def branch(ui, repo, label=None, **opts): |
407 """set or show the current branch name | 397 """set or show the current branch name |
408 | 398 |
409 With no argument, show the current branch name. With one argument, | 399 With no argument, show the current branch name. With one argument, set the |
410 set the working directory branch name (the branch will not exist | 400 working directory branch name (the branch will not exist in the repository |
411 in the repository until the next commit). Standard practice | 401 until the next commit). Standard practice recommends that primary |
412 recommends that primary development take place on the 'default' | 402 development take place on the 'default' branch. |
413 branch. | 403 |
414 | 404 Unless -f/--force is specified, branch will not let you set a branch name |
415 Unless -f/--force is specified, branch will not let you set a | 405 that already exists, even if it's inactive. |
416 branch name that already exists, even if it's inactive. | 406 |
417 | 407 Use -C/--clean to reset the working directory branch to that of the parent |
418 Use -C/--clean to reset the working directory branch to that of | 408 of the working directory, negating a previous branch change. |
419 the parent of the working directory, negating a previous branch | 409 |
420 change. | 410 Use the command 'hg update' to switch to an existing branch. Use 'hg |
421 | 411 commit --close-branch' to mark this branch as closed. |
422 Use the command 'hg update' to switch to an existing branch. Use | |
423 'hg commit --close-branch' to mark this branch as closed. | |
424 """ | 412 """ |
425 | 413 |
426 if opts.get('clean'): | 414 if opts.get('clean'): |
427 label = repo[None].parents()[0].branch() | 415 label = repo[None].parents()[0].branch() |
428 repo.dirstate.setbranch(label) | 416 repo.dirstate.setbranch(label) |
438 ui.write("%s\n" % encoding.tolocal(repo.dirstate.branch())) | 426 ui.write("%s\n" % encoding.tolocal(repo.dirstate.branch())) |
439 | 427 |
440 def branches(ui, repo, active=False, closed=False): | 428 def branches(ui, repo, active=False, closed=False): |
441 """list repository named branches | 429 """list repository named branches |
442 | 430 |
443 List the repository's named branches, indicating which ones are | 431 List the repository's named branches, indicating which ones are inactive. |
444 inactive. If -c/--closed is specified, also list branches which have | 432 If -c/--closed is specified, also list branches which have been marked |
445 been marked closed (see hg commit --close-branch). | 433 closed (see hg commit --close-branch). |
446 | 434 |
447 If -a/--active is specified, only show active branches. A branch | 435 If -a/--active is specified, only show active branches. A branch is |
448 is considered active if it contains repository heads. | 436 considered active if it contains repository heads. |
449 | 437 |
450 Use the command 'hg update' to switch to an existing branch. | 438 Use the command 'hg update' to switch to an existing branch. |
451 """ | 439 """ |
452 | 440 |
453 hexfunc = ui.debugflag and hex or short | 441 hexfunc = ui.debugflag and hex or short |
480 ui.write("%s %s:%s%s\n" % data) | 468 ui.write("%s %s:%s%s\n" % data) |
481 | 469 |
482 def bundle(ui, repo, fname, dest=None, **opts): | 470 def bundle(ui, repo, fname, dest=None, **opts): |
483 """create a changegroup file | 471 """create a changegroup file |
484 | 472 |
485 Generate a compressed changegroup file collecting changesets not | 473 Generate a compressed changegroup file collecting changesets not known to |
486 known to be in another repository. | 474 be in another repository. |
487 | 475 |
488 If no destination repository is specified the destination is | 476 If no destination repository is specified the destination is assumed to |
489 assumed to have all the nodes specified by one or more --base | 477 have all the nodes specified by one or more --base parameters. To create a |
490 parameters. To create a bundle containing all changesets, use | 478 bundle containing all changesets, use -a/--all (or --base null). |
491 -a/--all (or --base null). | 479 |
492 | 480 You can change compression method with the -t/--type option. The available |
493 You can change compression method with the -t/--type option. | 481 compression methods are: none, bzip2, and gzip (by default, bundles are |
494 The available compression methods are: none, bzip2, and | 482 compressed using bzip2). |
495 gzip (by default, bundles are compressed using bzip2). | 483 |
496 | 484 The bundle file can then be transferred using conventional means and |
497 The bundle file can then be transferred using conventional means | 485 applied to another repository with the unbundle or pull command. This is |
498 and applied to another repository with the unbundle or pull | 486 useful when direct push and pull are not available or when exporting an |
499 command. This is useful when direct push and pull are not | 487 entire repository is undesirable. |
500 available or when exporting an entire repository is undesirable. | 488 |
501 | 489 Applying bundles preserves all changeset contents including permissions, |
502 Applying bundles preserves all changeset contents including | 490 copy/rename information, and revision history. |
503 permissions, copy/rename information, and revision history. | |
504 """ | 491 """ |
505 revs = opts.get('rev') or None | 492 revs = opts.get('rev') or None |
506 if revs: | 493 if revs: |
507 revs = [repo.lookup(rev) for rev in revs] | 494 revs = [repo.lookup(rev) for rev in revs] |
508 if opts.get('all'): | 495 if opts.get('all'): |
555 changegroup.writebundle(cg, fname, bundletype) | 542 changegroup.writebundle(cg, fname, bundletype) |
556 | 543 |
557 def cat(ui, repo, file1, *pats, **opts): | 544 def cat(ui, repo, file1, *pats, **opts): |
558 """output the current or given revision of files | 545 """output the current or given revision of files |
559 | 546 |
560 Print the specified files as they were at the given revision. If | 547 Print the specified files as they were at the given revision. If no |
561 no revision is given, the parent of the working directory is used, | 548 revision is given, the parent of the working directory is used, or tip if |
562 or tip if no revision is checked out. | 549 no revision is checked out. |
563 | 550 |
564 Output may be to a file, in which case the name of the file is | 551 Output may be to a file, in which case the name of the file is given using |
565 given using a format string. The formatting rules are the same as | 552 a format string. The formatting rules are the same as for the export |
566 for the export command, with the following additions: | 553 command, with the following additions: |
567 | 554 |
568 %s basename of file being printed | 555 %s basename of file being printed |
569 %d dirname of file being printed, or '.' if in repository root | 556 %d dirname of file being printed, or '.' if in repository root |
570 %p root-relative path name of file being printed | 557 %p root-relative path name of file being printed |
571 """ | 558 """ |
584 def clone(ui, source, dest=None, **opts): | 571 def clone(ui, source, dest=None, **opts): |
585 """make a copy of an existing repository | 572 """make a copy of an existing repository |
586 | 573 |
587 Create a copy of an existing repository in a new directory. | 574 Create a copy of an existing repository in a new directory. |
588 | 575 |
589 If no destination directory name is specified, it defaults to the | 576 If no destination directory name is specified, it defaults to the basename |
590 basename of the source. | 577 of the source. |
591 | 578 |
592 The location of the source is added to the new repository's | 579 The location of the source is added to the new repository's .hg/hgrc file, |
593 .hg/hgrc file, as the default to be used for future pulls. | 580 as the default to be used for future pulls. |
594 | 581 |
595 If you use the -r/--rev option to clone up to a specific revision, | 582 If you use the -r/--rev option to clone up to a specific revision, no |
596 no subsequent revisions (including subsequent tags) will be | 583 subsequent revisions (including subsequent tags) will be present in the |
597 present in the cloned repository. This option implies --pull, even | 584 cloned repository. This option implies --pull, even on local repositories. |
598 on local repositories. | 585 |
599 | 586 By default, clone will check out the head of the 'default' branch. If the |
600 By default, clone will check out the head of the 'default' branch. | 587 -U/--noupdate option is used, the new clone will contain only a repository |
601 If the -U/--noupdate option is used, the new clone will contain | 588 (.hg) and no working copy (the working copy parent is the null revision). |
602 only a repository (.hg) and no working copy (the working copy | |
603 parent is the null revision). | |
604 | 589 |
605 See 'hg help urls' for valid source format details. | 590 See 'hg help urls' for valid source format details. |
606 | 591 |
607 It is possible to specify an ssh:// URL as the destination, but no | 592 It is possible to specify an ssh:// URL as the destination, but no |
608 .hg/hgrc and working directory will be created on the remote side. | 593 .hg/hgrc and working directory will be created on the remote side. Please |
609 Please see 'hg help urls' for important details about ssh:// URLs. | 594 see 'hg help urls' for important details about ssh:// URLs. |
610 | 595 |
611 For efficiency, hardlinks are used for cloning whenever the source | 596 For efficiency, hardlinks are used for cloning whenever the source and |
612 and destination are on the same filesystem (note this applies only | 597 destination are on the same filesystem (note this applies only to the |
613 to the repository data, not to the checked out files). Some | 598 repository data, not to the checked out files). Some filesystems, such as |
614 filesystems, such as AFS, implement hardlinking incorrectly, but | 599 AFS, implement hardlinking incorrectly, but do not report errors. In these |
615 do not report errors. In these cases, use the --pull option to | 600 cases, use the --pull option to avoid hardlinking. |
616 avoid hardlinking. | 601 |
617 | 602 In some cases, you can clone repositories and checked out files using full |
618 In some cases, you can clone repositories and checked out files | 603 hardlinks with |
619 using full hardlinks with | |
620 | 604 |
621 $ cp -al REPO REPOCLONE | 605 $ cp -al REPO REPOCLONE |
622 | 606 |
623 This is the fastest way to clone, but it is not always safe. The | 607 This is the fastest way to clone, but it is not always safe. The operation |
624 operation is not atomic (making sure REPO is not modified during | 608 is not atomic (making sure REPO is not modified during the operation is up |
625 the operation is up to you) and you have to make sure your editor | 609 to you) and you have to make sure your editor breaks hardlinks (Emacs and |
626 breaks hardlinks (Emacs and most Linux Kernel tools do so). Also, | 610 most Linux Kernel tools do so). Also, this is not compatible with certain |
627 this is not compatible with certain extensions that place their | 611 extensions that place their metadata under the .hg directory, such as mq. |
628 metadata under the .hg directory, such as mq. | |
629 | |
630 """ | 612 """ |
631 hg.clone(cmdutil.remoteui(ui, opts), source, dest, | 613 hg.clone(cmdutil.remoteui(ui, opts), source, dest, |
632 pull=opts.get('pull'), | 614 pull=opts.get('pull'), |
633 stream=opts.get('uncompressed'), | 615 stream=opts.get('uncompressed'), |
634 rev=opts.get('rev'), | 616 rev=opts.get('rev'), |
636 | 618 |
637 def commit(ui, repo, *pats, **opts): | 619 def commit(ui, repo, *pats, **opts): |
638 """commit the specified files or all outstanding changes | 620 """commit the specified files or all outstanding changes |
639 | 621 |
640 Commit changes to the given files into the repository. Unlike a | 622 Commit changes to the given files into the repository. Unlike a |
641 centralized RCS, this operation is a local operation. See hg push | 623 centralized RCS, this operation is a local operation. See hg push for a |
642 for a way to actively distribute your changes. | 624 way to actively distribute your changes. |
643 | 625 |
644 If a list of files is omitted, all changes reported by "hg status" | 626 If a list of files is omitted, all changes reported by "hg status" will be |
645 will be committed. | 627 committed. |
646 | 628 |
647 If you are committing the result of a merge, do not provide any | 629 If you are committing the result of a merge, do not provide any filenames |
648 filenames or -I/-X filters. | 630 or -I/-X filters. |
649 | 631 |
650 If no commit message is specified, the configured editor is | 632 If no commit message is specified, the configured editor is started to |
651 started to prompt you for a message. | 633 prompt you for a message. |
652 | 634 |
653 See 'hg help dates' for a list of formats valid for -d/--date. | 635 See 'hg help dates' for a list of formats valid for -d/--date. |
654 """ | 636 """ |
655 extra = {} | 637 extra = {} |
656 if opts.get('close_branch'): | 638 if opts.get('close_branch'): |
684 ui.write(_('committed changeset %d:%s\n') % (rev,short(node))) | 666 ui.write(_('committed changeset %d:%s\n') % (rev,short(node))) |
685 | 667 |
686 def copy(ui, repo, *pats, **opts): | 668 def copy(ui, repo, *pats, **opts): |
687 """mark files as copied for the next commit | 669 """mark files as copied for the next commit |
688 | 670 |
689 Mark dest as having copies of source files. If dest is a | 671 Mark dest as having copies of source files. If dest is a directory, copies |
690 directory, copies are put in that directory. If dest is a file, | 672 are put in that directory. If dest is a file, the source must be a single |
691 the source must be a single file. | 673 file. |
692 | 674 |
693 By default, this command copies the contents of files as they | 675 By default, this command copies the contents of files as they exist in the |
694 exist in the working directory. If invoked with -A/--after, the | 676 working directory. If invoked with -A/--after, the operation is recorded, |
695 operation is recorded, but no copying is performed. | 677 but no copying is performed. |
696 | 678 |
697 This command takes effect with the next commit. To undo a copy | 679 This command takes effect with the next commit. To undo a copy before |
698 before that, see hg revert. | 680 that, see hg revert. |
699 """ | 681 """ |
700 wlock = repo.wlock(False) | 682 wlock = repo.wlock(False) |
701 try: | 683 try: |
702 return cmdutil.copy(ui, repo, pats, opts) | 684 return cmdutil.copy(ui, repo, pats, opts) |
703 finally: | 685 finally: |
796 def showconfig(ui, repo, *values, **opts): | 778 def showconfig(ui, repo, *values, **opts): |
797 """show combined config settings from all hgrc files | 779 """show combined config settings from all hgrc files |
798 | 780 |
799 With no arguments, print names and values of all config items. | 781 With no arguments, print names and values of all config items. |
800 | 782 |
801 With one argument of the form section.name, print just the value | 783 With one argument of the form section.name, print just the value of that |
802 of that config item. | 784 config item. |
803 | 785 |
804 With multiple arguments, print names and values of all config | 786 With multiple arguments, print names and values of all config items with |
805 items with matching section names. | 787 matching section names. |
806 | 788 |
807 With --debug, the source (filename and line number) is printed | 789 With --debug, the source (filename and line number) is printed for each |
808 for each config item. | 790 config item. |
809 """ | 791 """ |
810 | 792 |
811 untrusted = bool(opts.get('untrusted')) | 793 untrusted = bool(opts.get('untrusted')) |
812 if values: | 794 if values: |
813 if len([v for v in values if '.' in v]) > 1: | 795 if len([v for v in values if '.' in v]) > 1: |
830 ui.write('%s=%s\n' % (sectname, value)) | 812 ui.write('%s=%s\n' % (sectname, value)) |
831 | 813 |
832 def debugsetparents(ui, repo, rev1, rev2=None): | 814 def debugsetparents(ui, repo, rev1, rev2=None): |
833 """manually set the parents of the current working directory | 815 """manually set the parents of the current working directory |
834 | 816 |
835 This is useful for writing repository conversion tools, but should | 817 This is useful for writing repository conversion tools, but should be used |
836 be used with care. | 818 with care. |
837 """ | 819 """ |
838 | 820 |
839 if not rev2: | 821 if not rev2: |
840 rev2 = hex(nullid) | 822 rev2 = hex(nullid) |
841 | 823 |
1065 | 1047 |
1066 Show differences between revisions for the specified files. | 1048 Show differences between revisions for the specified files. |
1067 | 1049 |
1068 Differences between files are shown using the unified diff format. | 1050 Differences between files are shown using the unified diff format. |
1069 | 1051 |
1070 NOTE: diff may generate unexpected results for merges, as it will | 1052 NOTE: diff may generate unexpected results for merges, as it will default |
1071 default to comparing against the working directory's first parent | 1053 to comparing against the working directory's first parent changeset if no |
1072 changeset if no revisions are specified. | 1054 revisions are specified. |
1073 | 1055 |
1074 When two revision arguments are given, then changes are shown | 1056 When two revision arguments are given, then changes are shown between |
1075 between those revisions. If only one revision is specified then | 1057 those revisions. If only one revision is specified then that revision is |
1076 that revision is compared to the working directory, and, when no | 1058 compared to the working directory, and, when no revisions are specified, |
1077 revisions are specified, the working directory files are compared | 1059 the working directory files are compared to its parent. |
1078 to its parent. | 1060 |
1079 | 1061 Without the -a/--text option, diff will avoid generating diffs of files it |
1080 Without the -a/--text option, diff will avoid generating diffs of | 1062 detects as binary. With -a, diff will generate a diff anyway, probably |
1081 files it detects as binary. With -a, diff will generate a diff | 1063 with undesirable results. |
1082 anyway, probably with undesirable results. | 1064 |
1083 | 1065 Use the -g/--git option to generate diffs in the git extended diff format. |
1084 Use the -g/--git option to generate diffs in the git extended diff | 1066 For more information, read 'hg help diffs'. |
1085 format. For more information, read 'hg help diffs'. | |
1086 """ | 1067 """ |
1087 | 1068 |
1088 revs = opts.get('rev') | 1069 revs = opts.get('rev') |
1089 change = opts.get('change') | 1070 change = opts.get('change') |
1090 | 1071 |
1105 def export(ui, repo, *changesets, **opts): | 1086 def export(ui, repo, *changesets, **opts): |
1106 """dump the header and diffs for one or more changesets | 1087 """dump the header and diffs for one or more changesets |
1107 | 1088 |
1108 Print the changeset header and diffs for one or more revisions. | 1089 Print the changeset header and diffs for one or more revisions. |
1109 | 1090 |
1110 The information shown in the changeset header is: author, | 1091 The information shown in the changeset header is: author, changeset hash, |
1111 changeset hash, parent(s) and commit comment. | 1092 parent(s) and commit comment. |
1112 | 1093 |
1113 NOTE: export may generate unexpected diff output for merge | 1094 NOTE: export may generate unexpected diff output for merge changesets, as |
1114 changesets, as it will compare the merge changeset against its | 1095 it will compare the merge changeset against its first parent only. |
1115 first parent only. | 1096 |
1116 | 1097 Output may be to a file, in which case the name of the file is given using |
1117 Output may be to a file, in which case the name of the file is | 1098 a format string. The formatting rules are as follows: |
1118 given using a format string. The formatting rules are as follows: | |
1119 | 1099 |
1120 %% literal "%" character | 1100 %% literal "%" character |
1121 %H changeset hash (40 bytes of hexadecimal) | 1101 %H changeset hash (40 bytes of hexadecimal) |
1122 %N number of patches being generated | 1102 %N number of patches being generated |
1123 %R changeset revision number | 1103 %R changeset revision number |
1124 %b basename of the exporting repository | 1104 %b basename of the exporting repository |
1125 %h short-form changeset hash (12 bytes of hexadecimal) | 1105 %h short-form changeset hash (12 bytes of hexadecimal) |
1126 %n zero-padded sequence number, starting at 1 | 1106 %n zero-padded sequence number, starting at 1 |
1127 %r zero-padded changeset revision number | 1107 %r zero-padded changeset revision number |
1128 | 1108 |
1129 Without the -a/--text option, export will avoid generating diffs | 1109 Without the -a/--text option, export will avoid generating diffs of files |
1130 of files it detects as binary. With -a, export will generate a | 1110 it detects as binary. With -a, export will generate a diff anyway, |
1131 diff anyway, probably with undesirable results. | 1111 probably with undesirable results. |
1132 | 1112 |
1133 Use the -g/--git option to generate diffs in the git extended diff | 1113 Use the -g/--git option to generate diffs in the git extended diff format. |
1134 format. See 'hg help diffs' for more information. | 1114 See 'hg help diffs' for more information. |
1135 | 1115 |
1136 With the --switch-parent option, the diff will be against the | 1116 With the --switch-parent option, the diff will be against the second |
1137 second parent. It can be useful to review a merge. | 1117 parent. It can be useful to review a merge. |
1138 """ | 1118 """ |
1139 if not changesets: | 1119 if not changesets: |
1140 raise util.Abort(_("export requires at least one changeset")) | 1120 raise util.Abort(_("export requires at least one changeset")) |
1141 revs = cmdutil.revrange(repo, changesets) | 1121 revs = cmdutil.revrange(repo, changesets) |
1142 if len(revs) > 1: | 1122 if len(revs) > 1: |
1148 opts=patch.diffopts(ui, opts)) | 1128 opts=patch.diffopts(ui, opts)) |
1149 | 1129 |
1150 def forget(ui, repo, *pats, **opts): | 1130 def forget(ui, repo, *pats, **opts): |
1151 """forget the specified files on the next commit | 1131 """forget the specified files on the next commit |
1152 | 1132 |
1153 Mark the specified files so they will no longer be tracked | 1133 Mark the specified files so they will no longer be tracked after the next |
1154 after the next commit. | 1134 commit. |
1155 | 1135 |
1156 This only removes files from the current branch, not from the | 1136 This only removes files from the current branch, not from the entire |
1157 entire project history, and it does not delete them from the | 1137 project history, and it does not delete them from the working directory. |
1158 working directory. | |
1159 | 1138 |
1160 To undo a forget before the next commit, see hg add. | 1139 To undo a forget before the next commit, see hg add. |
1161 """ | 1140 """ |
1162 | 1141 |
1163 if not pats: | 1142 if not pats: |
1182 """search for a pattern in specified files and revisions | 1161 """search for a pattern in specified files and revisions |
1183 | 1162 |
1184 Search revisions of files for a regular expression. | 1163 Search revisions of files for a regular expression. |
1185 | 1164 |
1186 This command behaves differently than Unix grep. It only accepts | 1165 This command behaves differently than Unix grep. It only accepts |
1187 Python/Perl regexps. It searches repository history, not the | 1166 Python/Perl regexps. It searches repository history, not the working |
1188 working directory. It always prints the revision number in which a | 1167 directory. It always prints the revision number in which a match appears. |
1189 match appears. | 1168 |
1190 | 1169 By default, grep only prints output for the first revision of a file in |
1191 By default, grep only prints output for the first revision of a | 1170 which it finds a match. To get it to print every revision that contains a |
1192 file in which it finds a match. To get it to print every revision | 1171 change in match status ("-" for a match that becomes a non-match, or "+" |
1193 that contains a change in match status ("-" for a match that | 1172 for a non-match that becomes a match), use the --all flag. |
1194 becomes a non-match, or "+" for a non-match that becomes a match), | |
1195 use the --all flag. | |
1196 """ | 1173 """ |
1197 reflags = 0 | 1174 reflags = 0 |
1198 if opts.get('ignore_case'): | 1175 if opts.get('ignore_case'): |
1199 reflags |= re.I | 1176 reflags |= re.I |
1200 try: | 1177 try: |
1364 def heads(ui, repo, *branchrevs, **opts): | 1341 def heads(ui, repo, *branchrevs, **opts): |
1365 """show current repository heads or show branch heads | 1342 """show current repository heads or show branch heads |
1366 | 1343 |
1367 With no arguments, show all repository head changesets. | 1344 With no arguments, show all repository head changesets. |
1368 | 1345 |
1369 Repository "heads" are changesets that don't have child | 1346 Repository "heads" are changesets that don't have child changesets. They |
1370 changesets. They are where development generally takes place and | 1347 are where development generally takes place and are the usual targets for |
1371 are the usual targets for update and merge operations. | 1348 update and merge operations. |
1372 | 1349 |
1373 If one or more REV is given, the "branch heads" will be shown for | 1350 If one or more REV is given, the "branch heads" will be shown for the |
1374 the named branch associated with that revision. The name of the | 1351 named branch associated with that revision. The name of the branch is |
1375 branch is called the revision's branch tag. | 1352 called the revision's branch tag. |
1376 | 1353 |
1377 Branch heads are revisions on a given named branch that do not have | 1354 Branch heads are revisions on a given named branch that do not have any |
1378 any descendants on the same branch. A branch head could be a true head | 1355 descendants on the same branch. A branch head could be a true head or it |
1379 or it could be the last changeset on a branch before a new branch | 1356 could be the last changeset on a branch before a new branch was created. |
1380 was created. If none of the branch heads are true heads, the branch | 1357 If none of the branch heads are true heads, the branch is considered |
1381 is considered inactive. If -c/--closed is specified, also show branch | 1358 inactive. If -c/--closed is specified, also show branch heads marked |
1382 heads marked closed (see hg commit --close-branch). | 1359 closed (see hg commit --close-branch). |
1383 | 1360 |
1384 If STARTREV is specified only those heads (or branch heads) that | 1361 If STARTREV is specified only those heads (or branch heads) that are |
1385 are descendants of STARTREV will be displayed. | 1362 descendants of STARTREV will be displayed. |
1386 """ | 1363 """ |
1387 if opts.get('rev'): | 1364 if opts.get('rev'): |
1388 start = repo.lookup(opts['rev']) | 1365 start = repo.lookup(opts['rev']) |
1389 else: | 1366 else: |
1390 start = None | 1367 start = None |
1426 def help_(ui, name=None, with_version=False): | 1403 def help_(ui, name=None, with_version=False): |
1427 """show help for a given topic or a help overview | 1404 """show help for a given topic or a help overview |
1428 | 1405 |
1429 With no arguments, print a list of commands with short help messages. | 1406 With no arguments, print a list of commands with short help messages. |
1430 | 1407 |
1431 Given a topic, extension, or command name, print help for that | 1408 Given a topic, extension, or command name, print help for that topic. |
1432 topic.""" | 1409 """ |
1433 option_lists = [] | 1410 option_lists = [] |
1434 | 1411 |
1435 def addglobalopts(aliases): | 1412 def addglobalopts(aliases): |
1436 if ui.verbose: | 1413 if ui.verbose: |
1437 option_lists.append((_("global options:"), globalopts)) | 1414 option_lists.append((_("global options:"), globalopts)) |
1635 | 1612 |
1636 def identify(ui, repo, source=None, | 1613 def identify(ui, repo, source=None, |
1637 rev=None, num=None, id=None, branch=None, tags=None): | 1614 rev=None, num=None, id=None, branch=None, tags=None): |
1638 """identify the working copy or specified revision | 1615 """identify the working copy or specified revision |
1639 | 1616 |
1640 With no revision, print a summary of the current state of the | 1617 With no revision, print a summary of the current state of the repository. |
1641 repository. | 1618 |
1642 | 1619 Specifying a path to a repository root or Mercurial bundle will cause |
1643 Specifying a path to a repository root or Mercurial bundle will | 1620 lookup to operate on that repository/bundle. |
1644 cause lookup to operate on that repository/bundle. | 1621 |
1645 | 1622 This summary identifies the repository state using one or two parent hash |
1646 This summary identifies the repository state using one or two | 1623 identifiers, followed by a "+" if there are uncommitted changes in the |
1647 parent hash identifiers, followed by a "+" if there are | 1624 working directory, a list of tags for this revision and a branch name for |
1648 uncommitted changes in the working directory, a list of tags for | 1625 non-default branches. |
1649 this revision and a branch name for non-default branches. | |
1650 """ | 1626 """ |
1651 | 1627 |
1652 if not repo and not source: | 1628 if not repo and not source: |
1653 raise util.Abort(_("There is no Mercurial repository here " | 1629 raise util.Abort(_("There is no Mercurial repository here " |
1654 "(.hg not found)")) | 1630 "(.hg not found)")) |
1711 def import_(ui, repo, patch1, *patches, **opts): | 1687 def import_(ui, repo, patch1, *patches, **opts): |
1712 """import an ordered set of patches | 1688 """import an ordered set of patches |
1713 | 1689 |
1714 Import a list of patches and commit them individually. | 1690 Import a list of patches and commit them individually. |
1715 | 1691 |
1716 If there are outstanding changes in the working directory, import | 1692 If there are outstanding changes in the working directory, import will |
1717 will abort unless given the -f/--force flag. | 1693 abort unless given the -f/--force flag. |
1718 | 1694 |
1719 You can import a patch straight from a mail message. Even patches | 1695 You can import a patch straight from a mail message. Even patches as |
1720 as attachments work (to use the body part, it must have type | 1696 attachments work (to use the body part, it must have type text/plain or |
1721 text/plain or text/x-patch). From and Subject headers of email | 1697 text/x-patch). From and Subject headers of email message are used as |
1722 message are used as default committer and commit message. All | 1698 default committer and commit message. All text/plain body parts before |
1723 text/plain body parts before first diff are added to commit | 1699 first diff are added to commit message. |
1724 message. | 1700 |
1725 | 1701 If the imported patch was generated by hg export, user and description |
1726 If the imported patch was generated by hg export, user and | 1702 from patch override values from message headers and body. Values given on |
1727 description from patch override values from message headers and | 1703 command line with -m/--message and -u/--user override these. |
1728 body. Values given on command line with -m/--message and -u/--user | 1704 |
1729 override these. | 1705 If --exact is specified, import will set the working directory to the |
1730 | 1706 parent of each patch before applying it, and will abort if the resulting |
1731 If --exact is specified, import will set the working directory to | 1707 changeset has a different ID than the one recorded in the patch. This may |
1732 the parent of each patch before applying it, and will abort if the | 1708 happen due to character set problems or other deficiencies in the text |
1733 resulting changeset has a different ID than the one recorded in | 1709 patch format. |
1734 the patch. This may happen due to character set problems or other | 1710 |
1735 deficiencies in the text patch format. | 1711 With -s/--similarity, hg will attempt to discover renames and copies in |
1736 | 1712 the patch in the same way as 'addremove'. |
1737 With -s/--similarity, hg will attempt to discover renames and | 1713 |
1738 copies in the patch in the same way as 'addremove'. | 1714 To read a patch from standard input, use "-" as the patch name. If a URL |
1739 | 1715 is specified, the patch will be downloaded from it. See 'hg help dates' |
1740 To read a patch from standard input, use "-" as the patch name. If | 1716 for a list of formats valid for -d/--date. |
1741 a URL is specified, the patch will be downloaded from it. | |
1742 See 'hg help dates' for a list of formats valid for -d/--date. | |
1743 """ | 1717 """ |
1744 patches = (patch1,) + patches | 1718 patches = (patch1,) + patches |
1745 | 1719 |
1746 date = opts.get('date') | 1720 date = opts.get('date') |
1747 if date: | 1721 if date: |
1837 release(lock, wlock) | 1811 release(lock, wlock) |
1838 | 1812 |
1839 def incoming(ui, repo, source="default", **opts): | 1813 def incoming(ui, repo, source="default", **opts): |
1840 """show new changesets found in source | 1814 """show new changesets found in source |
1841 | 1815 |
1842 Show new changesets found in the specified path/URL or the default | 1816 Show new changesets found in the specified path/URL or the default pull |
1843 pull location. These are the changesets that would have been pulled | 1817 location. These are the changesets that would have been pulled if a pull |
1844 if a pull at the time you issued this command. | 1818 at the time you issued this command. |
1845 | 1819 |
1846 For remote repository, using --bundle avoids downloading the | 1820 For remote repository, using --bundle avoids downloading the changesets |
1847 changesets twice if the incoming is followed by a pull. | 1821 twice if the incoming is followed by a pull. |
1848 | 1822 |
1849 See pull for valid source format details. | 1823 See pull for valid source format details. |
1850 """ | 1824 """ |
1851 limit = cmdutil.loglimit(opts) | 1825 limit = cmdutil.loglimit(opts) |
1852 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev')) | 1826 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev')) |
1906 os.unlink(cleanup) | 1880 os.unlink(cleanup) |
1907 | 1881 |
1908 def init(ui, dest=".", **opts): | 1882 def init(ui, dest=".", **opts): |
1909 """create a new repository in the given directory | 1883 """create a new repository in the given directory |
1910 | 1884 |
1911 Initialize a new repository in the given directory. If the given | 1885 Initialize a new repository in the given directory. If the given directory |
1912 directory does not exist, it will be created. | 1886 does not exist, it will be created. |
1913 | 1887 |
1914 If no directory is given, the current directory is used. | 1888 If no directory is given, the current directory is used. |
1915 | 1889 |
1916 It is possible to specify an ssh:// URL as the destination. | 1890 It is possible to specify an ssh:// URL as the destination. See 'hg help |
1917 See 'hg help urls' for more information. | 1891 urls' for more information. |
1918 """ | 1892 """ |
1919 hg.repository(cmdutil.remoteui(ui, opts), dest, create=1) | 1893 hg.repository(cmdutil.remoteui(ui, opts), dest, create=1) |
1920 | 1894 |
1921 def locate(ui, repo, *pats, **opts): | 1895 def locate(ui, repo, *pats, **opts): |
1922 """locate files matching specific patterns | 1896 """locate files matching specific patterns |
1923 | 1897 |
1924 Print files under Mercurial control in the working directory whose | 1898 Print files under Mercurial control in the working directory whose names |
1925 names match the given patterns. | 1899 match the given patterns. |
1926 | 1900 |
1927 By default, this command searches all directories in the working | 1901 By default, this command searches all directories in the working |
1928 directory. To search just the current directory and its | 1902 directory. To search just the current directory and its subdirectories, |
1929 subdirectories, use "--include .". | 1903 use "--include .". |
1930 | 1904 |
1931 If no patterns are given to match, this command prints the names | 1905 If no patterns are given to match, this command prints the names of all |
1932 of all files under Mercurial control in the working directory. | 1906 files under Mercurial control in the working directory. |
1933 | 1907 |
1934 If you want to feed the output of this command into the "xargs" | 1908 If you want to feed the output of this command into the "xargs" command, |
1935 command, use the -0 option to both this command and "xargs". This | 1909 use the -0 option to both this command and "xargs". This will avoid the |
1936 will avoid the problem of "xargs" treating single filenames that | 1910 problem of "xargs" treating single filenames that contain whitespace as |
1937 contain whitespace as multiple filenames. | 1911 multiple filenames. |
1938 """ | 1912 """ |
1939 end = opts.get('print0') and '\0' or '\n' | 1913 end = opts.get('print0') and '\0' or '\n' |
1940 rev = opts.get('rev') or None | 1914 rev = opts.get('rev') or None |
1941 | 1915 |
1942 ret = 1 | 1916 ret = 1 |
1954 return ret | 1928 return ret |
1955 | 1929 |
1956 def log(ui, repo, *pats, **opts): | 1930 def log(ui, repo, *pats, **opts): |
1957 """show revision history of entire repository or files | 1931 """show revision history of entire repository or files |
1958 | 1932 |
1959 Print the revision history of the specified files or the entire | 1933 Print the revision history of the specified files or the entire project. |
1960 project. | 1934 |
1961 | 1935 File history is shown without following rename or copy history of files. |
1962 File history is shown without following rename or copy history of | 1936 Use -f/--follow with a filename to follow history across renames and |
1963 files. Use -f/--follow with a filename to follow history across | 1937 copies. --follow without a filename will only show ancestors or |
1964 renames and copies. --follow without a filename will only show | 1938 descendants of the starting revision. --follow-first only follows the |
1965 ancestors or descendants of the starting revision. --follow-first | 1939 first parent of merge revisions. |
1966 only follows the first parent of merge revisions. | 1940 |
1967 | 1941 If no revision range is specified, the default is tip:0 unless --follow is |
1968 If no revision range is specified, the default is tip:0 unless | 1942 set, in which case the working directory parent is used as the starting |
1969 --follow is set, in which case the working directory parent is | 1943 revision. |
1970 used as the starting revision. | |
1971 | 1944 |
1972 See 'hg help dates' for a list of formats valid for -d/--date. | 1945 See 'hg help dates' for a list of formats valid for -d/--date. |
1973 | 1946 |
1974 By default this command prints revision number and changeset id, | 1947 By default this command prints revision number and changeset id, tags, |
1975 tags, non-trivial parents, user, date and time, and a summary for | 1948 non-trivial parents, user, date and time, and a summary for each commit. |
1976 each commit. When the -v/--verbose switch is used, the list of | 1949 When the -v/--verbose switch is used, the list of changed files and full |
1977 changed files and full commit message are shown. | 1950 commit message are shown. |
1978 | 1951 |
1979 NOTE: log -p/--patch may generate unexpected diff output for merge | 1952 NOTE: log -p/--patch may generate unexpected diff output for merge |
1980 changesets, as it will only compare the merge changeset against | 1953 changesets, as it will only compare the merge changeset against its first |
1981 its first parent. Also, only files different from BOTH parents | 1954 parent. Also, only files different from BOTH parents will appear in |
1982 will appear in files:. | 1955 files:. |
1983 """ | 1956 """ |
1984 | 1957 |
1985 get = util.cachefunc(lambda r: repo[r].changeset()) | 1958 get = util.cachefunc(lambda r: repo[r].changeset()) |
1986 changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts) | 1959 changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts) |
1987 | 1960 |
2080 count += 1 | 2053 count += 1 |
2081 | 2054 |
2082 def manifest(ui, repo, node=None, rev=None): | 2055 def manifest(ui, repo, node=None, rev=None): |
2083 """output the current or given revision of the project manifest | 2056 """output the current or given revision of the project manifest |
2084 | 2057 |
2085 Print a list of version controlled files for the given revision. | 2058 Print a list of version controlled files for the given revision. If no |
2086 If no revision is given, the first parent of the working directory | 2059 revision is given, the first parent of the working directory is used, or |
2087 is used, or the null revision if no revision is checked out. | 2060 the null revision if no revision is checked out. |
2088 | 2061 |
2089 With -v, print file permissions, symlink and executable bits. | 2062 With -v, print file permissions, symlink and executable bits. |
2090 With --debug, print file revision hashes. | 2063 With --debug, print file revision hashes. |
2091 """ | 2064 """ |
2092 | 2065 |
2106 ui.write("%s\n" % f) | 2079 ui.write("%s\n" % f) |
2107 | 2080 |
2108 def merge(ui, repo, node=None, **opts): | 2081 def merge(ui, repo, node=None, **opts): |
2109 """merge working directory with another revision | 2082 """merge working directory with another revision |
2110 | 2083 |
2111 The current working directory is updated with all changes made in | 2084 The current working directory is updated with all changes made in the |
2112 the requested revision since the last common predecessor revision. | 2085 requested revision since the last common predecessor revision. |
2113 | 2086 |
2114 Files that changed between either parent are marked as changed for | 2087 Files that changed between either parent are marked as changed for the |
2115 the next commit and a commit must be performed before any further | 2088 next commit and a commit must be performed before any further updates to |
2116 updates to the repository are allowed. The next commit will have | 2089 the repository are allowed. The next commit will have two parents. |
2117 two parents. | 2090 |
2118 | 2091 If no revision is specified, the working directory's parent is a head |
2119 If no revision is specified, the working directory's parent is a | 2092 revision, and the current branch contains exactly one other head, the |
2120 head revision, and the current branch contains exactly one other | 2093 other head is merged with by default. Otherwise, an explicit revision with |
2121 head, the other head is merged with by default. Otherwise, an | 2094 which to merge with must be provided. |
2122 explicit revision with which to merge with must be provided. | |
2123 """ | 2095 """ |
2124 | 2096 |
2125 if opts.get('rev') and node: | 2097 if opts.get('rev') and node: |
2126 raise util.Abort(_("please specify just one revision")) | 2098 raise util.Abort(_("please specify just one revision")) |
2127 if not node: | 2099 if not node: |
2164 return hg.merge(repo, node, force=opts.get('force')) | 2136 return hg.merge(repo, node, force=opts.get('force')) |
2165 | 2137 |
2166 def outgoing(ui, repo, dest=None, **opts): | 2138 def outgoing(ui, repo, dest=None, **opts): |
2167 """show changesets not found in destination | 2139 """show changesets not found in destination |
2168 | 2140 |
2169 Show changesets not found in the specified destination repository | 2141 Show changesets not found in the specified destination repository or the |
2170 or the default push location. These are the changesets that would | 2142 default push location. These are the changesets that would be pushed if a |
2171 be pushed if a push was requested. | 2143 push was requested. |
2172 | 2144 |
2173 See pull for valid destination format details. | 2145 See pull for valid destination format details. |
2174 """ | 2146 """ |
2175 limit = cmdutil.loglimit(opts) | 2147 limit = cmdutil.loglimit(opts) |
2176 dest, revs, checkout = hg.parseurl( | 2148 dest, revs, checkout = hg.parseurl( |
2199 displayer.show(repo[n]) | 2171 displayer.show(repo[n]) |
2200 | 2172 |
2201 def parents(ui, repo, file_=None, **opts): | 2173 def parents(ui, repo, file_=None, **opts): |
2202 """show the parents of the working directory or revision | 2174 """show the parents of the working directory or revision |
2203 | 2175 |
2204 Print the working directory's parent revisions. If a revision is | 2176 Print the working directory's parent revisions. If a revision is given via |
2205 given via -r/--rev, the parent of that revision will be printed. | 2177 -r/--rev, the parent of that revision will be printed. If a file argument |
2206 If a file argument is given, the revision in which the file was | 2178 is given, the revision in which the file was last changed (before the |
2207 last changed (before the working directory revision or the | 2179 working directory revision or the argument to --rev if given) is printed. |
2208 argument to --rev if given) is printed. | |
2209 """ | 2180 """ |
2210 rev = opts.get('rev') | 2181 rev = opts.get('rev') |
2211 if rev: | 2182 if rev: |
2212 ctx = repo[rev] | 2183 ctx = repo[rev] |
2213 else: | 2184 else: |
2239 displayer.show(repo[n]) | 2210 displayer.show(repo[n]) |
2240 | 2211 |
2241 def paths(ui, repo, search=None): | 2212 def paths(ui, repo, search=None): |
2242 """show aliases for remote repositories | 2213 """show aliases for remote repositories |
2243 | 2214 |
2244 Show definition of symbolic path name NAME. If no name is given, | 2215 Show definition of symbolic path name NAME. If no name is given, show |
2245 show definition of all available names. | 2216 definition of all available names. |
2246 | 2217 |
2247 Path names are defined in the [paths] section of /etc/mercurial/hgrc | 2218 Path names are defined in the [paths] section of /etc/mercurial/hgrc and |
2248 and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too. | 2219 $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too. |
2249 | 2220 |
2250 See 'hg help urls' for more information. | 2221 See 'hg help urls' for more information. |
2251 """ | 2222 """ |
2252 if search: | 2223 if search: |
2253 for name, path in ui.configitems("paths"): | 2224 for name, path in ui.configitems("paths"): |
2276 def pull(ui, repo, source="default", **opts): | 2247 def pull(ui, repo, source="default", **opts): |
2277 """pull changes from the specified source | 2248 """pull changes from the specified source |
2278 | 2249 |
2279 Pull changes from a remote repository to a local one. | 2250 Pull changes from a remote repository to a local one. |
2280 | 2251 |
2281 This finds all changes from the repository at the specified path | 2252 This finds all changes from the repository at the specified path or URL |
2282 or URL and adds them to a local repository (the current one unless | 2253 and adds them to a local repository (the current one unless -R is |
2283 -R is specified). By default, this does not update the copy of the | 2254 specified). By default, this does not update the copy of the project in |
2284 project in the working directory. | 2255 the working directory. |
2285 | 2256 |
2286 Use hg incoming if you want to see what would have been added by a | 2257 Use hg incoming if you want to see what would have been added by a pull at |
2287 pull at the time you issued this command. If you then decide to | 2258 the time you issued this command. If you then decide to added those |
2288 added those changes to the repository, you should use pull -r X | 2259 changes to the repository, you should use pull -r X where X is the last |
2289 where X is the last changeset listed by hg incoming. | 2260 changeset listed by hg incoming. |
2290 | 2261 |
2291 If SOURCE is omitted, the 'default' path will be used. | 2262 If SOURCE is omitted, the 'default' path will be used. See 'hg help urls' |
2292 See 'hg help urls' for more information. | 2263 for more information. |
2293 """ | 2264 """ |
2294 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev')) | 2265 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev')) |
2295 other = hg.repository(cmdutil.remoteui(repo, opts), source) | 2266 other = hg.repository(cmdutil.remoteui(repo, opts), source) |
2296 ui.status(_('pulling from %s\n') % url.hidepassword(source)) | 2267 ui.status(_('pulling from %s\n') % url.hidepassword(source)) |
2297 if revs: | 2268 if revs: |
2308 def push(ui, repo, dest=None, **opts): | 2279 def push(ui, repo, dest=None, **opts): |
2309 """push changes to the specified destination | 2280 """push changes to the specified destination |
2310 | 2281 |
2311 Push changes from the local repository to the given destination. | 2282 Push changes from the local repository to the given destination. |
2312 | 2283 |
2313 This is the symmetrical operation for pull. It moves changes from | 2284 This is the symmetrical operation for pull. It moves changes from the |
2314 the current repository to a different one. If the destination is | 2285 current repository to a different one. If the destination is local this is |
2315 local this is identical to a pull in that directory from the | 2286 identical to a pull in that directory from the current one. |
2316 current one. | |
2317 | 2287 |
2318 By default, push will refuse to run if it detects the result would | 2288 By default, push will refuse to run if it detects the result would |
2319 increase the number of remote heads. This generally indicates the | 2289 increase the number of remote heads. This generally indicates the user |
2320 user forgot to pull and merge before pushing. | 2290 forgot to pull and merge before pushing. |
2321 | 2291 |
2322 If -r/--rev is used, the named revision and all its ancestors will | 2292 If -r/--rev is used, the named revision and all its ancestors will be |
2323 be pushed to the remote repository. | 2293 pushed to the remote repository. |
2324 | 2294 |
2325 Please see 'hg help urls' for important details about ssh:// | 2295 Please see 'hg help urls' for important details about ssh:// URLs. If |
2326 URLs. If DESTINATION is omitted, a default path will be used. | 2296 DESTINATION is omitted, a default path will be used. |
2327 """ | 2297 """ |
2328 dest, revs, checkout = hg.parseurl( | 2298 dest, revs, checkout = hg.parseurl( |
2329 ui.expandpath(dest or 'default-push', dest or 'default'), opts.get('rev')) | 2299 ui.expandpath(dest or 'default-push', dest or 'default'), opts.get('rev')) |
2330 other = hg.repository(cmdutil.remoteui(repo, opts), dest) | 2300 other = hg.repository(cmdutil.remoteui(repo, opts), dest) |
2331 ui.status(_('pushing to %s\n') % url.hidepassword(dest)) | 2301 ui.status(_('pushing to %s\n') % url.hidepassword(dest)) |
2344 def recover(ui, repo): | 2314 def recover(ui, repo): |
2345 """roll back an interrupted transaction | 2315 """roll back an interrupted transaction |
2346 | 2316 |
2347 Recover from an interrupted commit or pull. | 2317 Recover from an interrupted commit or pull. |
2348 | 2318 |
2349 This command tries to fix the repository status after an | 2319 This command tries to fix the repository status after an interrupted |
2350 interrupted operation. It should only be necessary when Mercurial | 2320 operation. It should only be necessary when Mercurial suggests it. |
2351 suggests it. | |
2352 """ | 2321 """ |
2353 if repo.recover(): | 2322 if repo.recover(): |
2354 return hg.verify(repo) | 2323 return hg.verify(repo) |
2355 return 1 | 2324 return 1 |
2356 | 2325 |
2357 def remove(ui, repo, *pats, **opts): | 2326 def remove(ui, repo, *pats, **opts): |
2358 """remove the specified files on the next commit | 2327 """remove the specified files on the next commit |
2359 | 2328 |
2360 Schedule the indicated files for removal from the repository. | 2329 Schedule the indicated files for removal from the repository. |
2361 | 2330 |
2362 This only removes files from the current branch, not from the | 2331 This only removes files from the current branch, not from the entire |
2363 entire project history. -A/--after can be used to remove only | 2332 project history. -A/--after can be used to remove only files that have |
2364 files that have already been deleted, -f/--force can be used to | 2333 already been deleted, -f/--force can be used to force deletion, and -Af |
2365 force deletion, and -Af can be used to remove files from the next | 2334 can be used to remove files from the next revision without deleting them |
2366 revision without deleting them from the working directory. | 2335 from the working directory. |
2367 | 2336 |
2368 The following table details the behavior of remove for different | 2337 The following table details the behavior of remove for different file |
2369 file states (columns) and option combinations (rows). The file | 2338 states (columns) and option combinations (rows). The file states are Added |
2370 states are Added [A], Clean [C], Modified [M] and Missing [!] | 2339 [A], Clean [C], Modified [M] and Missing [!] (as reported by hg status). |
2371 (as reported by hg status). The actions are Warn, Remove (from | 2340 The actions are Warn, Remove (from branch) and Delete (from disk). |
2372 branch) and Delete (from disk). | |
2373 | 2341 |
2374 A C M ! | 2342 A C M ! |
2375 none W RD W R | 2343 none W RD W R |
2376 -f R RD RD R | 2344 -f R RD RD R |
2377 -A W W W R | 2345 -A W W W R |
2378 -Af R R R R | 2346 -Af R R R R |
2379 | 2347 |
2380 This command schedules the files to be removed at the next commit. | 2348 This command schedules the files to be removed at the next commit. To undo |
2381 To undo a remove before that, see hg revert. | 2349 a remove before that, see hg revert. |
2382 """ | 2350 """ |
2383 | 2351 |
2384 after, force = opts.get('after'), opts.get('force') | 2352 after, force = opts.get('after'), opts.get('force') |
2385 if not pats and not after: | 2353 if not pats and not after: |
2386 raise util.Abort(_('no files specified')) | 2354 raise util.Abort(_('no files specified')) |
2416 repo.remove(remove, unlink=not after) | 2384 repo.remove(remove, unlink=not after) |
2417 | 2385 |
2418 def rename(ui, repo, *pats, **opts): | 2386 def rename(ui, repo, *pats, **opts): |
2419 """rename files; equivalent of copy + remove | 2387 """rename files; equivalent of copy + remove |
2420 | 2388 |
2421 Mark dest as copies of sources; mark sources for deletion. If dest | 2389 Mark dest as copies of sources; mark sources for deletion. If dest is a |
2422 is a directory, copies are put in that directory. If dest is a | 2390 directory, copies are put in that directory. If dest is a file, there can |
2423 file, there can only be one source. | 2391 only be one source. |
2424 | 2392 |
2425 By default, this command copies the contents of files as they | 2393 By default, this command copies the contents of files as they exist in the |
2426 exist in the working directory. If invoked with -A/--after, the | 2394 working directory. If invoked with -A/--after, the operation is recorded, |
2427 operation is recorded, but no copying is performed. | 2395 but no copying is performed. |
2428 | 2396 |
2429 This command takes effect at the next commit. To undo a rename | 2397 This command takes effect at the next commit. To undo a rename before |
2430 before that, see hg revert. | 2398 that, see hg revert. |
2431 """ | 2399 """ |
2432 wlock = repo.wlock(False) | 2400 wlock = repo.wlock(False) |
2433 try: | 2401 try: |
2434 return cmdutil.copy(ui, repo, pats, opts, rename=True) | 2402 return cmdutil.copy(ui, repo, pats, opts, rename=True) |
2435 finally: | 2403 finally: |
2437 | 2405 |
2438 def resolve(ui, repo, *pats, **opts): | 2406 def resolve(ui, repo, *pats, **opts): |
2439 """retry file merges from a merge or update | 2407 """retry file merges from a merge or update |
2440 | 2408 |
2441 This command will cleanly retry unresolved file merges using file | 2409 This command will cleanly retry unresolved file merges using file |
2442 revisions preserved from the last update or merge. To attempt to | 2410 revisions preserved from the last update or merge. To attempt to resolve |
2443 resolve all unresolved files, use the -a/--all switch. | 2411 all unresolved files, use the -a/--all switch. |
2444 | 2412 |
2445 If a conflict is resolved manually, please note that the changes | 2413 If a conflict is resolved manually, please note that the changes will be |
2446 will be overwritten if the merge is retried with resolve. The | 2414 overwritten if the merge is retried with resolve. The -m/--mark switch |
2447 -m/--mark switch should be used to mark the file as resolved. | 2415 should be used to mark the file as resolved. |
2448 | 2416 |
2449 This command also allows listing resolved files and manually | 2417 This command also allows listing resolved files and manually indicating |
2450 indicating whether or not files are resolved. All files must be | 2418 whether or not files are resolved. All files must be marked as resolved |
2451 marked as resolved before a commit is permitted. | 2419 before a commit is permitted. |
2452 | 2420 |
2453 The codes used to show the status of files are: | 2421 The codes used to show the status of files are: |
2454 U = unresolved | 2422 U = unresolved |
2455 R = resolved | 2423 R = resolved |
2456 """ | 2424 """ |
2491 util.rename(a + ".resolve", a + ".orig") | 2459 util.rename(a + ".resolve", a + ".orig") |
2492 | 2460 |
2493 def revert(ui, repo, *pats, **opts): | 2461 def revert(ui, repo, *pats, **opts): |
2494 """restore individual files or directories to an earlier state | 2462 """restore individual files or directories to an earlier state |
2495 | 2463 |
2496 (Use update -r to check out earlier revisions, revert does not | 2464 (Use update -r to check out earlier revisions, revert does not change the |
2497 change the working directory parents.) | 2465 working directory parents.) |
2498 | 2466 |
2499 With no revision specified, revert the named files or directories | 2467 With no revision specified, revert the named files or directories to the |
2500 to the contents they had in the parent of the working directory. | 2468 contents they had in the parent of the working directory. This restores |
2501 This restores the contents of the affected files to an unmodified | 2469 the contents of the affected files to an unmodified state and unschedules |
2502 state and unschedules adds, removes, copies, and renames. If the | 2470 adds, removes, copies, and renames. If the working directory has two |
2503 working directory has two parents, you must explicitly specify the | 2471 parents, you must explicitly specify the revision to revert to. |
2504 revision to revert to. | 2472 |
2505 | 2473 Using the -r/--rev option, revert the given files or directories to their |
2506 Using the -r/--rev option, revert the given files or directories | 2474 contents as of a specific revision. This can be helpful to "roll back" |
2507 to their contents as of a specific revision. This can be helpful | 2475 some or all of an earlier change. See 'hg help dates' for a list of |
2508 to "roll back" some or all of an earlier change. See 'hg help | 2476 formats valid for -d/--date. |
2509 dates' for a list of formats valid for -d/--date. | 2477 |
2510 | 2478 Revert modifies the working directory. It does not commit any changes, or |
2511 Revert modifies the working directory. It does not commit any | 2479 change the parent of the working directory. If you revert to a revision |
2512 changes, or change the parent of the working directory. If you | 2480 other than the parent of the working directory, the reverted files will |
2513 revert to a revision other than the parent of the working | 2481 thus appear modified afterwards. |
2514 directory, the reverted files will thus appear modified | 2482 |
2515 afterwards. | 2483 If a file has been deleted, it is restored. If the executable mode of a |
2516 | 2484 file was changed, it is reset. |
2517 If a file has been deleted, it is restored. If the executable mode | 2485 |
2518 of a file was changed, it is reset. | 2486 If names are given, all files matching the names are reverted. If no |
2519 | 2487 arguments are given, no files are reverted. |
2520 If names are given, all files matching the names are reverted. | 2488 |
2521 If no arguments are given, no files are reverted. | 2489 Modified files are saved with a .orig suffix before reverting. To disable |
2522 | 2490 these backups, use --no-backup. |
2523 Modified files are saved with a .orig suffix before reverting. | |
2524 To disable these backups, use --no-backup. | |
2525 """ | 2491 """ |
2526 | 2492 |
2527 if opts["date"]: | 2493 if opts["date"]: |
2528 if opts["rev"]: | 2494 if opts["rev"]: |
2529 raise util.Abort(_("you can't specify a revision and a date")) | 2495 raise util.Abort(_("you can't specify a revision and a date")) |
2708 | 2674 |
2709 def rollback(ui, repo): | 2675 def rollback(ui, repo): |
2710 """roll back the last transaction | 2676 """roll back the last transaction |
2711 | 2677 |
2712 This command should be used with care. There is only one level of | 2678 This command should be used with care. There is only one level of |
2713 rollback, and there is no way to undo a rollback. It will also | 2679 rollback, and there is no way to undo a rollback. It will also restore the |
2714 restore the dirstate at the time of the last transaction, losing | 2680 dirstate at the time of the last transaction, losing any dirstate changes |
2715 any dirstate changes since that time. This command does not alter | 2681 since that time. This command does not alter the working directory. |
2716 the working directory. | 2682 |
2717 | 2683 Transactions are used to encapsulate the effects of all commands that |
2718 Transactions are used to encapsulate the effects of all commands | 2684 create new changesets or propagate existing changesets into a repository. |
2719 that create new changesets or propagate existing changesets into a | 2685 For example, the following commands are transactional, and their effects |
2720 repository. For example, the following commands are transactional, | 2686 can be rolled back: |
2721 and their effects can be rolled back: | |
2722 | 2687 |
2723 commit | 2688 commit |
2724 import | 2689 import |
2725 pull | 2690 pull |
2726 push (with this repository as destination) | 2691 push (with this repository as destination) |
2727 unbundle | 2692 unbundle |
2728 | 2693 |
2729 This command is not intended for use on public repositories. Once | 2694 This command is not intended for use on public repositories. Once changes |
2730 changes are visible for pull by other users, rolling a transaction | 2695 are visible for pull by other users, rolling a transaction back locally is |
2731 back locally is ineffective (someone else may already have pulled | 2696 ineffective (someone else may already have pulled the changes). |
2732 the changes). Furthermore, a race is possible with readers of the | 2697 Furthermore, a race is possible with readers of the repository; for |
2733 repository; for example an in-progress pull from the repository | 2698 example an in-progress pull from the repository may fail if a rollback is |
2734 may fail if a rollback is performed. | 2699 performed. |
2735 """ | 2700 """ |
2736 repo.rollback() | 2701 repo.rollback() |
2737 | 2702 |
2738 def root(ui, repo): | 2703 def root(ui, repo): |
2739 """print the root (top) of the current working directory | 2704 """print the root (top) of the current working directory |
2745 def serve(ui, repo, **opts): | 2710 def serve(ui, repo, **opts): |
2746 """export the repository via HTTP | 2711 """export the repository via HTTP |
2747 | 2712 |
2748 Start a local HTTP repository browser and pull server. | 2713 Start a local HTTP repository browser and pull server. |
2749 | 2714 |
2750 By default, the server logs accesses to stdout and errors to | 2715 By default, the server logs accesses to stdout and errors to stderr. Use |
2751 stderr. Use the -A/--accesslog and -E/--errorlog options to log to | 2716 the -A/--accesslog and -E/--errorlog options to log to files. |
2752 files. | |
2753 """ | 2717 """ |
2754 | 2718 |
2755 if opts["stdio"]: | 2719 if opts["stdio"]: |
2756 if repo is None: | 2720 if repo is None: |
2757 raise error.RepoError(_("There is no Mercurial repository here" | 2721 raise error.RepoError(_("There is no Mercurial repository here" |
2808 cmdutil.service(opts, initfn=service.init, runfn=service.run) | 2772 cmdutil.service(opts, initfn=service.init, runfn=service.run) |
2809 | 2773 |
2810 def status(ui, repo, *pats, **opts): | 2774 def status(ui, repo, *pats, **opts): |
2811 """show changed files in the working directory | 2775 """show changed files in the working directory |
2812 | 2776 |
2813 Show status of files in the repository. If names are given, only | 2777 Show status of files in the repository. If names are given, only files |
2814 files that match are shown. Files that are clean or ignored or | 2778 that match are shown. Files that are clean or ignored or the source of a |
2815 the source of a copy/move operation, are not listed unless | 2779 copy/move operation, are not listed unless -c/--clean, -i/--ignored, |
2816 -c/--clean, -i/--ignored, -C/--copies or -A/--all are given. | 2780 -C/--copies or -A/--all are given. Unless options described with "show |
2817 Unless options described with "show only ..." are given, the | 2781 only ..." are given, the options -mardu are used. |
2818 options -mardu are used. | 2782 |
2819 | 2783 Option -q/--quiet hides untracked (unknown and ignored) files unless |
2820 Option -q/--quiet hides untracked (unknown and ignored) files | 2784 explicitly requested with -u/--unknown or -i/--ignored. |
2821 unless explicitly requested with -u/--unknown or -i/--ignored. | 2785 |
2822 | 2786 NOTE: status may appear to disagree with diff if permissions have changed |
2823 NOTE: status may appear to disagree with diff if permissions have | 2787 or a merge has occurred. The standard diff format does not report |
2824 changed or a merge has occurred. The standard diff format does not | 2788 permission changes and diff only reports changes relative to one merge |
2825 report permission changes and diff only reports changes relative | 2789 parent. |
2826 to one merge parent. | 2790 |
2827 | 2791 If one revision is given, it is used as the base revision. If two |
2828 If one revision is given, it is used as the base revision. | 2792 revisions are given, the differences between them are shown. |
2829 If two revisions are given, the differences between them are | |
2830 shown. | |
2831 | 2793 |
2832 The codes used to show the status of files are: | 2794 The codes used to show the status of files are: |
2833 M = modified | 2795 M = modified |
2834 A = added | 2796 A = added |
2835 R = removed | 2797 R = removed |
2883 def tag(ui, repo, name1, *names, **opts): | 2845 def tag(ui, repo, name1, *names, **opts): |
2884 """add one or more tags for the current or given revision | 2846 """add one or more tags for the current or given revision |
2885 | 2847 |
2886 Name a particular revision using <name>. | 2848 Name a particular revision using <name>. |
2887 | 2849 |
2888 Tags are used to name particular revisions of the repository and are | 2850 Tags are used to name particular revisions of the repository and are very |
2889 very useful to compare different revisions, to go back to significant | 2851 useful to compare different revisions, to go back to significant earlier |
2890 earlier versions or to mark branch points as releases, etc. | 2852 versions or to mark branch points as releases, etc. |
2891 | 2853 |
2892 If no revision is given, the parent of the working directory is | 2854 If no revision is given, the parent of the working directory is used, or |
2893 used, or tip if no revision is checked out. | 2855 tip if no revision is checked out. |
2894 | 2856 |
2895 To facilitate version control, distribution, and merging of tags, | 2857 To facilitate version control, distribution, and merging of tags, they are |
2896 they are stored as a file named ".hgtags" which is managed | 2858 stored as a file named ".hgtags" which is managed similarly to other |
2897 similarly to other project files and can be hand-edited if | 2859 project files and can be hand-edited if necessary. The file |
2898 necessary. The file '.hg/localtags' is used for local tags (not | 2860 '.hg/localtags' is used for local tags (not shared among repositories). |
2899 shared among repositories). | |
2900 | 2861 |
2901 See 'hg help dates' for a list of formats valid for -d/--date. | 2862 See 'hg help dates' for a list of formats valid for -d/--date. |
2902 """ | 2863 """ |
2903 | 2864 |
2904 rev_ = "." | 2865 rev_ = "." |
2947 repo.tag(names, r, message, opts.get('local'), opts.get('user'), date) | 2908 repo.tag(names, r, message, opts.get('local'), opts.get('user'), date) |
2948 | 2909 |
2949 def tags(ui, repo): | 2910 def tags(ui, repo): |
2950 """list repository tags | 2911 """list repository tags |
2951 | 2912 |
2952 This lists both regular and local tags. When the -v/--verbose | 2913 This lists both regular and local tags. When the -v/--verbose switch is |
2953 switch is used, a third column "local" is printed for local tags. | 2914 used, a third column "local" is printed for local tags. |
2954 """ | 2915 """ |
2955 | 2916 |
2956 hexfunc = ui.debugflag and hex or short | 2917 hexfunc = ui.debugflag and hex or short |
2957 tagtype = "" | 2918 tagtype = "" |
2958 | 2919 |
2976 ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype)) | 2937 ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype)) |
2977 | 2938 |
2978 def tip(ui, repo, **opts): | 2939 def tip(ui, repo, **opts): |
2979 """show the tip revision | 2940 """show the tip revision |
2980 | 2941 |
2981 The tip revision (usually just called the tip) is the changeset | 2942 The tip revision (usually just called the tip) is the changeset most |
2982 most recently added to the repository (and therefore the most | 2943 recently added to the repository (and therefore the most recently changed |
2983 recently changed head). | 2944 head). |
2984 | 2945 |
2985 If you have just made a commit, that commit will be the tip. If | 2946 If you have just made a commit, that commit will be the tip. If you have |
2986 you have just pulled changes from another repository, the tip of | 2947 just pulled changes from another repository, the tip of that repository |
2987 that repository becomes the current tip. The "tip" tag is special | 2948 becomes the current tip. The "tip" tag is special and cannot be renamed or |
2988 and cannot be renamed or assigned to a different changeset. | 2949 assigned to a different changeset. |
2989 """ | 2950 """ |
2990 cmdutil.show_changeset(ui, repo, opts).show(repo[len(repo) - 1]) | 2951 cmdutil.show_changeset(ui, repo, opts).show(repo[len(repo) - 1]) |
2991 | 2952 |
2992 def unbundle(ui, repo, fname1, *fnames, **opts): | 2953 def unbundle(ui, repo, fname1, *fnames, **opts): |
2993 """apply one or more changegroup files | 2954 """apply one or more changegroup files |
2994 | 2955 |
2995 Apply one or more compressed changegroup files generated by the | 2956 Apply one or more compressed changegroup files generated by the bundle |
2996 bundle command. | 2957 command. |
2997 """ | 2958 """ |
2998 fnames = (fname1,) + fnames | 2959 fnames = (fname1,) + fnames |
2999 | 2960 |
3000 lock = repo.lock() | 2961 lock = repo.lock() |
3001 try: | 2962 try: |
3009 return postincoming(ui, repo, modheads, opts.get('update'), None) | 2970 return postincoming(ui, repo, modheads, opts.get('update'), None) |
3010 | 2971 |
3011 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False): | 2972 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False): |
3012 """update working directory | 2973 """update working directory |
3013 | 2974 |
3014 Update the repository's working directory to the specified | 2975 Update the repository's working directory to the specified revision, or |
3015 revision, or the tip of the current branch if none is specified. | 2976 the tip of the current branch if none is specified. Use null as the |
3016 Use null as the revision to remove the working copy (like 'hg | 2977 revision to remove the working copy (like 'hg clone -U'). |
3017 clone -U'). | 2978 |
3018 | 2979 When the working directory contains no uncommitted changes, it will be |
3019 When the working directory contains no uncommitted changes, it | 2980 replaced by the state of the requested revision from the repository. When |
3020 will be replaced by the state of the requested revision from the | 2981 the requested revision is on a different branch, the working directory |
3021 repository. When the requested revision is on a different branch, | 2982 will additionally be switched to that branch. |
3022 the working directory will additionally be switched to that | 2983 |
3023 branch. | 2984 When there are uncommitted changes, use option -C/--clean to discard them, |
3024 | 2985 forcibly replacing the state of the working directory with the requested |
3025 When there are uncommitted changes, use option -C/--clean to | 2986 revision. Alternately, use -c/--check to abort. |
3026 discard them, forcibly replacing the state of the working | 2987 |
3027 directory with the requested revision. Alternately, use -c/--check | 2988 When there are uncommitted changes and option -C/--clean is not used, and |
3028 to abort. | 2989 the parent revision and requested revision are on the same branch, and one |
3029 | 2990 of them is an ancestor of the other, then the new working directory will |
3030 When there are uncommitted changes and option -C/--clean is not | 2991 contain the requested revision merged with the uncommitted changes. |
3031 used, and the parent revision and requested revision are on the | 2992 Otherwise, the update will fail with a suggestion to use 'merge' or |
3032 same branch, and one of them is an ancestor of the other, then the | 2993 'update -C' instead. |
3033 new working directory will contain the requested revision merged | 2994 |
3034 with the uncommitted changes. Otherwise, the update will fail with | 2995 If you want to update just one file to an older revision, use revert. |
3035 a suggestion to use 'merge' or 'update -C' instead. | |
3036 | |
3037 If you want to update just one file to an older revision, use | |
3038 revert. | |
3039 | 2996 |
3040 See 'hg help dates' for a list of formats valid for -d/--date. | 2997 See 'hg help dates' for a list of formats valid for -d/--date. |
3041 """ | 2998 """ |
3042 if rev and node: | 2999 if rev and node: |
3043 raise util.Abort(_("please specify just one revision")) | 3000 raise util.Abort(_("please specify just one revision")) |
3064 def verify(ui, repo): | 3021 def verify(ui, repo): |
3065 """verify the integrity of the repository | 3022 """verify the integrity of the repository |
3066 | 3023 |
3067 Verify the integrity of the current repository. | 3024 Verify the integrity of the current repository. |
3068 | 3025 |
3069 This will perform an extensive check of the repository's | 3026 This will perform an extensive check of the repository's integrity, |
3070 integrity, validating the hashes and checksums of each entry in | 3027 validating the hashes and checksums of each entry in the changelog, |
3071 the changelog, manifest, and tracked files, as well as the | 3028 manifest, and tracked files, as well as the integrity of their crosslinks |
3072 integrity of their crosslinks and indices. | 3029 and indices. |
3073 """ | 3030 """ |
3074 return hg.verify(repo) | 3031 return hg.verify(repo) |
3075 | 3032 |
3076 def version_(ui): | 3033 def version_(ui): |
3077 """output version and copyright information""" | 3034 """output version and copyright information""" |