Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 1437:ea51d296085f
import docstring from doc/hg.1.txt
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Mon, 24 Oct 2005 15:52:28 -0700 |
parents | db6d7b4005ba |
children | 65cbe22b03fa |
comparison
equal
deleted
inserted
replaced
1436:db6d7b4005ba | 1437:ea51d296085f |
---|---|
474 ui.write("%s\n" % first) | 474 ui.write("%s\n" % first) |
475 | 475 |
476 # Commands start here, listed alphabetically | 476 # Commands start here, listed alphabetically |
477 | 477 |
478 def add(ui, repo, *pats, **opts): | 478 def add(ui, repo, *pats, **opts): |
479 '''add the specified files on the next commit''' | 479 """add the specified files on the next commit |
480 | |
481 Schedule files to be version controlled and added to the repository. | |
482 | |
483 The files will be added to the repository at the next commit. | |
484 | |
485 If no names are given, add all files in the current directory and | |
486 its subdirectories. | |
487 """ | |
488 | |
480 names = [] | 489 names = [] |
481 for src, abs, rel, exact in walk(repo, pats, opts): | 490 for src, abs, rel, exact in walk(repo, pats, opts): |
482 if exact: | 491 if exact: |
483 if ui.verbose: ui.status(_('adding %s\n') % rel) | 492 if ui.verbose: ui.status(_('adding %s\n') % rel) |
484 names.append(abs) | 493 names.append(abs) |
486 ui.status(_('adding %s\n') % rel) | 495 ui.status(_('adding %s\n') % rel) |
487 names.append(abs) | 496 names.append(abs) |
488 repo.add(names) | 497 repo.add(names) |
489 | 498 |
490 def addremove(ui, repo, *pats, **opts): | 499 def addremove(ui, repo, *pats, **opts): |
491 """add all new files, delete all missing files""" | 500 """add all new files, delete all missing files |
501 | |
502 Add all new files and remove all missing files from the repository. | |
503 | |
504 New files are ignored if they match any of the patterns in .hgignore. As | |
505 with add, these changes take effect at the next commit. | |
506 """ | |
492 add, remove = [], [] | 507 add, remove = [], [] |
493 for src, abs, rel, exact in walk(repo, pats, opts): | 508 for src, abs, rel, exact in walk(repo, pats, opts): |
494 if src == 'f' and repo.dirstate.state(abs) == '?': | 509 if src == 'f' and repo.dirstate.state(abs) == '?': |
495 add.append(abs) | 510 add.append(abs) |
496 if ui.verbose or not exact: | 511 if ui.verbose or not exact: |
501 ui.status(_('removing %s\n') % rel) | 516 ui.status(_('removing %s\n') % rel) |
502 repo.add(add) | 517 repo.add(add) |
503 repo.remove(remove) | 518 repo.remove(remove) |
504 | 519 |
505 def annotate(ui, repo, *pats, **opts): | 520 def annotate(ui, repo, *pats, **opts): |
506 """show changeset information per file line""" | 521 """show changeset information per file line |
522 | |
523 List changes in files, showing the revision id responsible for each line | |
524 | |
525 This command is useful to discover who did a change or when a change took | |
526 place. | |
527 | |
528 Without the -a option, annotate will avoid processing files it | |
529 detects as binary. With -a, annotate will generate an annotation | |
530 anyway, probably with undesirable results. | |
531 """ | |
507 def getnode(rev): | 532 def getnode(rev): |
508 return short(repo.changelog.node(rev)) | 533 return short(repo.changelog.node(rev)) |
509 | 534 |
510 ucache = {} | 535 ucache = {} |
511 def getname(rev): | 536 def getname(rev): |
549 if pieces: | 574 if pieces: |
550 for p, l in zip(zip(*pieces), lines): | 575 for p, l in zip(zip(*pieces), lines): |
551 ui.write("%s: %s" % (" ".join(p), l[1])) | 576 ui.write("%s: %s" % (" ".join(p), l[1])) |
552 | 577 |
553 def bundle(ui, repo, fname, dest="default-push", **opts): | 578 def bundle(ui, repo, fname, dest="default-push", **opts): |
554 """create a changegroup file""" | 579 """create a changegroup file |
580 | |
581 Generate a compressed changegroup file collecting all changesets | |
582 not found in the other repository. | |
583 | |
584 This file can then be transferred using conventional means and | |
585 applied to another repository with the unbundle command. This is | |
586 useful when native push and pull are not available or when | |
587 exporting an entire repository is undesirable. The standard file | |
588 extension is ".hg". | |
589 | |
590 Unlike import/export, this exactly preserves all changeset | |
591 contents including permissions, rename data, and revision history. | |
592 """ | |
555 f = open(fname, "wb") | 593 f = open(fname, "wb") |
556 dest = ui.expandpath(dest) | 594 dest = ui.expandpath(dest) |
557 other = hg.repository(ui, dest) | 595 other = hg.repository(ui, dest) |
558 o = repo.findoutgoing(other) | 596 o = repo.findoutgoing(other) |
559 cg = repo.changegroup(o) | 597 cg = repo.changegroup(o) |
570 except: | 608 except: |
571 os.unlink(fname) | 609 os.unlink(fname) |
572 raise | 610 raise |
573 | 611 |
574 def cat(ui, repo, file1, *pats, **opts): | 612 def cat(ui, repo, file1, *pats, **opts): |
575 """output the latest or given revisions of files""" | 613 """output the latest or given revisions of files |
614 | |
615 Print the specified files as they were at the given revision. | |
616 If no revision is given then the tip is used. | |
617 | |
618 Output may be to a file, in which case the name of the file is | |
619 given using a format string. The formatting rules are the same as | |
620 for the export command, with the following additions: | |
621 | |
622 %s basename of file being printed | |
623 %d dirname of file being printed, or '.' if in repo root | |
624 %p root-relative path name of file being printed | |
625 """ | |
576 mf = {} | 626 mf = {} |
577 if opts['rev']: | 627 if opts['rev']: |
578 change = repo.changelog.read(repo.lookup(opts['rev'])) | 628 change = repo.changelog.read(repo.lookup(opts['rev'])) |
579 mf = repo.manifest.read(change[0]) | 629 mf = repo.manifest.read(change[0]) |
580 for src, abs, rel, exact in walk(repo, (file1,) + pats, opts): | 630 for src, abs, rel, exact in walk(repo, (file1,) + pats, opts): |
591 n = r.tip() | 641 n = r.tip() |
592 fp = make_file(repo, r, opts['output'], node=n, pathname=abs) | 642 fp = make_file(repo, r, opts['output'], node=n, pathname=abs) |
593 fp.write(r.read(n)) | 643 fp.write(r.read(n)) |
594 | 644 |
595 def clone(ui, source, dest=None, **opts): | 645 def clone(ui, source, dest=None, **opts): |
596 """make a copy of an existing repository""" | 646 """make a copy of an existing repository |
647 | |
648 Create a copy of an existing repository in a new directory. | |
649 | |
650 If no destination directory name is specified, it defaults to the | |
651 basename of the source. | |
652 | |
653 The location of the source is added to the new repository's | |
654 .hg/hgrc file, as the default to be used for future pulls. | |
655 | |
656 For efficiency, hardlinks are used for cloning whenever the source | |
657 and destination are on the same filesystem. Some filesystems, | |
658 such as AFS, implement hardlinking incorrectly, but do not report | |
659 errors. In these cases, use the --pull option to avoid | |
660 hardlinking. | |
661 """ | |
597 if dest is None: | 662 if dest is None: |
598 dest = os.path.basename(os.path.normpath(source)) | 663 dest = os.path.basename(os.path.normpath(source)) |
599 | 664 |
600 if os.path.exists(dest): | 665 if os.path.exists(dest): |
601 raise util.Abort(_("destination '%s' already exists"), dest) | 666 raise util.Abort(_("destination '%s' already exists"), dest) |
666 update(ui, repo) | 731 update(ui, repo) |
667 | 732 |
668 d.close() | 733 d.close() |
669 | 734 |
670 def commit(ui, repo, *pats, **opts): | 735 def commit(ui, repo, *pats, **opts): |
671 """commit the specified files or all outstanding changes""" | 736 """commit the specified files or all outstanding changes |
737 | |
738 Commit changes to the given files into the repository. | |
739 | |
740 If a list of files is omitted, all changes reported by "hg status" | |
741 from the root of the repository will be commited. | |
742 | |
743 The HGEDITOR or EDITOR environment variables are used to start an | |
744 editor to add a commit comment. | |
745 """ | |
672 if opts['text']: | 746 if opts['text']: |
673 ui.warn(_("Warning: -t and --text is deprecated," | 747 ui.warn(_("Warning: -t and --text is deprecated," |
674 " please use -m or --message instead.\n")) | 748 " please use -m or --message instead.\n")) |
675 message = opts['message'] or opts['text'] | 749 message = opts['message'] or opts['text'] |
676 logfile = opts['logfile'] | 750 logfile = opts['logfile'] |
784 if errs: | 858 if errs: |
785 ui.warn(_('(consider using --after)\n')) | 859 ui.warn(_('(consider using --after)\n')) |
786 return errs, copied | 860 return errs, copied |
787 | 861 |
788 def copy(ui, repo, *pats, **opts): | 862 def copy(ui, repo, *pats, **opts): |
789 """mark files as copied for the next commit""" | 863 """mark files as copied for the next commit |
864 | |
865 Mark dest as having copies of source files. If dest is a | |
866 directory, copies are put in that directory. If dest is a file, | |
867 there can only be one source. | |
868 | |
869 By default, this command copies the contents of files as they | |
870 stand in the working directory. If invoked with --after, the | |
871 operation is recorded, but no copying is performed. | |
872 | |
873 This command takes effect in the next commit. | |
874 | |
875 NOTE: This command should be treated as experimental. While it | |
876 should properly record copied files, this information is not yet | |
877 fully used by merge, nor fully reported by log. | |
878 """ | |
790 errs, copied = docopy(ui, repo, pats, opts) | 879 errs, copied = docopy(ui, repo, pats, opts) |
791 return errs | 880 return errs |
792 | 881 |
793 def debugancestor(ui, index, rev1, rev2): | 882 def debugancestor(ui, index, rev1, rev2): |
794 """find the ancestor revision of two revisions in a given index""" | 883 """find the ancestor revision of two revisions in a given index""" |
925 for src, abs, rel, exact in items: | 1014 for src, abs, rel, exact in items: |
926 line = fmt % (src, abs, rel, exact and 'exact' or '') | 1015 line = fmt % (src, abs, rel, exact and 'exact' or '') |
927 ui.write("%s\n" % line.rstrip()) | 1016 ui.write("%s\n" % line.rstrip()) |
928 | 1017 |
929 def diff(ui, repo, *pats, **opts): | 1018 def diff(ui, repo, *pats, **opts): |
930 """diff working directory (or selected files)""" | 1019 """diff working directory (or selected files) |
1020 | |
1021 Show differences between revisions for the specified files. | |
1022 | |
1023 Differences between files are shown using the unified diff format. | |
1024 | |
1025 When two revision arguments are given, then changes are shown | |
1026 between those revisions. If only one revision is specified then | |
1027 that revision is compared to the working directory, and, when no | |
1028 revisions are specified, the working directory files are compared | |
1029 to its parent. | |
1030 | |
1031 Without the -a option, diff will avoid generating diffs of files | |
1032 it detects as binary. With -a, diff will generate a diff anyway, | |
1033 probably with undesirable results. | |
1034 """ | |
931 node1, node2 = None, None | 1035 node1, node2 = None, None |
932 revs = [repo.lookup(x) for x in opts['rev']] | 1036 revs = [repo.lookup(x) for x in opts['rev']] |
933 | 1037 |
934 if len(revs) > 0: | 1038 if len(revs) > 0: |
935 node1 = revs[0] | 1039 node1 = revs[0] |
966 dodiff(fp, ui, repo, prev, node, text=opts['text']) | 1070 dodiff(fp, ui, repo, prev, node, text=opts['text']) |
967 if fp != sys.stdout: | 1071 if fp != sys.stdout: |
968 fp.close() | 1072 fp.close() |
969 | 1073 |
970 def export(ui, repo, *changesets, **opts): | 1074 def export(ui, repo, *changesets, **opts): |
971 """dump the header and diffs for one or more changesets""" | 1075 """dump the header and diffs for one or more changesets |
1076 | |
1077 Print the changeset header and diffs for one or more revisions. | |
1078 | |
1079 The information shown in the changeset header is: author, | |
1080 changeset hash, parent and commit comment. | |
1081 | |
1082 Output may be to a file, in which case the name of the file is | |
1083 given using a format string. The formatting rules are as follows: | |
1084 | |
1085 %% literal "%" character | |
1086 %H changeset hash (40 bytes of hexadecimal) | |
1087 %N number of patches being generated | |
1088 %R changeset revision number | |
1089 %b basename of the exporting repository | |
1090 %h short-form changeset hash (12 bytes of hexadecimal) | |
1091 %n zero-padded sequence number, starting at 1 | |
1092 %r zero-padded changeset revision number | |
1093 | |
1094 Without the -a option, export will avoid generating diffs of files | |
1095 it detects as binary. With -a, export will generate a diff anyway, | |
1096 probably with undesirable results. | |
1097 """ | |
972 if not changesets: | 1098 if not changesets: |
973 raise util.Abort(_("export requires at least one changeset")) | 1099 raise util.Abort(_("export requires at least one changeset")) |
974 seqno = 0 | 1100 seqno = 0 |
975 revs = list(revrange(ui, repo, changesets)) | 1101 revs = list(revrange(ui, repo, changesets)) |
976 total = len(revs) | 1102 total = len(revs) |
979 for cset in revs: | 1105 for cset in revs: |
980 seqno += 1 | 1106 seqno += 1 |
981 doexport(ui, repo, cset, seqno, total, revwidth, opts) | 1107 doexport(ui, repo, cset, seqno, total, revwidth, opts) |
982 | 1108 |
983 def forget(ui, repo, *pats, **opts): | 1109 def forget(ui, repo, *pats, **opts): |
984 """don't add the specified files on the next commit""" | 1110 """don't add the specified files on the next commit |
1111 | |
1112 Undo an 'hg add' scheduled for the next commit. | |
1113 """ | |
985 forget = [] | 1114 forget = [] |
986 for src, abs, rel, exact in walk(repo, pats, opts): | 1115 for src, abs, rel, exact in walk(repo, pats, opts): |
987 if repo.dirstate.state(abs) == 'a': | 1116 if repo.dirstate.state(abs) == 'a': |
988 forget.append(abs) | 1117 forget.append(abs) |
989 if ui.verbose or not exact: | 1118 if ui.verbose or not exact: |
990 ui.status(_('forgetting %s\n') % rel) | 1119 ui.status(_('forgetting %s\n') % rel) |
991 repo.forget(forget) | 1120 repo.forget(forget) |
992 | 1121 |
993 def grep(ui, repo, pattern, *pats, **opts): | 1122 def grep(ui, repo, pattern, *pats, **opts): |
994 """search for a pattern in specified files and revisions""" | 1123 """search for a pattern in specified files and revisions |
1124 | |
1125 Search revisions of files for a regular expression. | |
1126 | |
1127 This command behaves differently than Unix grep. It only accepts | |
1128 Python/Perl regexps. It searches repository history, not the | |
1129 working directory. It always prints the revision number in which | |
1130 a match appears. | |
1131 | |
1132 By default, grep only prints output for the first revision of a | |
1133 file in which it finds a match. To get it to print every revision | |
1134 that contains a change in match status ("-" for a match that | |
1135 becomes a non-match, or "+" for a non-match that becomes a match), | |
1136 use the --all flag. | |
1137 """ | |
995 reflags = 0 | 1138 reflags = 0 |
996 if opts['ignore_case']: | 1139 if opts['ignore_case']: |
997 reflags |= re.I | 1140 reflags |= re.I |
998 regexp = re.compile(pattern, reflags) | 1141 regexp = re.compile(pattern, reflags) |
999 sep, eol = ':', '\n' | 1142 sep, eol = ':', '\n' |
1108 if fn in skip: continue | 1251 if fn in skip: continue |
1109 display(fn, rev, {}, state) | 1252 display(fn, rev, {}, state) |
1110 return (count == 0 and 1) or 0 | 1253 return (count == 0 and 1) or 0 |
1111 | 1254 |
1112 def heads(ui, repo, **opts): | 1255 def heads(ui, repo, **opts): |
1113 """show current repository heads""" | 1256 """show current repository heads |
1257 | |
1258 Show all repository head changesets. | |
1259 | |
1260 Repository "heads" are changesets that don't have children | |
1261 changesets. They are where development generally takes place and | |
1262 are the usual targets for update and merge operations. | |
1263 """ | |
1114 heads = repo.changelog.heads() | 1264 heads = repo.changelog.heads() |
1115 br = None | 1265 br = None |
1116 if opts['branches']: | 1266 if opts['branches']: |
1117 br = repo.branchlookup(heads) | 1267 br = repo.branchlookup(heads) |
1118 for n in repo.changelog.heads(): | 1268 for n in repo.changelog.heads(): |
1119 show_changeset(ui, repo, changenode=n, brinfo=br) | 1269 show_changeset(ui, repo, changenode=n, brinfo=br) |
1120 | 1270 |
1121 def identify(ui, repo): | 1271 def identify(ui, repo): |
1122 """print information about the working copy""" | 1272 """print information about the working copy |
1273 Print a short summary of the current state of the repo. | |
1274 | |
1275 This summary identifies the repository state using one or two parent | |
1276 hash identifiers, followed by a "+" if there are uncommitted changes | |
1277 in the working directory, followed by a list of tags for this revision. | |
1278 """ | |
1123 parents = [p for p in repo.dirstate.parents() if p != nullid] | 1279 parents = [p for p in repo.dirstate.parents() if p != nullid] |
1124 if not parents: | 1280 if not parents: |
1125 ui.write(_("unknown\n")) | 1281 ui.write(_("unknown\n")) |
1126 return | 1282 return |
1127 | 1283 |
1139 output.append(' + '.join(parenttags)) | 1295 output.append(' + '.join(parenttags)) |
1140 | 1296 |
1141 ui.write("%s\n" % ' '.join(output)) | 1297 ui.write("%s\n" % ' '.join(output)) |
1142 | 1298 |
1143 def import_(ui, repo, patch1, *patches, **opts): | 1299 def import_(ui, repo, patch1, *patches, **opts): |
1144 """import an ordered set of patches""" | 1300 """import an ordered set of patches |
1301 | |
1302 Import a list of patches and commit them individually. | |
1303 | |
1304 If there are outstanding changes in the working directory, import | |
1305 will abort unless given the -f flag. | |
1306 | |
1307 If a patch looks like a mail message (its first line starts with | |
1308 "From " or looks like an RFC822 header), it will not be applied | |
1309 unless the -f option is used. The importer neither parses nor | |
1310 discards mail headers, so use -f only to override the "mailness" | |
1311 safety check, not to import a real mail message. | |
1312 """ | |
1145 patches = (patch1,) + patches | 1313 patches = (patch1,) + patches |
1146 | 1314 |
1147 if not opts['force']: | 1315 if not opts['force']: |
1148 (c, a, d, u) = repo.changes() | 1316 (c, a, d, u) = repo.changes() |
1149 if c or a or d: | 1317 if c or a or d: |
1202 if len(files) > 0: | 1370 if len(files) > 0: |
1203 addremove(ui, repo, *files) | 1371 addremove(ui, repo, *files) |
1204 repo.commit(files, message, user) | 1372 repo.commit(files, message, user) |
1205 | 1373 |
1206 def incoming(ui, repo, source="default", **opts): | 1374 def incoming(ui, repo, source="default", **opts): |
1207 """show new changesets found in source""" | 1375 """show new changesets found in source |
1376 | |
1377 Show new changesets found in the specified repo or the default | |
1378 pull repo. These are the changesets that would be pulled if a pull | |
1379 was requested. | |
1380 | |
1381 Currently only local repositories are supported. | |
1382 """ | |
1208 source = ui.expandpath(source) | 1383 source = ui.expandpath(source) |
1209 other = hg.repository(ui, source) | 1384 other = hg.repository(ui, source) |
1210 if not other.local(): | 1385 if not other.local(): |
1211 raise util.Abort(_("incoming doesn't work for remote repositories yet")) | 1386 raise util.Abort(_("incoming doesn't work for remote repositories yet")) |
1212 o = repo.findincoming(other) | 1387 o = repo.findincoming(other) |
1222 prev = (parents and parents[0]) or nullid | 1397 prev = (parents and parents[0]) or nullid |
1223 dodiff(ui, ui, other, prev, n) | 1398 dodiff(ui, ui, other, prev, n) |
1224 ui.write("\n") | 1399 ui.write("\n") |
1225 | 1400 |
1226 def init(ui, dest="."): | 1401 def init(ui, dest="."): |
1227 """create a new repository in the given directory""" | 1402 """create a new repository in the given directory |
1403 | |
1404 Initialize a new repository in the given directory. If the given | |
1405 directory does not exist, it is created. | |
1406 | |
1407 If no directory is given, the current directory is used. | |
1408 """ | |
1228 if not os.path.exists(dest): | 1409 if not os.path.exists(dest): |
1229 os.mkdir(dest) | 1410 os.mkdir(dest) |
1230 hg.repository(ui, dest, create=1) | 1411 hg.repository(ui, dest, create=1) |
1231 | 1412 |
1232 def locate(ui, repo, *pats, **opts): | 1413 def locate(ui, repo, *pats, **opts): |
1233 """locate files matching specific patterns""" | 1414 """locate files matching specific patterns |
1415 | |
1416 Print all files under Mercurial control whose names match the | |
1417 given patterns. | |
1418 | |
1419 This command searches the current directory and its | |
1420 subdirectories. To search an entire repository, move to the root | |
1421 of the repository. | |
1422 | |
1423 If no patterns are given to match, this command prints all file | |
1424 names. | |
1425 | |
1426 If you want to feed the output of this command into the "xargs" | |
1427 command, use the "-0" option to both this command and "xargs". | |
1428 This will avoid the problem of "xargs" treating single filenames | |
1429 that contain white space as multiple filenames. | |
1430 """ | |
1234 end = opts['print0'] and '\0' or '\n' | 1431 end = opts['print0'] and '\0' or '\n' |
1235 | 1432 |
1236 for src, abs, rel, exact in walk(repo, pats, opts, '(?:.*/|)'): | 1433 for src, abs, rel, exact in walk(repo, pats, opts, '(?:.*/|)'): |
1237 if repo.dirstate.state(abs) == '?': | 1434 if repo.dirstate.state(abs) == '?': |
1238 continue | 1435 continue |
1240 ui.write(os.path.join(repo.root, abs), end) | 1437 ui.write(os.path.join(repo.root, abs), end) |
1241 else: | 1438 else: |
1242 ui.write(rel, end) | 1439 ui.write(rel, end) |
1243 | 1440 |
1244 def log(ui, repo, *pats, **opts): | 1441 def log(ui, repo, *pats, **opts): |
1245 """show revision history of entire repository or files""" | 1442 """show revision history of entire repository or files |
1443 | |
1444 Print the revision history of the specified files or the entire project. | |
1445 | |
1446 By default this command outputs: changeset id and hash, tags, | |
1447 parents, user, date and time, and a summary for each commit. The | |
1448 -v switch adds some more detail, such as changed files, manifest | |
1449 hashes or message signatures. | |
1450 """ | |
1246 class dui: | 1451 class dui: |
1247 # Implement and delegate some ui protocol. Save hunks of | 1452 # Implement and delegate some ui protocol. Save hunks of |
1248 # output for later display in the desired order. | 1453 # output for later display in the desired order. |
1249 def __init__(self, ui): | 1454 def __init__(self, ui): |
1250 self.ui = ui | 1455 self.ui = ui |
1308 elif st == 'iter': | 1513 elif st == 'iter': |
1309 for args in du.hunk[rev]: | 1514 for args in du.hunk[rev]: |
1310 ui.write(*args) | 1515 ui.write(*args) |
1311 | 1516 |
1312 def manifest(ui, repo, rev=None): | 1517 def manifest(ui, repo, rev=None): |
1313 """output the latest or given revision of the project manifest""" | 1518 """output the latest or given revision of the project manifest |
1519 | |
1520 Print a list of version controlled files for the given revision. | |
1521 | |
1522 The manifest is the list of files being version controlled. If no revision | |
1523 is given then the tip is used. | |
1524 """ | |
1314 if rev: | 1525 if rev: |
1315 try: | 1526 try: |
1316 # assume all revision numbers are for changesets | 1527 # assume all revision numbers are for changesets |
1317 n = repo.lookup(rev) | 1528 n = repo.lookup(rev) |
1318 change = repo.changelog.read(n) | 1529 change = repo.changelog.read(n) |
1328 | 1539 |
1329 for f in files: | 1540 for f in files: |
1330 ui.write("%40s %3s %s\n" % (hex(m[f]), mf[f] and "755" or "644", f)) | 1541 ui.write("%40s %3s %s\n" % (hex(m[f]), mf[f] and "755" or "644", f)) |
1331 | 1542 |
1332 def outgoing(ui, repo, dest="default-push", **opts): | 1543 def outgoing(ui, repo, dest="default-push", **opts): |
1333 """show changesets not found in destination""" | 1544 """show changesets not found in destination |
1545 | |
1546 Show changesets not found in the specified destination repo or the | |
1547 default push repo. These are the changesets that would be pushed | |
1548 if a push was requested. | |
1549 """ | |
1334 dest = ui.expandpath(dest) | 1550 dest = ui.expandpath(dest) |
1335 other = hg.repository(ui, dest) | 1551 other = hg.repository(ui, dest) |
1336 o = repo.findoutgoing(other) | 1552 o = repo.findoutgoing(other) |
1337 o = repo.newer(o) | 1553 o = repo.newer(o) |
1338 for n in o: | 1554 for n in o: |
1344 prev = (parents and parents[0]) or nullid | 1560 prev = (parents and parents[0]) or nullid |
1345 dodiff(ui, ui, repo, prev, n) | 1561 dodiff(ui, ui, repo, prev, n) |
1346 ui.write("\n") | 1562 ui.write("\n") |
1347 | 1563 |
1348 def parents(ui, repo, rev=None): | 1564 def parents(ui, repo, rev=None): |
1349 """show the parents of the working dir or revision""" | 1565 """show the parents of the working dir or revision |
1566 | |
1567 Print the working directory's parent revisions. | |
1568 """ | |
1350 if rev: | 1569 if rev: |
1351 p = repo.changelog.parents(repo.lookup(rev)) | 1570 p = repo.changelog.parents(repo.lookup(rev)) |
1352 else: | 1571 else: |
1353 p = repo.dirstate.parents() | 1572 p = repo.dirstate.parents() |
1354 | 1573 |
1355 for n in p: | 1574 for n in p: |
1356 if n != nullid: | 1575 if n != nullid: |
1357 show_changeset(ui, repo, changenode=n) | 1576 show_changeset(ui, repo, changenode=n) |
1358 | 1577 |
1359 def paths(ui, search=None): | 1578 def paths(ui, search=None): |
1360 """show definition of symbolic path names""" | 1579 """show definition of symbolic path names |
1580 | |
1581 Show definition of symbolic path name NAME. If no name is given, show | |
1582 definition of available names. | |
1583 | |
1584 Path names are defined in the [paths] section of /etc/mercurial/hgrc | |
1585 and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too. | |
1586 """ | |
1361 try: | 1587 try: |
1362 repo = hg.repository(ui=ui) | 1588 repo = hg.repository(ui=ui) |
1363 except hg.RepoError: | 1589 except hg.RepoError: |
1364 pass | 1590 pass |
1365 | 1591 |
1373 else: | 1599 else: |
1374 for name, path in ui.configitems("paths"): | 1600 for name, path in ui.configitems("paths"): |
1375 ui.write("%s = %s\n" % (name, path)) | 1601 ui.write("%s = %s\n" % (name, path)) |
1376 | 1602 |
1377 def pull(ui, repo, source="default", **opts): | 1603 def pull(ui, repo, source="default", **opts): |
1378 """pull changes from the specified source""" | 1604 """pull changes from the specified source |
1605 | |
1606 Pull changes from a remote repository to a local one. | |
1607 | |
1608 This finds all changes from the repository at the specified path | |
1609 or URL and adds them to the local repository. By default, this | |
1610 does not update the copy of the project in the working directory. | |
1611 | |
1612 Valid URLs are of the form: | |
1613 | |
1614 local/filesystem/path | |
1615 http://[user@]host[:port][/path] | |
1616 https://[user@]host[:port][/path] | |
1617 ssh://[user@]host[:port][/path] | |
1618 | |
1619 SSH requires an accessible shell account on the destination machine | |
1620 and a copy of hg in the remote path. With SSH, paths are relative | |
1621 to the remote user's home directory by default; use two slashes at | |
1622 the start of a path to specify it as relative to the filesystem root. | |
1623 """ | |
1379 source = ui.expandpath(source) | 1624 source = ui.expandpath(source) |
1380 ui.status(_('pulling from %s\n') % (source)) | 1625 ui.status(_('pulling from %s\n') % (source)) |
1381 | 1626 |
1382 if opts['ssh']: | 1627 if opts['ssh']: |
1383 ui.setconfig("ui", "ssh", opts['ssh']) | 1628 ui.setconfig("ui", "ssh", opts['ssh']) |
1393 ui.status(_("(run 'hg update' to get a working copy)\n")) | 1638 ui.status(_("(run 'hg update' to get a working copy)\n")) |
1394 | 1639 |
1395 return r | 1640 return r |
1396 | 1641 |
1397 def push(ui, repo, dest="default-push", force=False, ssh=None, remotecmd=None): | 1642 def push(ui, repo, dest="default-push", force=False, ssh=None, remotecmd=None): |
1398 """push changes to the specified destination""" | 1643 """push changes to the specified destination |
1644 | |
1645 Push changes from the local repository to the given destination. | |
1646 | |
1647 This is the symmetrical operation for pull. It helps to move | |
1648 changes from the current repository to a different one. If the | |
1649 destination is local this is identical to a pull in that directory | |
1650 from the current one. | |
1651 | |
1652 By default, push will refuse to run if it detects the result would | |
1653 increase the number of remote heads. This generally indicates the | |
1654 the client has forgotten to sync and merge before pushing. | |
1655 | |
1656 Valid URLs are of the form: | |
1657 | |
1658 local/filesystem/path | |
1659 ssh://[user@]host[:port][/path] | |
1660 | |
1661 SSH requires an accessible shell account on the destination | |
1662 machine and a copy of hg in the remote path. | |
1663 """ | |
1399 dest = ui.expandpath(dest) | 1664 dest = ui.expandpath(dest) |
1400 ui.status('pushing to %s\n' % (dest)) | 1665 ui.status('pushing to %s\n' % (dest)) |
1401 | 1666 |
1402 if ssh: | 1667 if ssh: |
1403 ui.setconfig("ui", "ssh", ssh) | 1668 ui.setconfig("ui", "ssh", ssh) |
1407 other = hg.repository(ui, dest) | 1672 other = hg.repository(ui, dest) |
1408 r = repo.push(other, force) | 1673 r = repo.push(other, force) |
1409 return r | 1674 return r |
1410 | 1675 |
1411 def rawcommit(ui, repo, *flist, **rc): | 1676 def rawcommit(ui, repo, *flist, **rc): |
1412 "raw commit interface" | 1677 """raw commit interface |
1678 | |
1679 Lowlevel commit, for use in helper scripts. | |
1680 | |
1681 This command is not intended to be used by normal users, as it is | |
1682 primarily useful for importing from other SCMs. | |
1683 """ | |
1413 if rc['text']: | 1684 if rc['text']: |
1414 ui.warn(_("Warning: -t and --text is deprecated," | 1685 ui.warn(_("Warning: -t and --text is deprecated," |
1415 " please use -m or --message instead.\n")) | 1686 " please use -m or --message instead.\n")) |
1416 message = rc['message'] or rc['text'] | 1687 message = rc['message'] or rc['text'] |
1417 if not message and rc['logfile']: | 1688 if not message and rc['logfile']: |
1432 repo.rawcommit(files, message, rc['user'], rc['date'], *rc['parent']) | 1703 repo.rawcommit(files, message, rc['user'], rc['date'], *rc['parent']) |
1433 except ValueError, inst: | 1704 except ValueError, inst: |
1434 raise util.Abort(str(inst)) | 1705 raise util.Abort(str(inst)) |
1435 | 1706 |
1436 def recover(ui, repo): | 1707 def recover(ui, repo): |
1437 """roll back an interrupted transaction""" | 1708 """roll back an interrupted transaction |
1709 | |
1710 Recover from an interrupted commit or pull. | |
1711 | |
1712 This command tries to fix the repository status after an interrupted | |
1713 operation. It should only be necessary when Mercurial suggests it. | |
1714 """ | |
1438 repo.recover() | 1715 repo.recover() |
1439 | 1716 |
1440 def remove(ui, repo, pat, *pats, **opts): | 1717 def remove(ui, repo, pat, *pats, **opts): |
1441 """remove the specified files on the next commit""" | 1718 """remove the specified files on the next commit |
1719 | |
1720 Schedule the indicated files for removal from the repository. | |
1721 | |
1722 This command schedules the files to be removed at the next commit. | |
1723 This only removes files from the current branch, not from the | |
1724 entire project history. If the files still exist in the working | |
1725 directory, they will be deleted from it. | |
1726 """ | |
1442 names = [] | 1727 names = [] |
1443 def okaytoremove(abs, rel, exact): | 1728 def okaytoremove(abs, rel, exact): |
1444 c, a, d, u = repo.changes(files = [abs]) | 1729 c, a, d, u = repo.changes(files = [abs]) |
1445 reason = None | 1730 reason = None |
1446 if c: reason = _('is modified') | 1731 if c: reason = _('is modified') |
1455 if ui.verbose or not exact: ui.status(_('removing %s\n') % rel) | 1740 if ui.verbose or not exact: ui.status(_('removing %s\n') % rel) |
1456 names.append(abs) | 1741 names.append(abs) |
1457 repo.remove(names, unlink=True) | 1742 repo.remove(names, unlink=True) |
1458 | 1743 |
1459 def rename(ui, repo, *pats, **opts): | 1744 def rename(ui, repo, *pats, **opts): |
1460 """rename files; equivalent of copy + remove""" | 1745 """rename files; equivalent of copy + remove |
1746 | |
1747 Mark dest as copies of sources; mark sources for deletion. If | |
1748 dest is a directory, copies are put in that directory. If dest is | |
1749 a file, there can only be one source. | |
1750 | |
1751 By default, this command copies the contents of files as they | |
1752 stand in the working directory. If invoked with --after, the | |
1753 operation is recorded, but no copying is performed. | |
1754 | |
1755 This command takes effect in the next commit. | |
1756 | |
1757 NOTE: This command should be treated as experimental. While it | |
1758 should properly record rename files, this information is not yet | |
1759 fully used by merge, nor fully reported by log. | |
1760 """ | |
1461 errs, copied = docopy(ui, repo, pats, opts) | 1761 errs, copied = docopy(ui, repo, pats, opts) |
1462 names = [] | 1762 names = [] |
1463 for abs, rel, exact in copied: | 1763 for abs, rel, exact in copied: |
1464 if ui.verbose or not exact: ui.status(_('removing %s\n') % rel) | 1764 if ui.verbose or not exact: ui.status(_('removing %s\n') % rel) |
1465 names.append(abs) | 1765 names.append(abs) |
1466 repo.remove(names, unlink=True) | 1766 repo.remove(names, unlink=True) |
1467 return errs | 1767 return errs |
1468 | 1768 |
1469 def revert(ui, repo, *names, **opts): | 1769 def revert(ui, repo, *names, **opts): |
1470 """revert modified files or dirs back to their unmodified states""" | 1770 """revert modified files or dirs back to their unmodified states |
1771 | |
1772 Revert any uncommitted modifications made to the named files or | |
1773 directories. This restores the contents of the affected files to | |
1774 an unmodified state. | |
1775 | |
1776 If a file has been deleted, it is recreated. If the executable | |
1777 mode of a file was changed, it is reset. | |
1778 | |
1779 If a directory is given, all files in that directory and its | |
1780 subdirectories are reverted. | |
1781 | |
1782 If no arguments are given, all files in the current directory and | |
1783 its subdirectories are reverted. | |
1784 """ | |
1471 node = opts['rev'] and repo.lookup(opts['rev']) or \ | 1785 node = opts['rev'] and repo.lookup(opts['rev']) or \ |
1472 repo.dirstate.parents()[0] | 1786 repo.dirstate.parents()[0] |
1473 root = os.path.realpath(repo.root) | 1787 root = os.path.realpath(repo.root) |
1474 | 1788 |
1475 def trimpath(p): | 1789 def trimpath(p): |
1513 r = 1 | 1827 r = 1 |
1514 sys.stdout.flush() | 1828 sys.stdout.flush() |
1515 return r | 1829 return r |
1516 | 1830 |
1517 def root(ui, repo): | 1831 def root(ui, repo): |
1518 """print the root (top) of the current working dir""" | 1832 """print the root (top) of the current working dir |
1833 | |
1834 Print the root directory of the current repository. | |
1835 """ | |
1519 ui.write(repo.root + "\n") | 1836 ui.write(repo.root + "\n") |
1520 | 1837 |
1521 def serve(ui, repo, **opts): | 1838 def serve(ui, repo, **opts): |
1522 """export the repository via HTTP""" | 1839 """export the repository via HTTP |
1840 | |
1841 Start a local HTTP repository browser and pull server. | |
1842 | |
1843 By default, the server logs accesses to stdout and errors to | |
1844 stderr. Use the "-A" and "-E" options to log to files. | |
1845 """ | |
1523 | 1846 |
1524 if opts["stdio"]: | 1847 if opts["stdio"]: |
1525 fin, fout = sys.stdin, sys.stdout | 1848 fin, fout = sys.stdin, sys.stdout |
1526 sys.stdout = sys.stderr | 1849 sys.stdout = sys.stderr |
1527 | 1850 |
1617 else: | 1940 else: |
1618 ui.status(_('listening at http://%s/\n') % addr) | 1941 ui.status(_('listening at http://%s/\n') % addr) |
1619 httpd.serve_forever() | 1942 httpd.serve_forever() |
1620 | 1943 |
1621 def status(ui, repo, *pats, **opts): | 1944 def status(ui, repo, *pats, **opts): |
1622 '''show changed files in the working directory | 1945 """show changed files in the working directory |
1623 | 1946 |
1947 Show changed files in the working directory. If no names are | |
1948 given, all files are shown. Otherwise, only files matching the | |
1949 given names are shown. | |
1950 | |
1951 The codes used to show the status of files are: | |
1624 M = modified | 1952 M = modified |
1625 A = added | 1953 A = added |
1626 R = removed | 1954 R = removed |
1627 ? = not tracked | 1955 ? = not tracked |
1628 ''' | 1956 """ |
1629 | 1957 |
1630 cwd = repo.getcwd() | 1958 cwd = repo.getcwd() |
1631 files, matchfn, anypats = matchpats(repo, cwd, pats, opts) | 1959 files, matchfn, anypats = matchpats(repo, cwd, pats, opts) |
1632 (c, a, d, u) = [[util.pathto(cwd, x) for x in n] | 1960 (c, a, d, u) = [[util.pathto(cwd, x) for x in n] |
1633 for n in repo.changes(files=files, match=matchfn)] | 1961 for n in repo.changes(files=files, match=matchfn)] |
1648 | 1976 |
1649 for f in changes: | 1977 for f in changes: |
1650 ui.write(format % f) | 1978 ui.write(format % f) |
1651 | 1979 |
1652 def tag(ui, repo, name, rev=None, **opts): | 1980 def tag(ui, repo, name, rev=None, **opts): |
1653 """add a tag for the current tip or a given revision""" | 1981 """add a tag for the current tip or a given revision |
1982 | |
1983 Name a particular revision using <name>. | |
1984 | |
1985 Tags are used to name particular revisions of the repository and are | |
1986 very useful to compare different revision, to go back to significant | |
1987 earlier versions or to mark branch points as releases, etc. | |
1988 | |
1989 If no revision is given, the tip is used. | |
1990 | |
1991 To facilitate version control, distribution, and merging of tags, | |
1992 they are stored as a file named ".hgtags" which is managed | |
1993 similarly to other project files and can be hand-edited if | |
1994 necessary. | |
1995 """ | |
1654 if opts['text']: | 1996 if opts['text']: |
1655 ui.warn(_("Warning: -t and --text is deprecated," | 1997 ui.warn(_("Warning: -t and --text is deprecated," |
1656 " please use -m or --message instead.\n")) | 1998 " please use -m or --message instead.\n")) |
1657 if name == "tip": | 1999 if name == "tip": |
1658 raise util.Abort(_("the name 'tip' is reserved")) | 2000 raise util.Abort(_("the name 'tip' is reserved")) |
1684 repo.commit([".hgtags"], message, opts['user'], opts['date']) | 2026 repo.commit([".hgtags"], message, opts['user'], opts['date']) |
1685 except ValueError, inst: | 2027 except ValueError, inst: |
1686 raise util.Abort(str(inst)) | 2028 raise util.Abort(str(inst)) |
1687 | 2029 |
1688 def tags(ui, repo): | 2030 def tags(ui, repo): |
1689 """list repository tags""" | 2031 """list repository tags |
2032 | |
2033 List the repository tags. | |
2034 | |
2035 This lists both regular and local tags. | |
2036 """ | |
1690 | 2037 |
1691 l = repo.tagslist() | 2038 l = repo.tagslist() |
1692 l.reverse() | 2039 l.reverse() |
1693 for t, n in l: | 2040 for t, n in l: |
1694 try: | 2041 try: |
1696 except KeyError: | 2043 except KeyError: |
1697 r = " ?:?" | 2044 r = " ?:?" |
1698 ui.write("%-30s %s\n" % (t, r)) | 2045 ui.write("%-30s %s\n" % (t, r)) |
1699 | 2046 |
1700 def tip(ui, repo): | 2047 def tip(ui, repo): |
1701 """show the tip revision""" | 2048 """show the tip revision |
2049 | |
2050 Show the tip revision. | |
2051 """ | |
1702 n = repo.changelog.tip() | 2052 n = repo.changelog.tip() |
1703 show_changeset(ui, repo, changenode=n) | 2053 show_changeset(ui, repo, changenode=n) |
1704 | 2054 |
1705 def unbundle(ui, repo, fname): | 2055 def unbundle(ui, repo, fname): |
1706 """apply a changegroup file""" | 2056 """apply a changegroup file |
2057 | |
2058 Apply a compressed changegroup file generated by the bundle | |
2059 command. | |
2060 """ | |
1707 f = urllib.urlopen(fname) | 2061 f = urllib.urlopen(fname) |
1708 | 2062 |
1709 if f.read(4) != "HG10": | 2063 if f.read(4) != "HG10": |
1710 raise util.Abort(_("%s: not a Mercurial bundle file") % fname) | 2064 raise util.Abort(_("%s: not a Mercurial bundle file") % fname) |
1711 | 2065 |
1731 ineffective. | 2085 ineffective. |
1732 """ | 2086 """ |
1733 repo.undo() | 2087 repo.undo() |
1734 | 2088 |
1735 def update(ui, repo, node=None, merge=False, clean=False, branch=None): | 2089 def update(ui, repo, node=None, merge=False, clean=False, branch=None): |
1736 '''update or merge working directory | 2090 """update or merge working directory |
2091 | |
2092 Update the working directory to the specified revision. | |
1737 | 2093 |
1738 If there are no outstanding changes in the working directory and | 2094 If there are no outstanding changes in the working directory and |
1739 there is a linear relationship between the current version and the | 2095 there is a linear relationship between the current version and the |
1740 requested version, the result is the requested version. | 2096 requested version, the result is the requested version. |
1741 | 2097 |
1742 Otherwise the result is a merge between the contents of the | 2098 Otherwise the result is a merge between the contents of the |
1743 current working directory and the requested version. Files that | 2099 current working directory and the requested version. Files that |
1744 changed between either parent are marked as changed for the next | 2100 changed between either parent are marked as changed for the next |
1745 commit and a commit must be performed before any further updates | 2101 commit and a commit must be performed before any further updates |
1746 are allowed. | 2102 are allowed. |
1747 ''' | 2103 |
2104 By default, update will refuse to run if doing so would require | |
2105 merging or discarding local changes. | |
2106 """ | |
1748 if branch: | 2107 if branch: |
1749 br = repo.branchlookup(branch=branch) | 2108 br = repo.branchlookup(branch=branch) |
1750 found = [] | 2109 found = [] |
1751 for x in br: | 2110 for x in br: |
1752 if branch in br[x]: | 2111 if branch in br[x]: |
1765 else: | 2124 else: |
1766 node = node and repo.lookup(node) or repo.changelog.tip() | 2125 node = node and repo.lookup(node) or repo.changelog.tip() |
1767 return repo.update(node, allow=merge, force=clean) | 2126 return repo.update(node, allow=merge, force=clean) |
1768 | 2127 |
1769 def verify(ui, repo): | 2128 def verify(ui, repo): |
1770 """verify the integrity of the repository""" | 2129 """verify the integrity of the repository |
2130 | |
2131 Verify the integrity of the current repository. | |
2132 | |
2133 This will perform an extensive check of the repository's | |
2134 integrity, validating the hashes and checksums of each entry in | |
2135 the changelog, manifest, and tracked files, as well as the | |
2136 integrity of their crosslinks and indices. | |
2137 """ | |
1771 return repo.verify() | 2138 return repo.verify() |
1772 | 2139 |
1773 # Command options and aliases are listed here, alphabetically | 2140 # Command options and aliases are listed here, alphabetically |
1774 | 2141 |
1775 table = { | 2142 table = { |
1776 "^add": | 2143 "^add": |
1777 (add, | 2144 (add, |
1778 [('I', 'include', [], _('include path in search')), | 2145 [('I', 'include', [], _('include names matching the given patterns')), |
1779 ('X', 'exclude', [], _('exclude path from search'))], | 2146 ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1780 "hg add [OPTION]... [FILE]..."), | 2147 "hg add [OPTION]... [FILE]..."), |
1781 "addremove": | 2148 "addremove": |
1782 (addremove, | 2149 (addremove, |
1783 [('I', 'include', [], _('include path in search')), | 2150 [('I', 'include', [], _('include names matching the given patterns')), |
1784 ('X', 'exclude', [], _('exclude path from search'))], | 2151 ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1785 _("hg addremove [OPTION]... [FILE]...")), | 2152 "hg addremove [OPTION]... [FILE]..."), |
1786 "^annotate": | 2153 "^annotate": |
1787 (annotate, | 2154 (annotate, |
1788 [('r', 'rev', '', _('revision')), | 2155 [('r', 'rev', '', _('annotate the specified revision')), |
1789 ('a', 'text', None, _('treat all files as text')), | 2156 ('a', 'text', None, _('treat all files as text')), |
1790 ('u', 'user', None, _('show user')), | 2157 ('u', 'user', None, _('list the author')), |
1791 ('n', 'number', None, _('show revision number')), | 2158 ('n', 'number', None, _('list the revision number (default)')), |
1792 ('c', 'changeset', None, _('show changeset')), | 2159 ('c', 'changeset', None, _('list the changeset')), |
1793 ('I', 'include', [], _('include path in search')), | 2160 ('I', 'include', [], _('include names matching the given patterns')), |
1794 ('X', 'exclude', [], _('exclude path from search'))], | 2161 ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1795 _('hg annotate [OPTION]... FILE...')), | 2162 _('hg annotate [OPTION]... FILE...')), |
1796 "bundle": | 2163 "bundle": |
1797 (bundle, | 2164 (bundle, |
1798 [], | 2165 [], |
1799 _('hg bundle FILE DEST')), | 2166 _('hg bundle FILE DEST')), |
1800 "cat": | 2167 "cat": |
1801 (cat, | 2168 (cat, |
1802 [('I', 'include', [], _('include path in search')), | 2169 [('I', 'include', [], _('include names matching the given patterns')), |
1803 ('X', 'exclude', [], _('exclude path from search')), | 2170 ('X', 'exclude', [], _('exclude names matching the given patterns')), |
1804 ('o', 'output', "", _('output to file')), | 2171 ('o', 'output', "", _('print output to file with formatted name')), |
1805 ('r', 'rev', '', _('revision'))], | 2172 ('r', 'rev', '', _('print the given revision'))], |
1806 _('hg cat [OPTION]... FILE...')), | 2173 _('hg cat [OPTION]... FILE...')), |
1807 "^clone": | 2174 "^clone": |
1808 (clone, | 2175 (clone, |
1809 [('U', 'noupdate', None, _('skip update after cloning')), | 2176 [('U', 'noupdate', None, _('do not update the new working directory')), |
1810 ('e', 'ssh', "", _('ssh command')), | 2177 ('e', 'ssh', "", _('specify ssh command to use')), |
1811 ('', 'pull', None, _('use pull protocol to copy metadata')), | 2178 ('', 'pull', None, _('use pull protocol to copy metadata')), |
1812 ('', 'remotecmd', "", _('remote hg command'))], | 2179 ('', 'remotecmd', "", _('specify hg command to run on the remote side'))], |
1813 _('hg clone [OPTION]... SOURCE [DEST]')), | 2180 _('hg clone [OPTION]... SOURCE [DEST]')), |
1814 "^commit|ci": | 2181 "^commit|ci": |
1815 (commit, | 2182 (commit, |
1816 [('A', 'addremove', None, _('run add/remove during commit')), | 2183 [('A', 'addremove', None, _('run addremove during commit')), |
1817 ('I', 'include', [], _('include path in search')), | 2184 ('I', 'include', [], _('include names matching the given patterns')), |
1818 ('X', 'exclude', [], _('exclude path from search')), | 2185 ('X', 'exclude', [], _('exclude names matching the given patterns')), |
1819 ('m', 'message', "", _('commit message')), | 2186 ('m', 'message', "", _('use <text> as commit message')), |
1820 ('t', 'text', "", _('commit message (deprecated: use -m)')), | 2187 ('t', 'text', "", _('commit message (deprecated: use -m)')), |
1821 ('l', 'logfile', "", _('commit message file')), | 2188 ('l', 'logfile', "", _('read the commit message from <file>')), |
1822 ('d', 'date', "", _('date code')), | 2189 ('d', 'date', "", _('record datecode as commit date')), |
1823 ('u', 'user', "", _('user'))], | 2190 ('u', 'user', "", _('record user as commiter'))], |
1824 _('hg commit [OPTION]... [FILE]...')), | 2191 _('hg commit [OPTION]... [FILE]...')), |
1825 "copy|cp": (copy, | 2192 "copy|cp": (copy, |
1826 [('I', 'include', [], _('include path in search')), | 2193 [('I', 'include', [], _('include names matching the given patterns')), |
1827 ('X', 'exclude', [], _('exclude path from search')), | 2194 ('X', 'exclude', [], _('exclude names matching the given patterns')), |
1828 ('A', 'after', None, _('record a copy after it has happened')), | 2195 ('A', 'after', None, _('record a copy that has already occurred')), |
1829 ('f', 'force', None, _('replace destination if it exists')), | 2196 ('f', 'force', None, _('forcibly copy over an existing managed file')), |
1830 ('p', 'parents', None, _('append source path to dest'))], | 2197 ('p', 'parents', None, _('append source path to dest'))], |
1831 _('hg copy [OPTION]... [SOURCE]... DEST')), | 2198 _('hg copy [OPTION]... [SOURCE]... DEST')), |
1832 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), | 2199 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), |
1833 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), | 2200 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), |
1834 "debugconfig": (debugconfig, [], _('debugconfig')), | 2201 "debugconfig": (debugconfig, [], _('debugconfig')), |
1838 "debugindex": (debugindex, [], _('debugindex FILE')), | 2205 "debugindex": (debugindex, [], _('debugindex FILE')), |
1839 "debugindexdot": (debugindexdot, [], _('debugindexdot FILE')), | 2206 "debugindexdot": (debugindexdot, [], _('debugindexdot FILE')), |
1840 "debugrename": (debugrename, [], _('debugrename FILE [REV]')), | 2207 "debugrename": (debugrename, [], _('debugrename FILE [REV]')), |
1841 "debugwalk": | 2208 "debugwalk": |
1842 (debugwalk, | 2209 (debugwalk, |
1843 [('I', 'include', [], _('include path in search')), | 2210 [('I', 'include', [], _('include names matching the given patterns')), |
1844 ('X', 'exclude', [], _('exclude path from search'))], | 2211 ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1845 _('debugwalk [OPTION]... [FILE]...')), | 2212 _('debugwalk [OPTION]... [FILE]...')), |
1846 "^diff": | 2213 "^diff": |
1847 (diff, | 2214 (diff, |
1848 [('r', 'rev', [], _('revision')), | 2215 [('r', 'rev', [], _('revision')), |
1849 ('a', 'text', None, _('treat all files as text')), | 2216 ('a', 'text', None, _('treat all files as text')), |
1850 ('I', 'include', [], _('include path in search')), | 2217 ('I', 'include', [], _('include names matching the given patterns')), |
1851 ('X', 'exclude', [], _('exclude path from search'))], | 2218 ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1852 _('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')), | 2219 _('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')), |
1853 "^export": | 2220 "^export": |
1854 (export, | 2221 (export, |
1855 [('o', 'output', "", _('output to file')), | 2222 [('o', 'output', "", _('print output to file with formatted name')), |
1856 ('a', 'text', None, _('treat all files as text'))], | 2223 ('a', 'text', None, _('treat all files as text'))], |
1857 _("hg export [-a] [-o OUTFILE] REV...")), | 2224 "hg export [-a] [-o OUTFILE] REV..."), |
1858 "forget": | 2225 "forget": |
1859 (forget, | 2226 (forget, |
1860 [('I', 'include', [], _('include path in search')), | 2227 [('I', 'include', [], _('include names matching the given patterns')), |
1861 ('X', 'exclude', [], _('exclude path from search'))], | 2228 ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1862 _("hg forget [OPTION]... FILE...")), | 2229 "hg forget [OPTION]... FILE..."), |
1863 "grep": | 2230 "grep": |
1864 (grep, | 2231 (grep, |
1865 [('0', 'print0', None, _('end fields with NUL')), | 2232 [('0', 'print0', None, _('end fields with NUL')), |
1866 ('I', 'include', [], _('include path in search')), | 2233 ('I', 'include', [], _('include names matching the given patterns')), |
1867 ('X', 'exclude', [], _('include path in search')), | 2234 ('X', 'exclude', [], _('include names matching the given patterns')), |
1868 ('', 'all', None, _('print all revisions with matches')), | 2235 ('', 'all', None, _('print all revisions that match')), |
1869 ('i', 'ignore-case', None, _('ignore case when matching')), | 2236 ('i', 'ignore-case', None, _('ignore case when matching')), |
1870 ('l', 'files-with-matches', None, _('print names of files and revs with matches')), | 2237 ('l', 'files-with-matches', None, _('print only filenames and revs that match')), |
1871 ('n', 'line-number', None, _('print line numbers')), | 2238 ('n', 'line-number', None, _('print matching line numbers')), |
1872 ('r', 'rev', [], _('search in revision rev')), | 2239 ('r', 'rev', [], _('search in given revision range')), |
1873 ('u', 'user', None, _('print user who made change'))], | 2240 ('u', 'user', None, _('print user who committed change'))], |
1874 _("hg grep [OPTION]... PATTERN [FILE]...")), | 2241 "hg grep [OPTION]... PATTERN [FILE]..."), |
1875 "heads": | 2242 "heads": |
1876 (heads, | 2243 (heads, |
1877 [('b', 'branches', None, _('find branch info'))], | 2244 [('b', 'branches', None, _('find branch info'))], |
1878 _('hg heads [-b]')), | 2245 _('hg heads [-b]')), |
1879 "help": (help_, [], _('hg help [COMMAND]')), | 2246 "help": (help_, [], _('hg help [COMMAND]')), |
1880 "identify|id": (identify, [], _('hg identify')), | 2247 "identify|id": (identify, [], _('hg identify')), |
1881 "import|patch": | 2248 "import|patch": |
1882 (import_, | 2249 (import_, |
1883 [('p', 'strip', 1, _('path strip')), | 2250 [('p', 'strip', 1, _('directory strip option for patch. This has the same\n') + |
1884 ('f', 'force', None, _('skip check for outstanding changes')), | 2251 _('meaning as the corresponding patch option')), |
2252 ('f', 'force', None, _('skip check for outstanding uncommitted changes')), | |
1885 ('b', 'base', "", _('base path'))], | 2253 ('b', 'base', "", _('base path'))], |
1886 _("hg import [-f] [-p NUM] [-b BASE] PATCH...")), | 2254 "hg import [-f] [-p NUM] [-b BASE] PATCH..."), |
1887 "incoming|in": (incoming, | 2255 "incoming|in": (incoming, |
1888 [('M', 'no-merges', None, _("do not show merges")), | 2256 [('M', 'no-merges', None, _("do not show merges")), |
1889 ('p', 'patch', None, _('show patch'))], | 2257 ('p', 'patch', None, _('show patch'))], |
1890 _('hg incoming [-p] [SOURCE]')), | 2258 _('hg incoming [-p] [SOURCE]')), |
1891 "^init": (init, [], _('hg init [DEST]')), | 2259 "^init": (init, [], _('hg init [DEST]')), |
1892 "locate": | 2260 "locate": |
1893 (locate, | 2261 (locate, |
1894 [('r', 'rev', '', _('revision')), | 2262 [('r', 'rev', '', _('search the repository as it stood at rev')), |
1895 ('0', 'print0', None, _('end filenames with NUL')), | 2263 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), |
1896 ('f', 'fullpath', None, _('print complete paths')), | 2264 ('f', 'fullpath', None, _('print complete paths from the filesystem root')), |
1897 ('I', 'include', [], _('include path in search')), | 2265 ('I', 'include', [], _('include names matching the given patterns')), |
1898 ('X', 'exclude', [], _('exclude path from search'))], | 2266 ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1899 _('hg locate [OPTION]... [PATTERN]...')), | 2267 _('hg locate [OPTION]... [PATTERN]...')), |
1900 "^log|history": | 2268 "^log|history": |
1901 (log, | 2269 (log, |
1902 [('I', 'include', [], _('include path in search')), | 2270 [('I', 'include', [], _('include names matching the given patterns')), |
1903 ('X', 'exclude', [], _('exclude path from search')), | 2271 ('X', 'exclude', [], _('exclude names matching the given patterns')), |
1904 ('b', 'branch', None, _('show branches')), | 2272 ('b', 'branch', None, _('show branches')), |
1905 ('k', 'keyword', [], _('search for a keyword')), | 2273 ('k', 'keyword', [], _('search for a keyword')), |
1906 ('r', 'rev', [], _('revision')), | 2274 ('r', 'rev', [], _('show the specified revision or range')), |
1907 ('M', 'no-merges', None, _("do not show merges")), | 2275 ('M', 'no-merges', None, _("do not show merges")), |
1908 ('m', 'only-merges', None, _("show only merges")), | 2276 ('m', 'only-merges', None, _("show only merges")), |
1909 ('p', 'patch', None, _('show patch'))], | 2277 ('p', 'patch', None, _('show patch'))], |
1910 _('hg log [-I] [-X] [-r REV]... [-p] [FILE]')), | 2278 _('hg log [-I] [-X] [-r REV]... [-p] [FILE]')), |
1911 "manifest": (manifest, [], _('hg manifest [REV]')), | 2279 "manifest": (manifest, [], _('hg manifest [REV]')), |
1915 _('hg outgoing [-p] [DEST]')), | 2283 _('hg outgoing [-p] [DEST]')), |
1916 "parents": (parents, [], _('hg parents [REV]')), | 2284 "parents": (parents, [], _('hg parents [REV]')), |
1917 "paths": (paths, [], _('hg paths [NAME]')), | 2285 "paths": (paths, [], _('hg paths [NAME]')), |
1918 "^pull": | 2286 "^pull": |
1919 (pull, | 2287 (pull, |
1920 [('u', 'update', None, _('update working directory')), | 2288 [('u', 'update', None, _('update the working directory to tip after pull')), |
1921 ('e', 'ssh', "", _('ssh command')), | 2289 ('e', 'ssh', "", _('specify ssh command to use')), |
1922 ('', 'remotecmd', "", _('remote hg command'))], | 2290 ('', 'remotecmd', "", _('specify hg command to run on the remote side'))], |
1923 _('hg pull [-u] [-e FILE] [--remotecmd FILE] [SOURCE]')), | 2291 _('hg pull [-u] [-e FILE] [--remotecmd FILE] [SOURCE]')), |
1924 "^push": | 2292 "^push": |
1925 (push, | 2293 (push, |
1926 [('f', 'force', None, _('force push')), | 2294 [('f', 'force', None, _('force push')), |
1927 ('e', 'ssh', "", _('ssh command')), | 2295 ('e', 'ssh', "", _('specify ssh command to use')), |
1928 ('', 'remotecmd', "", _('remote hg command'))], | 2296 ('', 'remotecmd', "", _('specify hg command to run on the remote side'))], |
1929 _('hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]')), | 2297 _('hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]')), |
1930 "rawcommit": | 2298 "rawcommit": |
1931 (rawcommit, | 2299 (rawcommit, |
1932 [('p', 'parent', [], _('parent')), | 2300 [('p', 'parent', [], _('parent')), |
1933 ('d', 'date', "", _('date code')), | 2301 ('d', 'date', "", _('date code')), |
1937 ('t', 'text', "", _('commit message (deprecated: use -m)')), | 2305 ('t', 'text', "", _('commit message (deprecated: use -m)')), |
1938 ('l', 'logfile', "", _('commit message file'))], | 2306 ('l', 'logfile', "", _('commit message file'))], |
1939 _('hg rawcommit [OPTION]... [FILE]...')), | 2307 _('hg rawcommit [OPTION]... [FILE]...')), |
1940 "recover": (recover, [], _("hg recover")), | 2308 "recover": (recover, [], _("hg recover")), |
1941 "^remove|rm": (remove, | 2309 "^remove|rm": (remove, |
1942 [('I', 'include', [], _('include path in search')), | 2310 [('I', 'include', [], _('include names matching the given patterns')), |
1943 ('X', 'exclude', [], _('exclude path from search'))], | 2311 ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1944 _("hg remove [OPTION]... FILE...")), | 2312 _("hg remove [OPTION]... FILE...")), |
1945 "rename|mv": (rename, | 2313 "rename|mv": (rename, |
1946 [('I', 'include', [], _('include path in search')), | 2314 [('I', 'include', [], _('include names matching the given patterns')), |
1947 ('X', 'exclude', [], _('exclude path from search')), | 2315 ('X', 'exclude', [], _('exclude names matching the given patterns')), |
1948 ('A', 'after', None, _('record a copy after it has happened')), | 2316 ('A', 'after', None, _('record a rename that has already occurred')), |
1949 ('f', 'force', None, _('replace destination if it exists')), | 2317 ('f', 'force', None, _('forcibly copy over an existing managed file')), |
1950 ('p', 'parents', None, _('append source path to dest'))], | 2318 ('p', 'parents', None, _('append source path to dest'))], |
1951 _('hg rename [OPTION]... [SOURCE]... DEST')), | 2319 _('hg rename [OPTION]... [SOURCE]... DEST')), |
1952 "^revert": | 2320 "^revert": |
1953 (revert, | 2321 (revert, |
1954 [("n", "nonrecursive", None, _("don't recurse into subdirs")), | 2322 [("n", "nonrecursive", None, _("do not recurse into subdirectories")), |
1955 ("r", "rev", "", _("revision"))], | 2323 ("r", "rev", "", _("revision to revert to"))], |
1956 _("hg revert [-n] [-r REV] [NAME]...")), | 2324 _("hg revert [-n] [-r REV] [NAME]...")), |
1957 "root": (root, [], _("hg root")), | 2325 "root": (root, [], _("hg root")), |
1958 "^serve": | 2326 "^serve": |
1959 (serve, | 2327 (serve, |
1960 [('A', 'accesslog', '', _('access log file')), | 2328 [('A', 'accesslog', '', _('name of access log file to write to')), |
1961 ('E', 'errorlog', '', _('error log file')), | 2329 ('E', 'errorlog', '', _('name of error log file to write to')), |
1962 ('p', 'port', 0, _('listen port')), | 2330 ('p', 'port', 0, _('port to use (default: 8000)')), |
1963 ('a', 'address', '', _('interface address')), | 2331 ('a', 'address', '', _('address to use')), |
1964 ('n', 'name', "", _('repository name')), | 2332 ('n', 'name', "", _('name to show in web pages (default: working dir)')), |
1965 ('', 'stdio', None, _('for remote clients')), | 2333 ('', 'stdio', None, _('for remote clients')), |
1966 ('t', 'templates', "", _('template directory')), | 2334 ('t', 'templates', "", _('web templates to use')), |
1967 ('', 'style', "", _('template style')), | 2335 ('', 'style', "", _('template style to use')), |
1968 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4'))], | 2336 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4'))], |
1969 _("hg serve [OPTION]...")), | 2337 _("hg serve [OPTION]...")), |
1970 "^status": | 2338 "^status": |
1971 (status, | 2339 (status, |
1972 [('m', 'modified', None, _('show only modified files')), | 2340 [('m', 'modified', None, _('show only modified files')), |
1973 ('a', 'added', None, _('show only added files')), | 2341 ('a', 'added', None, _('show only added files')), |
1974 ('r', 'removed', None, _('show only removed files')), | 2342 ('r', 'removed', None, _('show only removed files')), |
1975 ('u', 'unknown', None, _('show only unknown (not tracked) files')), | 2343 ('u', 'unknown', None, _('show only unknown (not tracked) files')), |
1976 ('n', 'no-status', None, _('hide status prefix')), | 2344 ('n', 'no-status', None, _('hide status prefix')), |
1977 ('0', 'print0', None, _('end filenames with NUL')), | 2345 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), |
1978 ('I', 'include', [], _('include path in search')), | 2346 ('I', 'include', [], _('include names matching the given patterns')), |
1979 ('X', 'exclude', [], _('exclude path from search'))], | 2347 ('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1980 _("hg status [OPTION]... [FILE]...")), | 2348 _("hg status [OPTION]... [FILE]...")), |
1981 "tag": | 2349 "tag": |
1982 (tag, | 2350 (tag, |
1983 [('l', 'local', None, _('make the tag local')), | 2351 [('l', 'local', None, _('make the tag local')), |
1984 ('m', 'message', "", _('commit message')), | 2352 ('m', 'message', "", _('message for tag commit log entry')), |
1985 ('t', 'text', "", _('commit message (deprecated: use -m)')), | 2353 ('t', 'text', "", _('commit message (deprecated: use -m)')), |
1986 ('d', 'date', "", _('date code')), | 2354 ('d', 'date', "", _('record datecode as commit date')), |
1987 ('u', 'user', "", _('user'))], | 2355 ('u', 'user', "", _('record user as commiter'))], |
1988 _('hg tag [OPTION]... NAME [REV]')), | 2356 _('hg tag [OPTION]... NAME [REV]')), |
1989 "tags": (tags, [], _('hg tags')), | 2357 "tags": (tags, [], _('hg tags')), |
1990 "tip": (tip, [], _('hg tip')), | 2358 "tip": (tip, [], _('hg tip')), |
1991 "unbundle": | 2359 "unbundle": |
1992 (unbundle, | 2360 (unbundle, |
1994 _('hg unbundle FILE')), | 2362 _('hg unbundle FILE')), |
1995 "undo": (undo, [], _('hg undo')), | 2363 "undo": (undo, [], _('hg undo')), |
1996 "^update|up|checkout|co": | 2364 "^update|up|checkout|co": |
1997 (update, | 2365 (update, |
1998 [('b', 'branch', "", _('checkout the head of a specific branch')), | 2366 [('b', 'branch', "", _('checkout the head of a specific branch')), |
1999 ('m', 'merge', None, _('allow merging of conflicts')), | 2367 ('m', 'merge', None, _('allow merging of branches')), |
2000 ('C', 'clean', None, _('overwrite locally modified files'))], | 2368 ('C', 'clean', None, _('overwrite locally modified files'))], |
2001 _('hg update [-b TAG] [-m] [-C] [REV]')), | 2369 _('hg update [-b TAG] [-m] [-C] [REV]')), |
2002 "verify": (verify, [], _('hg verify')), | 2370 "verify": (verify, [], _('hg verify')), |
2003 "version": (show_version, [], _('hg version')), | 2371 "version": (show_version, [], _('hg version')), |
2004 } | 2372 } |
2005 | 2373 |
2006 globalopts = [ | 2374 globalopts = [ |
2007 ('R', 'repository', "", _('repository root directory')), | 2375 ('R', 'repository', "", _("repository root directory")), |
2008 ('', 'cwd', '', _('change working directory')), | 2376 ('', 'cwd', '', _("change working directory")), |
2009 ('y', 'noninteractive', None, _('run non-interactively')), | 2377 ('y', 'noninteractive', None, _("do not prompt, assume 'yes' for any required answers")), |
2010 ('q', 'quiet', None, _('quiet mode')), | 2378 ('q', 'quiet', None, _("suppress output")), |
2011 ('v', 'verbose', None, _('verbose mode')), | 2379 ('v', 'verbose', None, _("enable additional output")), |
2012 ('', 'debug', None, _('debug mode')), | 2380 ('', 'debug', None, _("enable debugging output")), |
2013 ('', 'debugger', None, _('start debugger')), | 2381 ('', 'debugger', None, _("start debugger")), |
2014 ('', 'traceback', None, _('print traceback on exception')), | 2382 ('', 'traceback', None, _("print traceback on exception")), |
2015 ('', 'time', None, _('time how long the command takes')), | 2383 ('', 'time', None, _("time how long the command takes")), |
2016 ('', 'profile', None, _('profile')), | 2384 ('', 'profile', None, _("print command execution profile")), |
2017 ('', 'version', None, _('output version information and exit')), | 2385 ('', 'version', None, _("output version information and exit")), |
2018 ('h', 'help', None, _('display help and exit')), | 2386 ('h', 'help', None, _("display help and exit")), |
2019 ] | 2387 ] |
2020 | 2388 |
2021 norepo = ("clone init version help debugancestor debugconfig debugdata" | 2389 norepo = ("clone init version help debugancestor debugconfig debugdata" |
2022 " debugindex debugindexdot paths") | 2390 " debugindex debugindexdot paths") |
2023 | 2391 |