##// END OF EJS Templates
import docstring from doc/hg.1.txt
Benoit Boissinot -
r1437:ea51d296 default
parent child Browse files
Show More
This diff has been collapsed as it changes many lines, (642 lines changed) Show them Hide them
@@ -476,7 +476,16 def help_(ui, cmd=None, with_version=Fal
476 476 # Commands start here, listed alphabetically
477 477
478 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 489 names = []
481 490 for src, abs, rel, exact in walk(repo, pats, opts):
482 491 if exact:
@@ -488,7 +497,13 def add(ui, repo, *pats, **opts):
488 497 repo.add(names)
489 498
490 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 507 add, remove = [], []
493 508 for src, abs, rel, exact in walk(repo, pats, opts):
494 509 if src == 'f' and repo.dirstate.state(abs) == '?':
@@ -503,7 +518,17 def addremove(ui, repo, *pats, **opts):
503 518 repo.remove(remove)
504 519
505 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 532 def getnode(rev):
508 533 return short(repo.changelog.node(rev))
509 534
@@ -551,7 +576,20 def annotate(ui, repo, *pats, **opts):
551 576 ui.write("%s: %s" % (" ".join(p), l[1]))
552 577
553 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 593 f = open(fname, "wb")
556 594 dest = ui.expandpath(dest)
557 595 other = hg.repository(ui, dest)
@@ -572,7 +610,19 def bundle(ui, repo, fname, dest="defaul
572 610 raise
573 611
574 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 626 mf = {}
577 627 if opts['rev']:
578 628 change = repo.changelog.read(repo.lookup(opts['rev']))
@@ -593,7 +643,22 def cat(ui, repo, file1, *pats, **opts):
593 643 fp.write(r.read(n))
594 644
595 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 662 if dest is None:
598 663 dest = os.path.basename(os.path.normpath(source))
599 664
@@ -668,7 +733,16 def clone(ui, source, dest=None, **opts)
668 733 d.close()
669 734
670 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 746 if opts['text']:
673 747 ui.warn(_("Warning: -t and --text is deprecated,"
674 748 " please use -m or --message instead.\n"))
@@ -786,7 +860,22 def docopy(ui, repo, pats, opts):
786 860 return errs, copied
787 861
788 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 879 errs, copied = docopy(ui, repo, pats, opts)
791 880 return errs
792 881
@@ -927,7 +1016,22 def debugwalk(ui, repo, *pats, **opts):
927 1016 ui.write("%s\n" % line.rstrip())
928 1017
929 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 1035 node1, node2 = None, None
932 1036 revs = [repo.lookup(x) for x in opts['rev']]
933 1037
@@ -968,7 +1072,29 def doexport(ui, repo, changeset, seqno,
968 1072 fp.close()
969 1073
970 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 1098 if not changesets:
973 1099 raise util.Abort(_("export requires at least one changeset"))
974 1100 seqno = 0
@@ -981,7 +1107,10 def export(ui, repo, *changesets, **opts
981 1107 doexport(ui, repo, cset, seqno, total, revwidth, opts)
982 1108
983 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 1114 forget = []
986 1115 for src, abs, rel, exact in walk(repo, pats, opts):
987 1116 if repo.dirstate.state(abs) == 'a':
@@ -991,7 +1120,21 def forget(ui, repo, *pats, **opts):
991 1120 repo.forget(forget)
992 1121
993 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 1138 reflags = 0
996 1139 if opts['ignore_case']:
997 1140 reflags |= re.I
@@ -1110,7 +1253,14 def grep(ui, repo, pattern, *pats, **opt
1110 1253 return (count == 0 and 1) or 0
1111 1254
1112 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 1264 heads = repo.changelog.heads()
1115 1265 br = None
1116 1266 if opts['branches']:
@@ -1119,7 +1269,13 def heads(ui, repo, **opts):
1119 1269 show_changeset(ui, repo, changenode=n, brinfo=br)
1120 1270
1121 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 1279 parents = [p for p in repo.dirstate.parents() if p != nullid]
1124 1280 if not parents:
1125 1281 ui.write(_("unknown\n"))
@@ -1141,7 +1297,19 def identify(ui, repo):
1141 1297 ui.write("%s\n" % ' '.join(output))
1142 1298
1143 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 1313 patches = (patch1,) + patches
1146 1314
1147 1315 if not opts['force']:
@@ -1204,7 +1372,14 def import_(ui, repo, patch1, *patches,
1204 1372 repo.commit(files, message, user)
1205 1373
1206 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 1383 source = ui.expandpath(source)
1209 1384 other = hg.repository(ui, source)
1210 1385 if not other.local():
@@ -1224,13 +1399,35 def incoming(ui, repo, source="default",
1224 1399 ui.write("\n")
1225 1400
1226 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 1409 if not os.path.exists(dest):
1229 1410 os.mkdir(dest)
1230 1411 hg.repository(ui, dest, create=1)
1231 1412
1232 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 1431 end = opts['print0'] and '\0' or '\n'
1235 1432
1236 1433 for src, abs, rel, exact in walk(repo, pats, opts, '(?:.*/|)'):
@@ -1242,7 +1439,15 def locate(ui, repo, *pats, **opts):
1242 1439 ui.write(rel, end)
1243 1440
1244 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 1451 class dui:
1247 1452 # Implement and delegate some ui protocol. Save hunks of
1248 1453 # output for later display in the desired order.
@@ -1310,7 +1515,13 def log(ui, repo, *pats, **opts):
1310 1515 ui.write(*args)
1311 1516
1312 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 1525 if rev:
1315 1526 try:
1316 1527 # assume all revision numbers are for changesets
@@ -1330,7 +1541,12 def manifest(ui, repo, rev=None):
1330 1541 ui.write("%40s %3s %s\n" % (hex(m[f]), mf[f] and "755" or "644", f))
1331 1542
1332 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 1550 dest = ui.expandpath(dest)
1335 1551 other = hg.repository(ui, dest)
1336 1552 o = repo.findoutgoing(other)
@@ -1346,7 +1562,10 def outgoing(ui, repo, dest="default-pus
1346 1562 ui.write("\n")
1347 1563
1348 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 1569 if rev:
1351 1570 p = repo.changelog.parents(repo.lookup(rev))
1352 1571 else:
@@ -1357,7 +1576,14 def parents(ui, repo, rev=None):
1357 1576 show_changeset(ui, repo, changenode=n)
1358 1577
1359 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 1587 try:
1362 1588 repo = hg.repository(ui=ui)
1363 1589 except hg.RepoError:
@@ -1375,7 +1601,26 def paths(ui, search=None):
1375 1601 ui.write("%s = %s\n" % (name, path))
1376 1602
1377 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 1624 source = ui.expandpath(source)
1380 1625 ui.status(_('pulling from %s\n') % (source))
1381 1626
@@ -1395,7 +1640,27 def pull(ui, repo, source="default", **o
1395 1640 return r
1396 1641
1397 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 1664 dest = ui.expandpath(dest)
1400 1665 ui.status('pushing to %s\n' % (dest))
1401 1666
@@ -1409,7 +1674,13 def push(ui, repo, dest="default-push",
1409 1674 return r
1410 1675
1411 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 1684 if rc['text']:
1414 1685 ui.warn(_("Warning: -t and --text is deprecated,"
1415 1686 " please use -m or --message instead.\n"))
@@ -1434,11 +1705,25 def rawcommit(ui, repo, *flist, **rc):
1434 1705 raise util.Abort(str(inst))
1435 1706
1436 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 1715 repo.recover()
1439 1716
1440 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 1727 names = []
1443 1728 def okaytoremove(abs, rel, exact):
1444 1729 c, a, d, u = repo.changes(files = [abs])
@@ -1457,7 +1742,22 def remove(ui, repo, pat, *pats, **opts)
1457 1742 repo.remove(names, unlink=True)
1458 1743
1459 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 1761 errs, copied = docopy(ui, repo, pats, opts)
1462 1762 names = []
1463 1763 for abs, rel, exact in copied:
@@ -1467,7 +1767,21 def rename(ui, repo, *pats, **opts):
1467 1767 return errs
1468 1768
1469 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 1785 node = opts['rev'] and repo.lookup(opts['rev']) or \
1472 1786 repo.dirstate.parents()[0]
1473 1787 root = os.path.realpath(repo.root)
@@ -1515,11 +1829,20 def revert(ui, repo, *names, **opts):
1515 1829 return r
1516 1830
1517 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 1836 ui.write(repo.root + "\n")
1520 1837
1521 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 1847 if opts["stdio"]:
1525 1848 fin, fout = sys.stdin, sys.stdout
@@ -1619,13 +1942,18 def serve(ui, repo, **opts):
1619 1942 httpd.serve_forever()
1620 1943
1621 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 1952 M = modified
1625 1953 A = added
1626 1954 R = removed
1627 1955 ? = not tracked
1628 '''
1956 """
1629 1957
1630 1958 cwd = repo.getcwd()
1631 1959 files, matchfn, anypats = matchpats(repo, cwd, pats, opts)
@@ -1650,7 +1978,21 def status(ui, repo, *pats, **opts):
1650 1978 ui.write(format % f)
1651 1979
1652 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 1996 if opts['text']:
1655 1997 ui.warn(_("Warning: -t and --text is deprecated,"
1656 1998 " please use -m or --message instead.\n"))
@@ -1686,7 +2028,12 def tag(ui, repo, name, rev=None, **opts
1686 2028 raise util.Abort(str(inst))
1687 2029
1688 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 2038 l = repo.tagslist()
1692 2039 l.reverse()
@@ -1698,12 +2045,19 def tags(ui, repo):
1698 2045 ui.write("%-30s %s\n" % (t, r))
1699 2046
1700 2047 def tip(ui, repo):
1701 """show the tip revision"""
2048 """show the tip revision
2049
2050 Show the tip revision.
2051 """
1702 2052 n = repo.changelog.tip()
1703 2053 show_changeset(ui, repo, changenode=n)
1704 2054
1705 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 2061 f = urllib.urlopen(fname)
1708 2062
1709 2063 if f.read(4) != "HG10":
@@ -1733,7 +2087,9 def undo(ui, repo):
1733 2087 repo.undo()
1734 2088
1735 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 2094 If there are no outstanding changes in the working directory and
1739 2095 there is a linear relationship between the current version and the
@@ -1744,7 +2100,10 def update(ui, repo, node=None, merge=Fa
1744 2100 changed between either parent are marked as changed for the next
1745 2101 commit and a commit must be performed before any further updates
1746 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 2107 if branch:
1749 2108 br = repo.branchlookup(branch=branch)
1750 2109 found = []
@@ -1767,7 +2126,15 def update(ui, repo, node=None, merge=Fa
1767 2126 return repo.update(node, allow=merge, force=clean)
1768 2127
1769 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 2138 return repo.verify()
1772 2139
1773 2140 # Command options and aliases are listed here, alphabetically
@@ -1775,23 +2142,23 def verify(ui, repo):
1775 2142 table = {
1776 2143 "^add":
1777 2144 (add,
1778 [('I', 'include', [], _('include path in search')),
1779 ('X', 'exclude', [], _('exclude path from search'))],
2145 [('I', 'include', [], _('include names matching the given patterns')),
2146 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
1780 2147 "hg add [OPTION]... [FILE]..."),
1781 2148 "addremove":
1782 2149 (addremove,
1783 [('I', 'include', [], _('include path in search')),
1784 ('X', 'exclude', [], _('exclude path from search'))],
1785 _("hg addremove [OPTION]... [FILE]...")),
2150 [('I', 'include', [], _('include names matching the given patterns')),
2151 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2152 "hg addremove [OPTION]... [FILE]..."),
1786 2153 "^annotate":
1787 2154 (annotate,
1788 [('r', 'rev', '', _('revision')),
2155 [('r', 'rev', '', _('annotate the specified revision')),
1789 2156 ('a', 'text', None, _('treat all files as text')),
1790 ('u', 'user', None, _('show user')),
1791 ('n', 'number', None, _('show revision number')),
1792 ('c', 'changeset', None, _('show changeset')),
1793 ('I', 'include', [], _('include path in search')),
1794 ('X', 'exclude', [], _('exclude path from search'))],
2157 ('u', 'user', None, _('list the author')),
2158 ('n', 'number', None, _('list the revision number (default)')),
2159 ('c', 'changeset', None, _('list the changeset')),
2160 ('I', 'include', [], _('include names matching the given patterns')),
2161 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
1795 2162 _('hg annotate [OPTION]... FILE...')),
1796 2163 "bundle":
1797 2164 (bundle,
@@ -1799,34 +2166,34 table = {
1799 2166 _('hg bundle FILE DEST')),
1800 2167 "cat":
1801 2168 (cat,
1802 [('I', 'include', [], _('include path in search')),
1803 ('X', 'exclude', [], _('exclude path from search')),
1804 ('o', 'output', "", _('output to file')),
1805 ('r', 'rev', '', _('revision'))],
2169 [('I', 'include', [], _('include names matching the given patterns')),
2170 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2171 ('o', 'output', "", _('print output to file with formatted name')),
2172 ('r', 'rev', '', _('print the given revision'))],
1806 2173 _('hg cat [OPTION]... FILE...')),
1807 2174 "^clone":
1808 2175 (clone,
1809 [('U', 'noupdate', None, _('skip update after cloning')),
1810 ('e', 'ssh', "", _('ssh command')),
2176 [('U', 'noupdate', None, _('do not update the new working directory')),
2177 ('e', 'ssh', "", _('specify ssh command to use')),
1811 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 2180 _('hg clone [OPTION]... SOURCE [DEST]')),
1814 2181 "^commit|ci":
1815 2182 (commit,
1816 [('A', 'addremove', None, _('run add/remove during commit')),
1817 ('I', 'include', [], _('include path in search')),
1818 ('X', 'exclude', [], _('exclude path from search')),
1819 ('m', 'message', "", _('commit message')),
2183 [('A', 'addremove', None, _('run addremove during commit')),
2184 ('I', 'include', [], _('include names matching the given patterns')),
2185 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2186 ('m', 'message', "", _('use <text> as commit message')),
1820 2187 ('t', 'text', "", _('commit message (deprecated: use -m)')),
1821 ('l', 'logfile', "", _('commit message file')),
1822 ('d', 'date', "", _('date code')),
1823 ('u', 'user', "", _('user'))],
2188 ('l', 'logfile', "", _('read the commit message from <file>')),
2189 ('d', 'date', "", _('record datecode as commit date')),
2190 ('u', 'user', "", _('record user as commiter'))],
1824 2191 _('hg commit [OPTION]... [FILE]...')),
1825 2192 "copy|cp": (copy,
1826 [('I', 'include', [], _('include path in search')),
1827 ('X', 'exclude', [], _('exclude path from search')),
1828 ('A', 'after', None, _('record a copy after it has happened')),
1829 ('f', 'force', None, _('replace destination if it exists')),
2193 [('I', 'include', [], _('include names matching the given patterns')),
2194 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2195 ('A', 'after', None, _('record a copy that has already occurred')),
2196 ('f', 'force', None, _('forcibly copy over an existing managed file')),
1830 2197 ('p', 'parents', None, _('append source path to dest'))],
1831 2198 _('hg copy [OPTION]... [SOURCE]... DEST')),
1832 2199 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')),
@@ -1840,38 +2207,38 table = {
1840 2207 "debugrename": (debugrename, [], _('debugrename FILE [REV]')),
1841 2208 "debugwalk":
1842 2209 (debugwalk,
1843 [('I', 'include', [], _('include path in search')),
1844 ('X', 'exclude', [], _('exclude path from search'))],
2210 [('I', 'include', [], _('include names matching the given patterns')),
2211 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
1845 2212 _('debugwalk [OPTION]... [FILE]...')),
1846 2213 "^diff":
1847 2214 (diff,
1848 2215 [('r', 'rev', [], _('revision')),
1849 2216 ('a', 'text', None, _('treat all files as text')),
1850 ('I', 'include', [], _('include path in search')),
1851 ('X', 'exclude', [], _('exclude path from search'))],
2217 ('I', 'include', [], _('include names matching the given patterns')),
2218 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
1852 2219 _('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')),
1853 2220 "^export":
1854 2221 (export,
1855 [('o', 'output', "", _('output to file')),
2222 [('o', 'output', "", _('print output to file with formatted name')),
1856 2223 ('a', 'text', None, _('treat all files as text'))],
1857 _("hg export [-a] [-o OUTFILE] REV...")),
2224 "hg export [-a] [-o OUTFILE] REV..."),
1858 2225 "forget":
1859 2226 (forget,
1860 [('I', 'include', [], _('include path in search')),
1861 ('X', 'exclude', [], _('exclude path from search'))],
1862 _("hg forget [OPTION]... FILE...")),
2227 [('I', 'include', [], _('include names matching the given patterns')),
2228 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2229 "hg forget [OPTION]... FILE..."),
1863 2230 "grep":
1864 2231 (grep,
1865 2232 [('0', 'print0', None, _('end fields with NUL')),
1866 ('I', 'include', [], _('include path in search')),
1867 ('X', 'exclude', [], _('include path in search')),
1868 ('', 'all', None, _('print all revisions with matches')),
2233 ('I', 'include', [], _('include names matching the given patterns')),
2234 ('X', 'exclude', [], _('include names matching the given patterns')),
2235 ('', 'all', None, _('print all revisions that match')),
1869 2236 ('i', 'ignore-case', None, _('ignore case when matching')),
1870 ('l', 'files-with-matches', None, _('print names of files and revs with matches')),
1871 ('n', 'line-number', None, _('print line numbers')),
1872 ('r', 'rev', [], _('search in revision rev')),
1873 ('u', 'user', None, _('print user who made change'))],
1874 _("hg grep [OPTION]... PATTERN [FILE]...")),
2237 ('l', 'files-with-matches', None, _('print only filenames and revs that match')),
2238 ('n', 'line-number', None, _('print matching line numbers')),
2239 ('r', 'rev', [], _('search in given revision range')),
2240 ('u', 'user', None, _('print user who committed change'))],
2241 "hg grep [OPTION]... PATTERN [FILE]..."),
1875 2242 "heads":
1876 2243 (heads,
1877 2244 [('b', 'branches', None, _('find branch info'))],
@@ -1880,10 +2247,11 table = {
1880 2247 "identify|id": (identify, [], _('hg identify')),
1881 2248 "import|patch":
1882 2249 (import_,
1883 [('p', 'strip', 1, _('path strip')),
1884 ('f', 'force', None, _('skip check for outstanding changes')),
2250 [('p', 'strip', 1, _('directory strip option for patch. This has the same\n') +
2251 _('meaning as the corresponding patch option')),
2252 ('f', 'force', None, _('skip check for outstanding uncommitted changes')),
1885 2253 ('b', 'base', "", _('base path'))],
1886 _("hg import [-f] [-p NUM] [-b BASE] PATCH...")),
2254 "hg import [-f] [-p NUM] [-b BASE] PATCH..."),
1887 2255 "incoming|in": (incoming,
1888 2256 [('M', 'no-merges', None, _("do not show merges")),
1889 2257 ('p', 'patch', None, _('show patch'))],
@@ -1891,19 +2259,19 table = {
1891 2259 "^init": (init, [], _('hg init [DEST]')),
1892 2260 "locate":
1893 2261 (locate,
1894 [('r', 'rev', '', _('revision')),
1895 ('0', 'print0', None, _('end filenames with NUL')),
1896 ('f', 'fullpath', None, _('print complete paths')),
1897 ('I', 'include', [], _('include path in search')),
1898 ('X', 'exclude', [], _('exclude path from search'))],
2262 [('r', 'rev', '', _('search the repository as it stood at rev')),
2263 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
2264 ('f', 'fullpath', None, _('print complete paths from the filesystem root')),
2265 ('I', 'include', [], _('include names matching the given patterns')),
2266 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
1899 2267 _('hg locate [OPTION]... [PATTERN]...')),
1900 2268 "^log|history":
1901 2269 (log,
1902 [('I', 'include', [], _('include path in search')),
1903 ('X', 'exclude', [], _('exclude path from search')),
2270 [('I', 'include', [], _('include names matching the given patterns')),
2271 ('X', 'exclude', [], _('exclude names matching the given patterns')),
1904 2272 ('b', 'branch', None, _('show branches')),
1905 2273 ('k', 'keyword', [], _('search for a keyword')),
1906 ('r', 'rev', [], _('revision')),
2274 ('r', 'rev', [], _('show the specified revision or range')),
1907 2275 ('M', 'no-merges', None, _("do not show merges")),
1908 2276 ('m', 'only-merges', None, _("show only merges")),
1909 2277 ('p', 'patch', None, _('show patch'))],
@@ -1917,15 +2285,15 table = {
1917 2285 "paths": (paths, [], _('hg paths [NAME]')),
1918 2286 "^pull":
1919 2287 (pull,
1920 [('u', 'update', None, _('update working directory')),
1921 ('e', 'ssh', "", _('ssh command')),
1922 ('', 'remotecmd', "", _('remote hg command'))],
2288 [('u', 'update', None, _('update the working directory to tip after pull')),
2289 ('e', 'ssh', "", _('specify ssh command to use')),
2290 ('', 'remotecmd', "", _('specify hg command to run on the remote side'))],
1923 2291 _('hg pull [-u] [-e FILE] [--remotecmd FILE] [SOURCE]')),
1924 2292 "^push":
1925 2293 (push,
1926 2294 [('f', 'force', None, _('force push')),
1927 ('e', 'ssh', "", _('ssh command')),
1928 ('', 'remotecmd', "", _('remote hg command'))],
2295 ('e', 'ssh', "", _('specify ssh command to use')),
2296 ('', 'remotecmd', "", _('specify hg command to run on the remote side'))],
1929 2297 _('hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]')),
1930 2298 "rawcommit":
1931 2299 (rawcommit,
@@ -1939,32 +2307,32 table = {
1939 2307 _('hg rawcommit [OPTION]... [FILE]...')),
1940 2308 "recover": (recover, [], _("hg recover")),
1941 2309 "^remove|rm": (remove,
1942 [('I', 'include', [], _('include path in search')),
1943 ('X', 'exclude', [], _('exclude path from search'))],
2310 [('I', 'include', [], _('include names matching the given patterns')),
2311 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
1944 2312 _("hg remove [OPTION]... FILE...")),
1945 2313 "rename|mv": (rename,
1946 [('I', 'include', [], _('include path in search')),
1947 ('X', 'exclude', [], _('exclude path from search')),
1948 ('A', 'after', None, _('record a copy after it has happened')),
1949 ('f', 'force', None, _('replace destination if it exists')),
2314 [('I', 'include', [], _('include names matching the given patterns')),
2315 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2316 ('A', 'after', None, _('record a rename that has already occurred')),
2317 ('f', 'force', None, _('forcibly copy over an existing managed file')),
1950 2318 ('p', 'parents', None, _('append source path to dest'))],
1951 2319 _('hg rename [OPTION]... [SOURCE]... DEST')),
1952 2320 "^revert":
1953 2321 (revert,
1954 [("n", "nonrecursive", None, _("don't recurse into subdirs")),
1955 ("r", "rev", "", _("revision"))],
2322 [("n", "nonrecursive", None, _("do not recurse into subdirectories")),
2323 ("r", "rev", "", _("revision to revert to"))],
1956 2324 _("hg revert [-n] [-r REV] [NAME]...")),
1957 2325 "root": (root, [], _("hg root")),
1958 2326 "^serve":
1959 2327 (serve,
1960 [('A', 'accesslog', '', _('access log file')),
1961 ('E', 'errorlog', '', _('error log file')),
1962 ('p', 'port', 0, _('listen port')),
1963 ('a', 'address', '', _('interface address')),
1964 ('n', 'name', "", _('repository name')),
2328 [('A', 'accesslog', '', _('name of access log file to write to')),
2329 ('E', 'errorlog', '', _('name of error log file to write to')),
2330 ('p', 'port', 0, _('port to use (default: 8000)')),
2331 ('a', 'address', '', _('address to use')),
2332 ('n', 'name', "", _('name to show in web pages (default: working dir)')),
1965 2333 ('', 'stdio', None, _('for remote clients')),
1966 ('t', 'templates', "", _('template directory')),
1967 ('', 'style', "", _('template style')),
2334 ('t', 'templates', "", _('web templates to use')),
2335 ('', 'style', "", _('template style to use')),
1968 2336 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4'))],
1969 2337 _("hg serve [OPTION]...")),
1970 2338 "^status":
@@ -1974,17 +2342,17 table = {
1974 2342 ('r', 'removed', None, _('show only removed files')),
1975 2343 ('u', 'unknown', None, _('show only unknown (not tracked) files')),
1976 2344 ('n', 'no-status', None, _('hide status prefix')),
1977 ('0', 'print0', None, _('end filenames with NUL')),
1978 ('I', 'include', [], _('include path in search')),
1979 ('X', 'exclude', [], _('exclude path from search'))],
2345 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
2346 ('I', 'include', [], _('include names matching the given patterns')),
2347 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
1980 2348 _("hg status [OPTION]... [FILE]...")),
1981 2349 "tag":
1982 2350 (tag,
1983 2351 [('l', 'local', None, _('make the tag local')),
1984 ('m', 'message', "", _('commit message')),
2352 ('m', 'message', "", _('message for tag commit log entry')),
1985 2353 ('t', 'text', "", _('commit message (deprecated: use -m)')),
1986 ('d', 'date', "", _('date code')),
1987 ('u', 'user', "", _('user'))],
2354 ('d', 'date', "", _('record datecode as commit date')),
2355 ('u', 'user', "", _('record user as commiter'))],
1988 2356 _('hg tag [OPTION]... NAME [REV]')),
1989 2357 "tags": (tags, [], _('hg tags')),
1990 2358 "tip": (tip, [], _('hg tip')),
@@ -1996,7 +2364,7 table = {
1996 2364 "^update|up|checkout|co":
1997 2365 (update,
1998 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 2368 ('C', 'clean', None, _('overwrite locally modified files'))],
2001 2369 _('hg update [-b TAG] [-m] [-C] [REV]')),
2002 2370 "verify": (verify, [], _('hg verify')),
@@ -2004,18 +2372,18 table = {
2004 2372 }
2005 2373
2006 2374 globalopts = [
2007 ('R', 'repository', "", _('repository root directory')),
2008 ('', 'cwd', '', _('change working directory')),
2009 ('y', 'noninteractive', None, _('run non-interactively')),
2010 ('q', 'quiet', None, _('quiet mode')),
2011 ('v', 'verbose', None, _('verbose mode')),
2012 ('', 'debug', None, _('debug mode')),
2013 ('', 'debugger', None, _('start debugger')),
2014 ('', 'traceback', None, _('print traceback on exception')),
2015 ('', 'time', None, _('time how long the command takes')),
2016 ('', 'profile', None, _('profile')),
2017 ('', 'version', None, _('output version information and exit')),
2018 ('h', 'help', None, _('display help and exit')),
2375 ('R', 'repository', "", _("repository root directory")),
2376 ('', 'cwd', '', _("change working directory")),
2377 ('y', 'noninteractive', None, _("do not prompt, assume 'yes' for any required answers")),
2378 ('q', 'quiet', None, _("suppress output")),
2379 ('v', 'verbose', None, _("enable additional output")),
2380 ('', 'debug', None, _("enable debugging output")),
2381 ('', 'debugger', None, _("start debugger")),
2382 ('', 'traceback', None, _("print traceback on exception")),
2383 ('', 'time', None, _("time how long the command takes")),
2384 ('', 'profile', None, _("print command execution profile")),
2385 ('', 'version', None, _("output version information and exit")),
2386 ('h', 'help', None, _("display help and exit")),
2019 2387 ]
2020 2388
2021 2389 norepo = ("clone init version help debugancestor debugconfig debugdata"
@@ -124,33 +124,66 hg add [OPTION]... [FILE]...
124 124
125 125 add the specified files on the next commit
126 126
127 Schedule files to be version controlled and added to the repository.
128
129 The files will be added to the repository at the next commit.
130
131 If no names are given, add all files in the current directory and
132 its subdirectories.
133
127 134 options:
128 135
129 -I --include include path in search
130 -X --exclude exclude path from search
136 -I --include include names matching the given patterns
137 -X --exclude exclude names matching the given patterns
131 138 hg add: option --skjdfks not recognized
132 139 hg add [OPTION]... [FILE]...
133 140
134 141 add the specified files on the next commit
135 142
143 Schedule files to be version controlled and added to the repository.
144
145 The files will be added to the repository at the next commit.
146
147 If no names are given, add all files in the current directory and
148 its subdirectories.
149
136 150 options:
137 151
138 -I --include include path in search
139 -X --exclude exclude path from search
152 -I --include include names matching the given patterns
153 -X --exclude exclude names matching the given patterns
140 154 hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...
141 155
142 156 diff working directory (or selected files)
143 157
158 Show differences between revisions for the specified files.
159
160 Differences between files are shown using the unified diff format.
161
162 When two revision arguments are given, then changes are shown
163 between those revisions. If only one revision is specified then
164 that revision is compared to the working directory, and, when no
165 revisions are specified, the working directory files are compared
166 to its parent.
167
168 Without the -a option, diff will avoid generating diffs of files
169 it detects as binary. With -a, diff will generate a diff anyway,
170 probably with undesirable results.
171
144 172 options:
145 173
146 174 -r --rev revision
147 175 -a --text treat all files as text
148 -I --include include path in search
149 -X --exclude exclude path from search
176 -I --include include names matching the given patterns
177 -X --exclude exclude names matching the given patterns
150 178 hg status [OPTION]... [FILE]...
151 179
152 180 show changed files in the working directory
153 181
182 Show changed files in the working directory. If no names are
183 given, all files are shown. Otherwise, only files matching the
184 given names are shown.
185
186 The codes used to show the status of files are:
154 187 M = modified
155 188 A = added
156 189 R = removed
@@ -163,9 +196,9 options:
163 196 -r --removed show only removed files
164 197 -u --unknown show only unknown (not tracked) files
165 198 -n --no-status hide status prefix
166 -0 --print0 end filenames with NUL
167 -I --include include path in search
168 -X --exclude exclude path from search
199 -0 --print0 end filenames with NUL, for use with xargs
200 -I --include include names matching the given patterns
201 -X --exclude exclude names matching the given patterns
169 202 hg status [OPTION]... [FILE]...
170 203
171 204 show changed files in the working directory
General Comments 0
You need to be logged in to leave comments. Login now