Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 8033:aeb4a5c7a28e
commands: consistently write switches as -a/--abc
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Wed, 08 Apr 2009 21:20:31 +0200 |
parents | 4726a522a182 |
children | 15725dbc900f |
comparison
equal
deleted
inserted
replaced
8032:4726a522a182 | 8033:aeb4a5c7a28e |
---|---|
54 | 54 |
55 New files are ignored if they match any of the patterns in | 55 New files are ignored if they match any of the patterns in |
56 .hgignore. As with add, these changes take effect at the next | 56 .hgignore. As with add, these changes take effect at the next |
57 commit. | 57 commit. |
58 | 58 |
59 Use the -s option to detect renamed files. With a parameter > 0, | 59 Use the -s/--similarity option to detect renamed files. With a |
60 this compares every removed file with every added file and records | 60 parameter > 0, this compares every removed file with every added |
61 those similar enough as renames. This option takes a percentage | 61 file and records those similar enough as renames. This option |
62 between 0 (disabled) and 100 (files must be identical) as its | 62 takes a percentage between 0 (disabled) and 100 (files must be |
63 parameter. Detecting renamed files this way can be expensive. | 63 identical) as its parameter. Detecting renamed files this way can |
64 be expensive. | |
64 """ | 65 """ |
65 try: | 66 try: |
66 sim = float(opts.get('similarity') or 0) | 67 sim = float(opts.get('similarity') or 0) |
67 except ValueError: | 68 except ValueError: |
68 raise util.Abort(_('similarity must be a number')) | 69 raise util.Abort(_('similarity must be a number')) |
77 each line | 78 each line |
78 | 79 |
79 This command is useful to discover who did a change or when a | 80 This command is useful to discover who did a change or when a |
80 change took place. | 81 change took place. |
81 | 82 |
82 Without the -a option, annotate will avoid processing files it | 83 Without the -a/--text option, annotate will avoid processing files |
83 detects as binary. With -a, annotate will generate an annotation | 84 it detects as binary. With -a, annotate will generate an |
84 anyway, probably with undesirable results. | 85 annotation anyway, probably with undesirable results. |
85 """ | 86 """ |
86 datefunc = ui.quiet and util.shortdate or util.datestr | 87 datefunc = ui.quiet and util.shortdate or util.datestr |
87 getdate = util.cachefunc(lambda x: datefunc(x[0].date())) | 88 getdate = util.cachefunc(lambda x: datefunc(x[0].date())) |
88 | 89 |
89 if not pats: | 90 if not pats: |
134 | 135 |
135 def archive(ui, repo, dest, **opts): | 136 def archive(ui, repo, dest, **opts): |
136 '''create unversioned archive of a repository revision | 137 '''create unversioned archive of a repository revision |
137 | 138 |
138 By default, the revision used is the parent of the working | 139 By default, the revision used is the parent of the working |
139 directory; use -r to specify a different revision. | 140 directory; use -r/--rev to specify a different revision. |
140 | 141 |
141 To specify the type of archive to create, use -t. Valid types are: | 142 To specify the type of archive to create, use -t/--type. Valid |
143 types are: | |
142 | 144 |
143 "files" (default): a directory full of files | 145 "files" (default): a directory full of files |
144 "tar": tar archive, uncompressed | 146 "tar": tar archive, uncompressed |
145 "tbz2": tar archive, compressed using bzip2 | 147 "tbz2": tar archive, compressed using bzip2 |
146 "tgz": tar archive, compressed using gzip | 148 "tgz": tar archive, compressed using gzip |
149 | 151 |
150 The exact name of the destination archive or directory is given | 152 The exact name of the destination archive or directory is given |
151 using a format string; see 'hg help export' for details. | 153 using a format string; see 'hg help export' for details. |
152 | 154 |
153 Each member added to an archive file has a directory prefix | 155 Each member added to an archive file has a directory prefix |
154 prepended. Use -p to specify a format string for the prefix. The | 156 prepended. Use -p/--prefix to specify a format string for the |
155 default is the basename of the archive, with suffixes removed. | 157 prefix. The default is the basename of the archive, with suffixes |
158 removed. | |
156 ''' | 159 ''' |
157 | 160 |
158 ctx = repo[opts.get('rev')] | 161 ctx = repo[opts.get('rev')] |
159 if not ctx: | 162 if not ctx: |
160 raise util.Abort(_('no working directory: please specify a revision')) | 163 raise util.Abort(_('no working directory: please specify a revision')) |
266 | 269 |
267 This command helps to find changesets which introduce problems. To | 270 This command helps to find changesets which introduce problems. To |
268 use, mark the earliest changeset you know exhibits the problem as | 271 use, mark the earliest changeset you know exhibits the problem as |
269 bad, then mark the latest changeset which is free from the problem | 272 bad, then mark the latest changeset which is free from the problem |
270 as good. Bisect will update your working directory to a revision | 273 as good. Bisect will update your working directory to a revision |
271 for testing (unless the --noupdate option is specified). Once you | 274 for testing (unless the -U/--noupdate option is specified). Once |
272 have performed tests, mark the working directory as bad or good | 275 you have performed tests, mark the working directory as bad or |
273 and bisect will either update to another candidate changeset or | 276 good and bisect will either update to another candidate changeset |
274 announce that it has found the bad revision. | 277 or announce that it has found the bad revision. |
275 | 278 |
276 As a shortcut, you can also use the revision argument to mark a | 279 As a shortcut, you can also use the revision argument to mark a |
277 revision as good or bad without checking it out first. | 280 revision as good or bad without checking it out first. |
278 | 281 |
279 If you supply a command it will be used for automatic bisection. | 282 If you supply a command it will be used for automatic bisection. |
397 With no argument, show the current branch name. With one argument, | 400 With no argument, show the current branch name. With one argument, |
398 set the working directory branch name (the branch does not exist | 401 set the working directory branch name (the branch does not exist |
399 in the repository until the next commit). It is recommended to use | 402 in the repository until the next commit). It is recommended to use |
400 the 'default' branch as your primary development branch. | 403 the 'default' branch as your primary development branch. |
401 | 404 |
402 Unless --force is specified, branch will not let you set a branch | 405 Unless -f/--force is specified, branch will not let you set a |
403 name that shadows an existing branch. | 406 branch name that shadows an existing branch. |
404 | 407 |
405 Use --clean to reset the working directory branch to that of the | 408 Use -C/--clean to reset the working directory branch to that of |
406 parent of the working directory, negating a previous branch | 409 the parent of the working directory, negating a previous branch |
407 change. | 410 change. |
408 | 411 |
409 Use the command 'hg update' to switch to an existing branch. | 412 Use the command 'hg update' to switch to an existing branch. |
410 """ | 413 """ |
411 | 414 |
463 known to be in another repository. | 466 known to be in another repository. |
464 | 467 |
465 If no destination repository is specified the destination is | 468 If no destination repository is specified the destination is |
466 assumed to have all the nodes specified by one or more --base | 469 assumed to have all the nodes specified by one or more --base |
467 parameters. To create a bundle containing all changesets, use | 470 parameters. To create a bundle containing all changesets, use |
468 --all (or --base null). To change the compression method applied, | 471 -a/--all (or --base null). To change the compression method |
469 use the -t option (by default, bundles are compressed using bz2). | 472 applied, use the -t/--type option (by default, bundles are |
473 compressed using bz2). | |
470 | 474 |
471 The bundle file can then be transferred using conventional means | 475 The bundle file can then be transferred using conventional means |
472 and applied to another repository with the unbundle or pull | 476 and applied to another repository with the unbundle or pull |
473 command. This is useful when direct push and pull are not | 477 command. This is useful when direct push and pull are not |
474 available or when exporting an entire repository is undesirable. | 478 available or when exporting an entire repository is undesirable. |
565 basename of the source. | 569 basename of the source. |
566 | 570 |
567 The location of the source is added to the new repository's | 571 The location of the source is added to the new repository's |
568 .hg/hgrc file, as the default to be used for future pulls. | 572 .hg/hgrc file, as the default to be used for future pulls. |
569 | 573 |
570 If you use the -r option to clone up to a specific revision, no | 574 If you use the -r/--rev option to clone up to a specific revision, |
571 subsequent revisions (including subsequent tags) will be present | 575 no subsequent revisions (including subsequent tags) will be |
572 in the cloned repository. This option implies --pull, even on | 576 present in the cloned repository. This option implies --pull, even |
573 local repositories. | 577 on local repositories. |
574 | 578 |
575 By default, clone will check out the head of the 'default' branch. | 579 By default, clone will check out the head of the 'default' branch. |
576 If the -U option is used, the new clone will contain only a | 580 If the -U/--noupdate option is used, the new clone will contain |
577 repository (.hg) and no working copy (the working copy parent is | 581 only a repository (.hg) and no working copy (the working copy |
578 the null revision). | 582 parent is the null revision). |
579 | 583 |
580 See 'hg help urls' for valid source format details. | 584 See 'hg help urls' for valid source format details. |
581 | 585 |
582 It is possible to specify an ssh:// URL as the destination, but no | 586 It is possible to specify an ssh:// URL as the destination, but no |
583 .hg/hgrc and working directory will be created on the remote side. | 587 .hg/hgrc and working directory will be created on the remote side. |
662 Mark dest as having copies of source files. If dest is a | 666 Mark dest as having copies of source files. If dest is a |
663 directory, copies are put in that directory. If dest is a file, | 667 directory, copies are put in that directory. If dest is a file, |
664 the source must be a single file. | 668 the source must be a single file. |
665 | 669 |
666 By default, this command copies the contents of files as they | 670 By default, this command copies the contents of files as they |
667 stand in the working directory. If invoked with --after, the | 671 stand in the working directory. If invoked with -A/--after, the |
668 operation is recorded, but no copying is performed. | 672 operation is recorded, but no copying is performed. |
669 | 673 |
670 This command takes effect with the next commit. To undo a copy | 674 This command takes effect with the next commit. To undo a copy |
671 before that, see hg revert. | 675 before that, see hg revert. |
672 """ | 676 """ |
1030 between those revisions. If only one revision is specified then | 1034 between those revisions. If only one revision is specified then |
1031 that revision is compared to the working directory, and, when no | 1035 that revision is compared to the working directory, and, when no |
1032 revisions are specified, the working directory files are compared | 1036 revisions are specified, the working directory files are compared |
1033 to its parent. | 1037 to its parent. |
1034 | 1038 |
1035 Without the -a option, diff will avoid generating diffs of files | 1039 Without the -a/--text option, diff will avoid generating diffs of |
1036 it detects as binary. With -a, diff will generate a diff anyway, | 1040 files it detects as binary. With -a, diff will generate a diff |
1037 probably with undesirable results. | 1041 anyway, probably with undesirable results. |
1038 | 1042 |
1039 Use the --git option to generate diffs in the git extended diff | 1043 Use the -g/--git option to generate diffs in the git extended diff |
1040 format. For more information, read 'hg help diffs'. | 1044 format. For more information, read 'hg help diffs'. |
1041 """ | 1045 """ |
1042 | 1046 |
1043 revs = opts.get('rev') | 1047 revs = opts.get('rev') |
1044 change = opts.get('change') | 1048 change = opts.get('change') |
1079 %b basename of the exporting repository | 1083 %b basename of the exporting repository |
1080 %h short-form changeset hash (12 bytes of hexadecimal) | 1084 %h short-form changeset hash (12 bytes of hexadecimal) |
1081 %n zero-padded sequence number, starting at 1 | 1085 %n zero-padded sequence number, starting at 1 |
1082 %r zero-padded changeset revision number | 1086 %r zero-padded changeset revision number |
1083 | 1087 |
1084 Without the -a option, export will avoid generating diffs of files | 1088 Without the -a/--text option, export will avoid generating diffs |
1085 it detects as binary. With -a, export will generate a diff anyway, | 1089 of files it detects as binary. With -a, export will generate a |
1086 probably with undesirable results. | 1090 diff anyway, probably with undesirable results. |
1087 | 1091 |
1088 Use the --git option to generate diffs in the git extended diff | 1092 Use the -g/--git option to generate diffs in the git extended diff |
1089 format. Read the diffs help topic for more information. | 1093 format. Read the diffs help topic for more information. |
1090 | 1094 |
1091 With the --switch-parent option, the diff will be against the | 1095 With the --switch-parent option, the diff will be against the |
1092 second parent. It can be useful to review a merge. | 1096 second parent. It can be useful to review a merge. |
1093 """ | 1097 """ |
1610 """import an ordered set of patches | 1614 """import an ordered set of patches |
1611 | 1615 |
1612 Import a list of patches and commit them individually. | 1616 Import a list of patches and commit them individually. |
1613 | 1617 |
1614 If there are outstanding changes in the working directory, import | 1618 If there are outstanding changes in the working directory, import |
1615 will abort unless given the -f flag. | 1619 will abort unless given the -f/--force flag. |
1616 | 1620 |
1617 You can import a patch straight from a mail message. Even patches | 1621 You can import a patch straight from a mail message. Even patches |
1618 as attachments work (body part must be type text/plain or | 1622 as attachments work (body part must be type text/plain or |
1619 text/x-patch to be used). From and Subject headers of email | 1623 text/x-patch to be used). From and Subject headers of email |
1620 message are used as default committer and commit message. All | 1624 message are used as default committer and commit message. All |
1621 text/plain body parts before first diff are added to commit | 1625 text/plain body parts before first diff are added to commit |
1622 message. | 1626 message. |
1623 | 1627 |
1624 If the imported patch was generated by hg export, user and | 1628 If the imported patch was generated by hg export, user and |
1625 description from patch override values from message headers and | 1629 description from patch override values from message headers and |
1626 body. Values given on command line with -m and -u override these. | 1630 body. Values given on command line with -m/--message and -u/--user |
1631 override these. | |
1627 | 1632 |
1628 If --exact is specified, import will set the working directory to | 1633 If --exact is specified, import will set the working directory to |
1629 the parent of each patch before applying it, and will abort if the | 1634 the parent of each patch before applying it, and will abort if the |
1630 resulting changeset has a different ID than the one recorded in | 1635 resulting changeset has a different ID than the one recorded in |
1631 the patch. This may happen due to character set problems or other | 1636 the patch. This may happen due to character set problems or other |
1632 deficiencies in the text patch format. | 1637 deficiencies in the text patch format. |
1633 | 1638 |
1634 With --similarity, hg will attempt to discover renames and copies | 1639 With -s/--similarity, hg will attempt to discover renames and |
1635 in the patch in the same way as 'addremove'. | 1640 copies in the patch in the same way as 'addremove'. |
1636 | 1641 |
1637 To read a patch from standard input, use patch name "-". See 'hg | 1642 To read a patch from standard input, use patch name "-". See 'hg |
1638 help dates' for a list of formats valid for -d/--date. | 1643 help dates' for a list of formats valid for -d/--date. |
1639 """ | 1644 """ |
1640 patches = (patch1,) + patches | 1645 patches = (patch1,) + patches |
1871 By default this command outputs: changeset id and hash, tags, | 1876 By default this command outputs: changeset id and hash, tags, |
1872 non-trivial parents, user, date and time, and a summary for each | 1877 non-trivial parents, user, date and time, and a summary for each |
1873 commit. When the -v/--verbose switch is used, the list of changed | 1878 commit. When the -v/--verbose switch is used, the list of changed |
1874 files and full commit message is shown. | 1879 files and full commit message is shown. |
1875 | 1880 |
1876 NOTE: log -p may generate unexpected diff output for merge | 1881 NOTE: log -p/--patch may generate unexpected diff output for merge |
1877 changesets, as it will only compare the merge changeset against | 1882 changesets, as it will only compare the merge changeset against |
1878 its first parent. Also, the files: list will only reflect files | 1883 its first parent. Also, the files: list will only reflect files |
1879 that are different from BOTH parents. | 1884 that are different from BOTH parents. |
1880 | 1885 |
1881 """ | 1886 """ |
2088 | 2093 |
2089 def parents(ui, repo, file_=None, **opts): | 2094 def parents(ui, repo, file_=None, **opts): |
2090 """show the parents of the working directory or revision | 2095 """show the parents of the working directory or revision |
2091 | 2096 |
2092 Print the working directory's parent revisions. If a revision is | 2097 Print the working directory's parent revisions. If a revision is |
2093 given via --rev, the parent of that revision will be printed. If a | 2098 given via -r/--rev, the parent of that revision will be printed. |
2094 file argument is given, revision in which the file was last | 2099 If a file argument is given, revision in which the file was last |
2095 changed (before the working directory revision or the argument to | 2100 changed (before the working directory revision or the argument to |
2096 --rev if given) is printed. | 2101 --rev if given) is printed. |
2097 """ | 2102 """ |
2098 rev = opts.get('rev') | 2103 rev = opts.get('rev') |
2099 if rev: | 2104 if rev: |
2204 | 2209 |
2205 By default, push will refuse to run if it detects the result would | 2210 By default, push will refuse to run if it detects the result would |
2206 increase the number of remote heads. This generally indicates the | 2211 increase the number of remote heads. This generally indicates the |
2207 the client has forgotten to pull and merge before pushing. | 2212 the client has forgotten to pull and merge before pushing. |
2208 | 2213 |
2209 If -r is used, the named revision and all its ancestors will be | 2214 If -r/--rev is used, the named revision and all its ancestors will |
2210 pushed to the remote repository. | 2215 be pushed to the remote repository. |
2211 | 2216 |
2212 Look at the help text for URLs for important details about ssh:// | 2217 Look at the help text for URLs for important details about ssh:// |
2213 URLs. If DESTINATION is omitted, a default path will be used. | 2218 URLs. If DESTINATION is omitted, a default path will be used. |
2214 See 'hg help urls' for more information. | 2219 See 'hg help urls' for more information. |
2215 """ | 2220 """ |
2269 """remove the specified files on the next commit | 2274 """remove the specified files on the next commit |
2270 | 2275 |
2271 Schedule the indicated files for removal from the repository. | 2276 Schedule the indicated files for removal from the repository. |
2272 | 2277 |
2273 This only removes files from the current branch, not from the | 2278 This only removes files from the current branch, not from the |
2274 entire project history. -A can be used to remove only files that | 2279 entire project history. -A/--after can be used to remove only |
2275 have already been deleted, -f can be used to force deletion, and | 2280 files that have already been deleted, -f/--force can be used to |
2276 -Af can be used to remove files from the next revision without | 2281 force deletion, and -Af can be used to remove files from the next |
2277 deleting them. | 2282 revision without deleting them. |
2278 | 2283 |
2279 The following table details the behavior of remove for different | 2284 The following table details the behavior of remove for different |
2280 file states (columns) and option combinations (rows). The file | 2285 file states (columns) and option combinations (rows). The file |
2281 states are Added, Clean, Modified and Missing (as reported by hg | 2286 states are Added, Clean, Modified and Missing (as reported by hg |
2282 status). The actions are Warn, Remove (from branch) and Delete | 2287 status). The actions are Warn, Remove (from branch) and Delete |
2328 Mark dest as copies of sources; mark sources for deletion. If dest | 2333 Mark dest as copies of sources; mark sources for deletion. If dest |
2329 is a directory, copies are put in that directory. If dest is a | 2334 is a directory, copies are put in that directory. If dest is a |
2330 file, there can only be one source. | 2335 file, there can only be one source. |
2331 | 2336 |
2332 By default, this command copies the contents of files as they | 2337 By default, this command copies the contents of files as they |
2333 exist in the working directory. If invoked with --after, the | 2338 exist in the working directory. If invoked with -A/--after, the |
2334 operation is recorded, but no copying is performed. | 2339 operation is recorded, but no copying is performed. |
2335 | 2340 |
2336 This command takes effect at the next commit. To undo a rename | 2341 This command takes effect at the next commit. To undo a rename |
2337 before that, see hg revert. | 2342 before that, see hg revert. |
2338 """ | 2343 """ |
2345 def resolve(ui, repo, *pats, **opts): | 2350 def resolve(ui, repo, *pats, **opts): |
2346 """retry file merges from a merge or update | 2351 """retry file merges from a merge or update |
2347 | 2352 |
2348 This command will cleanly retry unresolved file merges using file | 2353 This command will cleanly retry unresolved file merges using file |
2349 revisions preserved from the last update or merge. To attempt to | 2354 revisions preserved from the last update or merge. To attempt to |
2350 resolve all unresolved files, use the -a switch. | 2355 resolve all unresolved files, use the -a/--all switch. |
2351 | 2356 |
2352 If a conflict is resolved manually, please note that the changes | 2357 If a conflict is resolved manually, please note that the changes |
2353 will be overwritten if the merge is retried with resolve. The -m | 2358 will be overwritten if the merge is retried with resolve. The |
2354 switch should be used to mark the file as resolved. | 2359 -m/--mark switch should be used to mark the file as resolved. |
2355 | 2360 |
2356 This command will also allow listing resolved files and manually | 2361 This command will also allow listing resolved files and manually |
2357 marking and unmarking files as resolved. All files must be marked | 2362 marking and unmarking files as resolved. All files must be marked |
2358 as resolved before the new commits are permitted. | 2363 as resolved before the new commits are permitted. |
2359 | 2364 |
2408 This restores the contents of the affected files to an unmodified | 2413 This restores the contents of the affected files to an unmodified |
2409 state and unschedules adds, removes, copies, and renames. If the | 2414 state and unschedules adds, removes, copies, and renames. If the |
2410 working directory has two parents, you must explicitly specify the | 2415 working directory has two parents, you must explicitly specify the |
2411 revision to revert to. | 2416 revision to revert to. |
2412 | 2417 |
2413 Using the -r option, revert the given files or directories to | 2418 Using the -r/--rev option, revert the given files or directories |
2414 their contents as of a specific revision. This can be helpful to | 2419 to their contents as of a specific revision. This can be helpful |
2415 "roll back" some or all of an earlier change. See 'hg help dates' | 2420 to "roll back" some or all of an earlier change. See 'hg help |
2416 for a list of formats valid for -d/--date. | 2421 dates' for a list of formats valid for -d/--date. |
2417 | 2422 |
2418 Revert modifies the working directory. It does not commit any | 2423 Revert modifies the working directory. It does not commit any |
2419 changes, or change the parent of the working directory. If you | 2424 changes, or change the parent of the working directory. If you |
2420 revert to a revision other than the parent of the working | 2425 revert to a revision other than the parent of the working |
2421 directory, the reverted files will thus appear modified | 2426 directory, the reverted files will thus appear modified |
2716 def status(ui, repo, *pats, **opts): | 2721 def status(ui, repo, *pats, **opts): |
2717 """show changed files in the working directory | 2722 """show changed files in the working directory |
2718 | 2723 |
2719 Show status of files in the repository. If names are given, only | 2724 Show status of files in the repository. If names are given, only |
2720 files that match are shown. Files that are clean or ignored or | 2725 files that match are shown. Files that are clean or ignored or |
2721 source of a copy/move operation, are not listed unless -c (clean), | 2726 source of a copy/move operation, are not listed unless -c/--clean, |
2722 -i (ignored), -C (copies) or -A is given. Unless options described | 2727 -i/--ignored, -C/--copies or -A/--all is given. Unless options |
2723 with "show only ..." are given, the options -mardu are used. | 2728 described with "show only ..." are given, the options -mardu are |
2729 used. | |
2724 | 2730 |
2725 Option -q/--quiet hides untracked (unknown and ignored) files | 2731 Option -q/--quiet hides untracked (unknown and ignored) files |
2726 unless explicitly requested with -u/--unknown or -i/--ignored. | 2732 unless explicitly requested with -u/--unknown or -i/--ignored. |
2727 | 2733 |
2728 NOTE: status may appear to disagree with diff if permissions have | 2734 NOTE: status may appear to disagree with diff if permissions have |
2941 suggestion to use 'merge' or 'update -C' instead. | 2947 suggestion to use 'merge' or 'update -C' instead. |
2942 | 2948 |
2943 If you want to update just one file to an older revision, use | 2949 If you want to update just one file to an older revision, use |
2944 revert. | 2950 revert. |
2945 | 2951 |
2946 See 'hg help dates' for a list of formats valid for --date. | 2952 See 'hg help dates' for a list of formats valid for -d/--date. |
2947 """ | 2953 """ |
2948 if rev and node: | 2954 if rev and node: |
2949 raise util.Abort(_("please specify just one revision")) | 2955 raise util.Abort(_("please specify just one revision")) |
2950 | 2956 |
2951 if not rev: | 2957 if not rev: |