mercurial/commands.py
changeset 8779 708938509732
parent 8778 c5f36402daad
child 8796 2bcef677a6c3
child 8802 ca14b3982ffe
equal deleted inserted replaced
8778:c5f36402daad 8779:708938509732
    70     if sim < 0 or sim > 100:
    70     if sim < 0 or sim > 100:
    71         raise util.Abort(_('similarity must be between 0 and 100'))
    71         raise util.Abort(_('similarity must be between 0 and 100'))
    72     return cmdutil.addremove(repo, pats, opts, similarity=sim/100.)
    72     return cmdutil.addremove(repo, pats, opts, similarity=sim/100.)
    73 
    73 
    74 def annotate(ui, repo, *pats, **opts):
    74 def annotate(ui, repo, *pats, **opts):
    75     """show changeset information per file line
    75     """show changeset information by line for each file
    76 
    76 
    77     List changes in files, showing the revision id responsible for
    77     List changes in files, showing the revision id responsible for
    78     each line
    78     each line
    79 
    79 
    80     This command is useful to discover who did a change or when a
    80     This command is useful for discovering when a change was made and
    81     change took place.
    81     by whom.
    82 
    82 
    83     Without the -a/--text option, annotate will avoid processing files
    83     Without the -a/--text option, annotate will avoid processing files
    84     it detects as binary. With -a, annotate will generate an
    84     it detects as binary. With -a, annotate will annotate the file
    85     annotation anyway, probably with undesirable results.
    85     anyway, although the results will probably be neither useful
       
    86     nor desirable.
    86     """
    87     """
    87     datefunc = ui.quiet and util.shortdate or util.datestr
    88     datefunc = ui.quiet and util.shortdate or util.datestr
    88     getdate = util.cachefunc(lambda x: datefunc(x[0].date()))
    89     getdate = util.cachefunc(lambda x: datefunc(x[0].date()))
    89 
    90 
    90     if not pats:
    91     if not pats:
   132         if pieces:
   133         if pieces:
   133             for p, l in zip(zip(*pieces), lines):
   134             for p, l in zip(zip(*pieces), lines):
   134                 ui.write("%s: %s" % (" ".join(p), l[1]))
   135                 ui.write("%s: %s" % (" ".join(p), l[1]))
   135 
   136 
   136 def archive(ui, repo, dest, **opts):
   137 def archive(ui, repo, dest, **opts):
   137     '''create unversioned archive of a repository revision
   138     '''create an unversioned archive of a repository revision
   138 
   139 
   139     By default, the revision used is the parent of the working
   140     By default, the revision used is the parent of the working
   140     directory; use -r/--rev to specify a different revision.
   141     directory; use -r/--rev to specify a different revision.
   141 
   142 
   142     To specify the type of archive to create, use -t/--type. Valid
   143     To specify the type of archive to create, use -t/--type. Valid
   181     '''reverse effect of earlier changeset
   182     '''reverse effect of earlier changeset
   182 
   183 
   183     Commit the backed out changes as a new changeset. The new
   184     Commit the backed out changes as a new changeset. The new
   184     changeset is a child of the backed out changeset.
   185     changeset is a child of the backed out changeset.
   185 
   186 
   186     If you back out a changeset other than the tip, a new head is
   187     If you backout a changeset other than the tip, a new head is
   187     created. This head will be the new tip and you should merge this
   188     created. This head will be the new tip and you should merge this
   188     backout changeset with another head (current one by default).
   189     backout changeset with another head.
   189 
   190 
   190     The --merge option remembers the parent of the working directory
   191     The --merge option remembers the parent of the working directory
   191     before starting the backout, then merges the new head with that
   192     before starting the backout, then merges the new head with that
   192     changeset afterwards. This saves you from doing the merge by hand.
   193     changeset afterwards. This saves you from doing the merge by hand.
   193     The result of this merge is not committed, as with a normal merge.
   194     The result of this merge is not committed, as with a normal merge.
   211     node = repo.lookup(rev)
   212     node = repo.lookup(rev)
   212 
   213 
   213     op1, op2 = repo.dirstate.parents()
   214     op1, op2 = repo.dirstate.parents()
   214     a = repo.changelog.ancestor(op1, node)
   215     a = repo.changelog.ancestor(op1, node)
   215     if a != node:
   216     if a != node:
   216         raise util.Abort(_('cannot back out change on a different branch'))
   217         raise util.Abort(_('cannot backout change on a different branch'))
   217 
   218 
   218     p1, p2 = repo.changelog.parents(node)
   219     p1, p2 = repo.changelog.parents(node)
   219     if p1 == nullid:
   220     if p1 == nullid:
   220         raise util.Abort(_('cannot back out a change with no parents'))
   221         raise util.Abort(_('cannot backout a change with no parents'))
   221     if p2 != nullid:
   222     if p2 != nullid:
   222         if not opts.get('parent'):
   223         if not opts.get('parent'):
   223             raise util.Abort(_('cannot back out a merge changeset without '
   224             raise util.Abort(_('cannot backout a merge changeset without '
   224                                '--parent'))
   225                                '--parent'))
   225         p = repo.lookup(opts['parent'])
   226         p = repo.lookup(opts['parent'])
   226         if p not in (p1, p2):
   227         if p not in (p1, p2):
   227             raise util.Abort(_('%s is not a parent of %s') %
   228             raise util.Abort(_('%s is not a parent of %s') %
   228                              (short(p), short(node)))
   229                              (short(p), short(node)))
   270     This command helps to find changesets which introduce problems. To
   271     This command helps to find changesets which introduce problems. To
   271     use, mark the earliest changeset you know exhibits the problem as
   272     use, mark the earliest changeset you know exhibits the problem as
   272     bad, then mark the latest changeset which is free from the problem
   273     bad, then mark the latest changeset which is free from the problem
   273     as good. Bisect will update your working directory to a revision
   274     as good. Bisect will update your working directory to a revision
   274     for testing (unless the -U/--noupdate option is specified). Once
   275     for testing (unless the -U/--noupdate option is specified). Once
   275     you have performed tests, mark the working directory as bad or
   276     you have performed tests, mark the working directory as good or
   276     good and bisect will either update to another candidate changeset
   277     bad, and bisect will either update to another candidate changeset
   277     or announce that it has found the bad revision.
   278     or announce that it has found the bad revision.
   278 
   279 
   279     As a shortcut, you can also use the revision argument to mark a
   280     As a shortcut, you can also use the revision argument to mark a
   280     revision as good or bad without checking it out first.
   281     revision as good or bad without checking it out first.
   281 
   282 
   282     If you supply a command it will be used for automatic bisection.
   283     If you supply a command, it will be used for automatic bisection.
   283     Its exit status will be used as flag to mark revision as bad or
   284     Its exit status will be used to mark revisions as good or bad:
   284     good. In case exit status is 0 the revision is marked as good, 125
   285     status 0 means good, 125 means to skip the revision, 127
   285     - skipped, 127 (command not found) - bisection will be aborted;
   286     (command not found) will abort the bisection, and any other
   286     any other status bigger than 0 will mark revision as bad.
   287     non-zero exit status means the revision is bad.
   287     """
   288     """
   288     def print_result(nodes, good):
   289     def print_result(nodes, good):
   289         displayer = cmdutil.show_changeset(ui, repo, {})
   290         displayer = cmdutil.show_changeset(ui, repo, {})
   290         if len(nodes) == 1:
   291         if len(nodes) == 1:
   291             # narrowed it down to a single revision
   292             # narrowed it down to a single revision
   402 
   403 
   403 def branch(ui, repo, label=None, **opts):
   404 def branch(ui, repo, label=None, **opts):
   404     """set or show the current branch name
   405     """set or show the current branch name
   405 
   406 
   406     With no argument, show the current branch name. With one argument,
   407     With no argument, show the current branch name. With one argument,
   407     set the working directory branch name (the branch does not exist
   408     set the working directory branch name (the branch will not exist
   408     in the repository until the next commit). It is recommended to use
   409     in the repository until the next commit). Standard practice
   409     the 'default' branch as your primary development branch.
   410     recommends that primary development take place on the 'default'
       
   411     branch.
   410 
   412 
   411     Unless -f/--force is specified, branch will not let you set a
   413     Unless -f/--force is specified, branch will not let you set a
   412     branch name that shadows an existing branch.
   414     branch name that already exists, even if it's inactive.
   413 
   415 
   414     Use -C/--clean to reset the working directory branch to that of
   416     Use -C/--clean to reset the working directory branch to that of
   415     the parent of the working directory, negating a previous branch
   417     the parent of the working directory, negating a previous branch
   416     change.
   418     change.
   417 
   419 
   588 
   590 
   589     See 'hg help urls' for valid source format details.
   591     See 'hg help urls' for valid source format details.
   590 
   592 
   591     It is possible to specify an ssh:// URL as the destination, but no
   593     It is possible to specify an ssh:// URL as the destination, but no
   592     .hg/hgrc and working directory will be created on the remote side.
   594     .hg/hgrc and working directory will be created on the remote side.
   593     Look at the help text for URLs for important details about ssh://
   595     Please see 'hg help urls' for important details about ssh:// URLs.
   594     URLs.
       
   595 
   596 
   596     For efficiency, hardlinks are used for cloning whenever the source
   597     For efficiency, hardlinks are used for cloning whenever the source
   597     and destination are on the same filesystem (note this applies only
   598     and destination are on the same filesystem (note this applies only
   598     to the repository data, not to the checked out files). Some
   599     to the repository data, not to the checked out files). Some
   599     filesystems, such as AFS, implement hardlinking incorrectly, but
   600     filesystems, such as AFS, implement hardlinking incorrectly, but
   622 def commit(ui, repo, *pats, **opts):
   623 def commit(ui, repo, *pats, **opts):
   623     """commit the specified files or all outstanding changes
   624     """commit the specified files or all outstanding changes
   624 
   625 
   625     Commit changes to the given files into the repository. Unlike a
   626     Commit changes to the given files into the repository. Unlike a
   626     centralized RCS, this operation is a local operation. See hg push
   627     centralized RCS, this operation is a local operation. See hg push
   627     for means to actively distribute your changes.
   628     for a way to actively distribute your changes.
   628 
   629 
   629     If a list of files is omitted, all changes reported by "hg status"
   630     If a list of files is omitted, all changes reported by "hg status"
   630     will be committed.
   631     will be committed.
   631 
   632 
   632     If you are committing the result of a merge, do not provide any
   633     If you are committing the result of a merge, do not provide any
   673     Mark dest as having copies of source files. If dest is a
   674     Mark dest as having copies of source files. If dest is a
   674     directory, copies are put in that directory. If dest is a file,
   675     directory, copies are put in that directory. If dest is a file,
   675     the source must be a single file.
   676     the source must be a single file.
   676 
   677 
   677     By default, this command copies the contents of files as they
   678     By default, this command copies the contents of files as they
   678     stand in the working directory. If invoked with -A/--after, the
   679     exist in the working directory. If invoked with -A/--after, the
   679     operation is recorded, but no copying is performed.
   680     operation is recorded, but no copying is performed.
   680 
   681 
   681     This command takes effect with the next commit. To undo a copy
   682     This command takes effect with the next commit. To undo a copy
   682     before that, see hg revert.
   683     before that, see hg revert.
   683     """
   684     """
   786     of that config item.
   787     of that config item.
   787 
   788 
   788     With multiple arguments, print names and values of all config
   789     With multiple arguments, print names and values of all config
   789     items with matching section names.
   790     items with matching section names.
   790 
   791 
   791     With the --debug flag, the source (filename and line number) is
   792     With --debug, the source (filename and line number) is printed
   792     printed for each config item.
   793     for each config item.
   793     """
   794     """
   794 
   795 
   795     untrusted = bool(opts.get('untrusted'))
   796     untrusted = bool(opts.get('untrusted'))
   796     if values:
   797     if values:
   797         if len([v for v in values if '.' in v]) > 1:
   798         if len([v for v in values if '.' in v]) > 1:
   884         ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
   885         ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
   885                 i, r.start(i), r.length(i), r.base(i), r.linkrev(i),
   886                 i, r.start(i), r.length(i), r.base(i), r.linkrev(i),
   886             short(node), short(pp[0]), short(pp[1])))
   887             short(node), short(pp[0]), short(pp[1])))
   887 
   888 
   888 def debugindexdot(ui, file_):
   889 def debugindexdot(ui, file_):
   889     """dump an index DAG as a .dot file"""
   890     """dump an index DAG as a graphviz dot file"""
   890     r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
   891     r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
   891     ui.write("digraph G {\n")
   892     ui.write("digraph G {\n")
   892     for i in r:
   893     for i in r:
   893         node = r.node(i)
   894         node = r.node(i)
   894         pp = r.parents(node)
   895         pp = r.parents(node)
  1105     Without the -a/--text option, export will avoid generating diffs
  1106     Without the -a/--text option, export will avoid generating diffs
  1106     of files it detects as binary. With -a, export will generate a
  1107     of files it detects as binary. With -a, export will generate a
  1107     diff anyway, probably with undesirable results.
  1108     diff anyway, probably with undesirable results.
  1108 
  1109 
  1109     Use the -g/--git option to generate diffs in the git extended diff
  1110     Use the -g/--git option to generate diffs in the git extended diff
  1110     format. Read the diffs help topic for more information.
  1111     format. See 'hg help diffs' for more information.
  1111 
  1112 
  1112     With the --switch-parent option, the diff will be against the
  1113     With the --switch-parent option, the diff will be against the
  1113     second parent. It can be useful to review a merge.
  1114     second parent. It can be useful to review a merge.
  1114     """
  1115     """
  1115     if not changesets:
  1116     if not changesets:
  1299 def heads(ui, repo, *branchrevs, **opts):
  1300 def heads(ui, repo, *branchrevs, **opts):
  1300     """show current repository heads or show branch heads
  1301     """show current repository heads or show branch heads
  1301 
  1302 
  1302     With no arguments, show all repository head changesets.
  1303     With no arguments, show all repository head changesets.
  1303 
  1304 
  1304     If branch or revisions names are given this will show the heads of
  1305     If branch names or revisions are given this will show the heads of
  1305     the specified branches or the branches those revisions are tagged
  1306     the specified branches or the branches those revisions are tagged
  1306     with.
  1307     with.
  1307 
  1308 
  1308     Repository "heads" are changesets that don't have child
  1309     Repository "heads" are changesets that don't have child
  1309     changesets. They are where development generally takes place and
  1310     changesets. They are where development generally takes place and
  1310     are the usual targets for update and merge operations.
  1311     are the usual targets for update and merge operations.
  1311 
  1312 
  1312     Branch heads are changesets that have a given branch tag, but have
  1313     Branch heads are changesets that have a given branch tag, but have
  1313     no child changesets with that tag. They are usually where
  1314     no child changesets with that tag. They are usually where
  1314     development on the given branch takes place.
  1315     development on a given branch takes place.
  1315     """
  1316     """
  1316     if opts.get('rev'):
  1317     if opts.get('rev'):
  1317         start = repo.lookup(opts['rev'])
  1318         start = repo.lookup(opts['rev'])
  1318     else:
  1319     else:
  1319         start = None
  1320         start = None
  1351         displayer.show(repo[n])
  1352         displayer.show(repo[n])
  1352 
  1353 
  1353 def help_(ui, name=None, with_version=False):
  1354 def help_(ui, name=None, with_version=False):
  1354     """show help for a given topic or a help overview
  1355     """show help for a given topic or a help overview
  1355 
  1356 
  1356     With no arguments, print a list of commands and short help.
  1357     With no arguments, print a list of commands with short help messages.
  1357 
  1358 
  1358     Given a topic, extension, or command name, print help for that
  1359     Given a topic, extension, or command name, print help for that
  1359     topic."""
  1360     topic."""
  1360     option_lists = []
  1361     option_lists = []
  1361 
  1362 
  1574     """identify the working copy or specified revision
  1575     """identify the working copy or specified revision
  1575 
  1576 
  1576     With no revision, print a summary of the current state of the
  1577     With no revision, print a summary of the current state of the
  1577     repository.
  1578     repository.
  1578 
  1579 
  1579     With a path, do a lookup in another repository.
  1580     Specifying a path to a repository root or Mercurial bundle will
       
  1581     cause lookup to operate on that repository/bundle.
  1580 
  1582 
  1581     This summary identifies the repository state using one or two
  1583     This summary identifies the repository state using one or two
  1582     parent hash identifiers, followed by a "+" if there are
  1584     parent hash identifiers, followed by a "+" if there are
  1583     uncommitted changes in the working directory, a list of tags for
  1585     uncommitted changes in the working directory, a list of tags for
  1584     this revision and a branch name for non-default branches.
  1586     this revision and a branch name for non-default branches.
  1650 
  1652 
  1651     If there are outstanding changes in the working directory, import
  1653     If there are outstanding changes in the working directory, import
  1652     will abort unless given the -f/--force flag.
  1654     will abort unless given the -f/--force flag.
  1653 
  1655 
  1654     You can import a patch straight from a mail message. Even patches
  1656     You can import a patch straight from a mail message. Even patches
  1655     as attachments work (body part must be type text/plain or
  1657     as attachments work (to use the body part, it must have type
  1656     text/x-patch to be used). From and Subject headers of email
  1658     text/plain or text/x-patch). From and Subject headers of email
  1657     message are used as default committer and commit message. All
  1659     message are used as default committer and commit message. All
  1658     text/plain body parts before first diff are added to commit
  1660     text/plain body parts before first diff are added to commit
  1659     message.
  1661     message.
  1660 
  1662 
  1661     If the imported patch was generated by hg export, user and
  1663     If the imported patch was generated by hg export, user and
  1670     deficiencies in the text patch format.
  1672     deficiencies in the text patch format.
  1671 
  1673 
  1672     With -s/--similarity, hg will attempt to discover renames and
  1674     With -s/--similarity, hg will attempt to discover renames and
  1673     copies in the patch in the same way as 'addremove'.
  1675     copies in the patch in the same way as 'addremove'.
  1674 
  1676 
  1675     To read a patch from standard input, use patch name "-". See 'hg
  1677     To read a patch from standard input, use "-" as the patch name.
  1676     help dates' for a list of formats valid for -d/--date.
  1678     See 'hg help dates' for a list of formats valid for -d/--date.
  1677     """
  1679     """
  1678     patches = (patch1,) + patches
  1680     patches = (patch1,) + patches
  1679 
  1681 
  1680     date = opts.get('date')
  1682     date = opts.get('date')
  1681     if date:
  1683     if date:
  1772 
  1774 
  1773 def incoming(ui, repo, source="default", **opts):
  1775 def incoming(ui, repo, source="default", **opts):
  1774     """show new changesets found in source
  1776     """show new changesets found in source
  1775 
  1777 
  1776     Show new changesets found in the specified path/URL or the default
  1778     Show new changesets found in the specified path/URL or the default
  1777     pull location. These are the changesets that would be pulled if a
  1779     pull location. These are the changesets that would have been pulled
  1778     pull was requested.
  1780     if a pull at the time you issued this command.
  1779 
  1781 
  1780     For remote repository, using --bundle avoids downloading the
  1782     For remote repository, using --bundle avoids downloading the
  1781     changesets twice if the incoming is followed by a pull.
  1783     changesets twice if the incoming is followed by a pull.
  1782 
  1784 
  1783     See pull for valid source format details.
  1785     See pull for valid source format details.
  1841 
  1843 
  1842 def init(ui, dest=".", **opts):
  1844 def init(ui, dest=".", **opts):
  1843     """create a new repository in the given directory
  1845     """create a new repository in the given directory
  1844 
  1846 
  1845     Initialize a new repository in the given directory. If the given
  1847     Initialize a new repository in the given directory. If the given
  1846     directory does not exist, it is created.
  1848     directory does not exist, it will be created.
  1847 
  1849 
  1848     If no directory is given, the current directory is used.
  1850     If no directory is given, the current directory is used.
  1849 
  1851 
  1850     It is possible to specify an ssh:// URL as the destination.
  1852     It is possible to specify an ssh:// URL as the destination.
  1851     See 'hg help urls' for more information.
  1853     See 'hg help urls' for more information.
  1853     hg.repository(cmdutil.remoteui(ui, opts), dest, create=1)
  1855     hg.repository(cmdutil.remoteui(ui, opts), dest, create=1)
  1854 
  1856 
  1855 def locate(ui, repo, *pats, **opts):
  1857 def locate(ui, repo, *pats, **opts):
  1856     """locate files matching specific patterns
  1858     """locate files matching specific patterns
  1857 
  1859 
  1858     Print all files under Mercurial control whose names match the
  1860     Print files under Mercurial control in the working directory whose
  1859     given patterns.
  1861     names match the given patterns.
  1860 
  1862 
  1861     This command searches the entire repository by default. To search
  1863     By default, this command searches all directories in the working
  1862     just the current directory and its subdirectories, use
  1864     directory. To search just the current directory and its
  1863     "--include .".
  1865     subdirectories, use "--include .".
  1864 
  1866 
  1865     If no patterns are given to match, this command prints all file
  1867     If no patterns are given to match, this command prints the names
  1866     names.
  1868     of all files under Mercurial control in the working directory.
  1867 
  1869 
  1868     If you want to feed the output of this command into the "xargs"
  1870     If you want to feed the output of this command into the "xargs"
  1869     command, use the -0 option to both this command and "xargs". This
  1871     command, use the -0 option to both this command and "xargs". This
  1870     will avoid the problem of "xargs" treating single filenames that
  1872     will avoid the problem of "xargs" treating single filenames that
  1871     contain white space as multiple filenames.
  1873     contain whitespace as multiple filenames.
  1872     """
  1874     """
  1873     end = opts.get('print0') and '\0' or '\n'
  1875     end = opts.get('print0') and '\0' or '\n'
  1874     rev = opts.get('rev') or None
  1876     rev = opts.get('rev') or None
  1875 
  1877 
  1876     ret = 1
  1878     ret = 1
  1903     --follow is set, in which case the working directory parent is
  1905     --follow is set, in which case the working directory parent is
  1904     used as the starting revision.
  1906     used as the starting revision.
  1905 
  1907 
  1906     See 'hg help dates' for a list of formats valid for -d/--date.
  1908     See 'hg help dates' for a list of formats valid for -d/--date.
  1907 
  1909 
  1908     By default this command outputs: changeset id and hash, tags,
  1910     By default this command prints revision number and changeset id,
  1909     non-trivial parents, user, date and time, and a summary for each
  1911     tags, non-trivial parents, user, date and time, and a summary for
  1910     commit. When the -v/--verbose switch is used, the list of changed
  1912     each commit. When the -v/--verbose switch is used, the list of
  1911     files and full commit message is shown.
  1913     changed files and full commit message are shown.
  1912 
  1914 
  1913     NOTE: log -p/--patch may generate unexpected diff output for merge
  1915     NOTE: log -p/--patch may generate unexpected diff output for merge
  1914     changesets, as it will only compare the merge changeset against
  1916     changesets, as it will only compare the merge changeset against
  1915     its first parent. Also, the files: list will only reflect files
  1917     its first parent. Also, only files different from BOTH parents
  1916     that are different from BOTH parents.
  1918     will appear in files:.
  1917 
       
  1918     """
  1919     """
  1919 
  1920 
  1920     get = util.cachefunc(lambda r: repo[r].changeset())
  1921     get = util.cachefunc(lambda r: repo[r].changeset())
  1921     changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
  1922     changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
  1922 
  1923 
  2017 def manifest(ui, repo, node=None, rev=None):
  2018 def manifest(ui, repo, node=None, rev=None):
  2018     """output the current or given revision of the project manifest
  2019     """output the current or given revision of the project manifest
  2019 
  2020 
  2020     Print a list of version controlled files for the given revision.
  2021     Print a list of version controlled files for the given revision.
  2021     If no revision is given, the first parent of the working directory
  2022     If no revision is given, the first parent of the working directory
  2022     is used, or the null revision if none is checked out.
  2023     is used, or the null revision if no revision is checked out.
  2023 
  2024 
  2024     With -v flag, print file permissions, symlink and executable bits.
  2025     With -v, print file permissions, symlink and executable bits.
  2025     With --debug flag, print file revision hashes.
  2026     With --debug, print file revision hashes.
  2026     """
  2027     """
  2027 
  2028 
  2028     if rev and node:
  2029     if rev and node:
  2029         raise util.Abort(_("please specify just one revision"))
  2030         raise util.Abort(_("please specify just one revision"))
  2030 
  2031 
  2041         ui.write("%s\n" % f)
  2042         ui.write("%s\n" % f)
  2042 
  2043 
  2043 def merge(ui, repo, node=None, **opts):
  2044 def merge(ui, repo, node=None, **opts):
  2044     """merge working directory with another revision
  2045     """merge working directory with another revision
  2045 
  2046 
  2046     The contents of the current working directory is updated with all
  2047     The current working directory is updated with all changes made in
  2047     changes made in the requested revision since the last common
  2048     the requested revision since the last common predecessor revision.
  2048     predecessor revision.
       
  2049 
  2049 
  2050     Files that changed between either parent are marked as changed for
  2050     Files that changed between either parent are marked as changed for
  2051     the next commit and a commit must be performed before any further
  2051     the next commit and a commit must be performed before any further
  2052     updates are allowed. The next commit has two parents.
  2052     updates to the repository are allowed. The next commit will have
       
  2053     two parents.
  2053 
  2054 
  2054     If no revision is specified, the working directory's parent is a
  2055     If no revision is specified, the working directory's parent is a
  2055     head revision, and the current branch contains exactly one other
  2056     head revision, and the current branch contains exactly one other
  2056     head, the other head is merged with by default. Otherwise, an
  2057     head, the other head is merged with by default. Otherwise, an
  2057     explicit revision to merge with must be provided.
  2058     explicit revision with which to merge with must be provided.
  2058     """
  2059     """
  2059 
  2060 
  2060     if opts.get('rev') and node:
  2061     if opts.get('rev') and node:
  2061         raise util.Abort(_("please specify just one revision"))
  2062         raise util.Abort(_("please specify just one revision"))
  2062     if not node:
  2063     if not node:
  2136 def parents(ui, repo, file_=None, **opts):
  2137 def parents(ui, repo, file_=None, **opts):
  2137     """show the parents of the working directory or revision
  2138     """show the parents of the working directory or revision
  2138 
  2139 
  2139     Print the working directory's parent revisions. If a revision is
  2140     Print the working directory's parent revisions. If a revision is
  2140     given via -r/--rev, the parent of that revision will be printed.
  2141     given via -r/--rev, the parent of that revision will be printed.
  2141     If a file argument is given, revision in which the file was last
  2142     If a file argument is given, the revision in which the file was
  2142     changed (before the working directory revision or the argument to
  2143     last changed (before the working directory revision or the
  2143     --rev if given) is printed.
  2144     argument to --rev if given) is printed.
  2144     """
  2145     """
  2145     rev = opts.get('rev')
  2146     rev = opts.get('rev')
  2146     if rev:
  2147     if rev:
  2147         ctx = repo[rev]
  2148         ctx = repo[rev]
  2148     else:
  2149     else:
  2175 
  2176 
  2176 def paths(ui, repo, search=None):
  2177 def paths(ui, repo, search=None):
  2177     """show aliases for remote repositories
  2178     """show aliases for remote repositories
  2178 
  2179 
  2179     Show definition of symbolic path name NAME. If no name is given,
  2180     Show definition of symbolic path name NAME. If no name is given,
  2180     show definition of available names.
  2181     show definition of all available names.
  2181 
  2182 
  2182     Path names are defined in the [paths] section of /etc/mercurial/hgrc
  2183     Path names are defined in the [paths] section of /etc/mercurial/hgrc
  2183     and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too.
  2184     and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too.
  2184 
  2185 
  2185     See 'hg help urls' for more information.
  2186     See 'hg help urls' for more information.
  2209         ui.status(_("(run 'hg update' to get a working copy)\n"))
  2210         ui.status(_("(run 'hg update' to get a working copy)\n"))
  2210 
  2211 
  2211 def pull(ui, repo, source="default", **opts):
  2212 def pull(ui, repo, source="default", **opts):
  2212     """pull changes from the specified source
  2213     """pull changes from the specified source
  2213 
  2214 
  2214     Pull changes from a remote repository to the local one.
  2215     Pull changes from a remote repository to a local one.
  2215 
  2216 
  2216     This finds all changes from the repository at the specified path
  2217     This finds all changes from the repository at the specified path
  2217     or URL and adds them to the local repository. By default, this
  2218     or URL and adds them to a local repository (the current one unless
  2218     does not update the copy of the project in the working directory.
  2219     -R is specified). By default, this does not update the copy of the
  2219 
  2220     project in the working directory.
  2220     Use hg incoming if you want to see what will be added by the next
  2221 
  2221     pull without actually adding the changes to the repository.
  2222     Use hg incoming if you want to see what would have been added by a
       
  2223     pull at the time you issued this command. If you then decide to
       
  2224     added those changes to the repository, you should use pull -r X
       
  2225     where X is the last changeset listed by hg incoming.
  2222 
  2226 
  2223     If SOURCE is omitted, the 'default' path will be used.
  2227     If SOURCE is omitted, the 'default' path will be used.
  2224     See 'hg help urls' for more information.
  2228     See 'hg help urls' for more information.
  2225     """
  2229     """
  2226     source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
  2230     source, revs, checkout = hg.parseurl(ui.expandpath(source), opts.get('rev'))
  2247     local this is identical to a pull in that directory from the
  2251     local this is identical to a pull in that directory from the
  2248     current one.
  2252     current one.
  2249 
  2253 
  2250     By default, push will refuse to run if it detects the result would
  2254     By default, push will refuse to run if it detects the result would
  2251     increase the number of remote heads. This generally indicates the
  2255     increase the number of remote heads. This generally indicates the
  2252     the client has forgotten to pull and merge before pushing.
  2256     user forgot to pull and merge before pushing.
  2253 
  2257 
  2254     If -r/--rev is used, the named revision and all its ancestors will
  2258     If -r/--rev is used, the named revision and all its ancestors will
  2255     be pushed to the remote repository.
  2259     be pushed to the remote repository.
  2256 
  2260 
  2257     Look at the help text for URLs for important details about ssh://
  2261     Please see 'hg help urls' for important details about ssh://
  2258     URLs. If DESTINATION is omitted, a default path will be used.
  2262     URLs. If DESTINATION is omitted, a default path will be used.
  2259     See 'hg help urls' for more information.
  2263     See 'hg help urls' for more information.
  2260     """
  2264     """
  2261     dest, revs, checkout = hg.parseurl(
  2265     dest, revs, checkout = hg.parseurl(
  2262         ui.expandpath(dest or 'default-push', dest or 'default'), opts.get('rev'))
  2266         ui.expandpath(dest or 'default-push', dest or 'default'), opts.get('rev'))
  2287 
  2291 
  2288     This only removes files from the current branch, not from the
  2292     This only removes files from the current branch, not from the
  2289     entire project history. -A/--after can be used to remove only
  2293     entire project history. -A/--after can be used to remove only
  2290     files that have already been deleted, -f/--force can be used to
  2294     files that have already been deleted, -f/--force can be used to
  2291     force deletion, and -Af can be used to remove files from the next
  2295     force deletion, and -Af can be used to remove files from the next
  2292     revision without deleting them.
  2296     revision without deleting them from the working directory.
  2293 
  2297 
  2294     The following table details the behavior of remove for different
  2298     The following table details the behavior of remove for different
  2295     file states (columns) and option combinations (rows). The file
  2299     file states (columns) and option combinations (rows). The file
  2296     states are Added, Clean, Modified and Missing (as reported by hg
  2300     states are Added [A], Clean [C], Modified [M] and Missing [!]
  2297     status). The actions are Warn, Remove (from branch) and Delete
  2301     (as reported by hg status). The actions are Warn, Remove (from
  2298     (from disk).
  2302     branch) and Delete (from disk).
  2299 
  2303 
  2300            A  C  M  !
  2304            A  C  M  !
  2301     none   W  RD W  R
  2305     none   W  RD W  R
  2302     -f     R  RD RD R
  2306     -f     R  RD RD R
  2303     -A     W  W  W  R
  2307     -A     W  W  W  R
  2370 
  2374 
  2371     If a conflict is resolved manually, please note that the changes
  2375     If a conflict is resolved manually, please note that the changes
  2372     will be overwritten if the merge is retried with resolve. The
  2376     will be overwritten if the merge is retried with resolve. The
  2373     -m/--mark switch should be used to mark the file as resolved.
  2377     -m/--mark switch should be used to mark the file as resolved.
  2374 
  2378 
  2375     This command will also allow listing resolved files and manually
  2379     This command also allows listing resolved files and manually
  2376     marking and unmarking files as resolved. All files must be marked
  2380     indicating whether or not files are resolved. All files must be
  2377     as resolved before the new commits are permitted.
  2381     marked as resolved before a commit is permitted.
  2378 
  2382 
  2379     The codes used to show the status of files are:
  2383     The codes used to show the status of files are:
  2380     U = unresolved
  2384     U = unresolved
  2381     R = resolved
  2385     R = resolved
  2382     """
  2386     """
  2735 def status(ui, repo, *pats, **opts):
  2739 def status(ui, repo, *pats, **opts):
  2736     """show changed files in the working directory
  2740     """show changed files in the working directory
  2737 
  2741 
  2738     Show status of files in the repository. If names are given, only
  2742     Show status of files in the repository. If names are given, only
  2739     files that match are shown. Files that are clean or ignored or
  2743     files that match are shown. Files that are clean or ignored or
  2740     source of a copy/move operation, are not listed unless -c/--clean,
  2744     the source of a copy/move operation, are not listed unless
  2741     -i/--ignored, -C/--copies or -A/--all is given. Unless options
  2745     -c/--clean, -i/--ignored, -C/--copies or -A/--all are given.
  2742     described with "show only ..." are given, the options -mardu are
  2746     Unless options described with "show only ..." are given, the
  2743     used.
  2747     options -mardu are used.
  2744 
  2748 
  2745     Option -q/--quiet hides untracked (unknown and ignored) files
  2749     Option -q/--quiet hides untracked (unknown and ignored) files
  2746     unless explicitly requested with -u/--unknown or -i/--ignored.
  2750     unless explicitly requested with -u/--unknown or -i/--ignored.
  2747 
  2751 
  2748     NOTE: status may appear to disagree with diff if permissions have
  2752     NOTE: status may appear to disagree with diff if permissions have
  2749     changed or a merge has occurred. The standard diff format does not
  2753     changed or a merge has occurred. The standard diff format does not
  2750     report permission changes and diff only reports changes relative
  2754     report permission changes and diff only reports changes relative
  2751     to one merge parent.
  2755     to one merge parent.
  2752 
  2756 
  2753     If one revision is given, it is used as the base revision.
  2757     If one revision is given, it is used as the base revision.
  2754     If two revisions are given, the difference between them is shown.
  2758     If two revisions are given, the differences between them are
       
  2759     shown.
  2755 
  2760 
  2756     The codes used to show the status of files are:
  2761     The codes used to show the status of files are:
  2757     M = modified
  2762     M = modified
  2758     A = added
  2763     A = added
  2759     R = removed
  2764     R = removed
  2760     C = clean
  2765     C = clean
  2761     ! = missing (deleted by non-hg command, but still tracked)
  2766     ! = missing (deleted by non-hg command, but still tracked)
  2762     ? = not tracked
  2767     ? = not tracked
  2763     I = ignored
  2768     I = ignored
  2764       = the previous added file was copied from here
  2769       = origin of the previous file listed as A (added)
  2765     """
  2770     """
  2766 
  2771 
  2767     node1, node2 = cmdutil.revpair(repo, opts.get('rev'))
  2772     node1, node2 = cmdutil.revpair(repo, opts.get('rev'))
  2768     cwd = (pats and repo.getcwd()) or ''
  2773     cwd = (pats and repo.getcwd()) or ''
  2769     end = opts.get('print0') and '\0' or '\n'
  2774     end = opts.get('print0') and '\0' or '\n'
  2900             ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype))
  2905             ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype))
  2901 
  2906 
  2902 def tip(ui, repo, **opts):
  2907 def tip(ui, repo, **opts):
  2903     """show the tip revision
  2908     """show the tip revision
  2904 
  2909 
  2905     The tip revision (usually just called the tip) is the most
  2910     The tip revision (usually just called the tip) is the changeset
  2906     recently added changeset in the repository, the most recently
  2911     most recently added to the repository (and therefore the most
  2907     changed head.
  2912     recently changed head).
  2908 
  2913 
  2909     If you have just made a commit, that commit will be the tip. If
  2914     If you have just made a commit, that commit will be the tip. If
  2910     you have just pulled changes from another repository, the tip of
  2915     you have just pulled changes from another repository, the tip of
  2911     that repository becomes the current tip. The "tip" tag is special
  2916     that repository becomes the current tip. The "tip" tag is special
  2912     and cannot be renamed or assigned to a different changeset.
  2917     and cannot be renamed or assigned to a different changeset.