##// END OF EJS Templates
cleanup: typos
cleanup: typos

File last commit:

r11644:c4f6f0a1 merge default
r11685:aade8f13 default
Show More
commands.py
4460 lines | 159.6 KiB | text/x-python | PythonLexer
mpm@selenic.com
import and startup cleanups...
r249 # commands.py - command processing for mercurial
#
Thomas Arendsen Hein
Updated copyright notices and add "and others" to "hg version"
r4635 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
mpm@selenic.com
import and startup cleanups...
r249 #
Martin Geisler
updated license to be explicit about GPL version 2
r8225 # This software may be used and distributed according to the terms of the
Matt Mackall
Update license to GPLv2+
r10263 # GNU General Public License version 2 or any later version.
mpm@selenic.com
import and startup cleanups...
r249
Joel Rosdahl
Expand import * to allow Pyflakes to find problems
r6211 from node import hex, nullid, nullrev, short
Ronny Pfannschmidt
switch lock releasing in the core from gc to explicit
r8109 from lock import release
Martin Geisler
i18n: mark help strings for translation...
r7013 from i18n import _, gettext
Benoit Boissinot
remove unused imports
r9678 import os, re, sys, difflib, time, tempfile
import hg, util, revlog, bundlerepo, extensions, copies, error
Dirkjan Ochtman
move discovery methods from localrepo into new discovery module
r11301 import patch, help, mdiff, url, encoding, templatekw, discovery
Matt Mackall
hgweb: unify hgweb calls in serve
r11004 import archival, changegroup, cmdutil, sshserver, hbisect, hgweb, hgweb.server
Benoit Boissinot
style: use consistent variable names (*mod) with imports which would shadow
r10651 import merge as mergemod
Matt Mackall
revset: add a debugrevspec command
r11276 import minirst, revset
Peter Arrenbrecht
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text...
r11336 import dagparser
Matt Mackall
Kill ui.setconfig_remoteopts...
r2731
mpm@selenic.com
hg help: use docstrings only...
r255 # Commands start here, listed alphabetically
mpm@selenic.com
Beginning of new command parsing interface...
r209
Bryan O'Sullivan
Get add and locate to use new repo and dirstate walk code....
r724 def add(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """add the specified files on the next commit
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Schedule files to be version controlled and added to the
repository.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Matt Mackall
Add doc notes about revert and hg status vs diff
r3829 The files will be added to the repository at the next commit. To
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 undo an add before that, see :hg:`forget`.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
timeless
help: miscellaneous language fixes
r7807 If no names are given, add all files to the repository.
Martin Geisler
commands: add verbose example to help text for add
r10446
.. container:: verbose
An example showing how new (unknown) files are added
Martin Geisler
Use hg role in help strings
r10973 automatically by :hg:`add`::
Martin Geisler
commands: add verbose example to help text for add
r10446
$ ls
foo.c
$ hg status
? foo.c
$ hg add
adding foo.c
$ hg status
Martin Geisler
commands: correct example in add help text
r10448 A foo.c
Nicolas Dumazet
commands: document return values of add and paths commands
r11507
Returns 0 if all files are successfully added.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
add: use match.bad callback more effectively
r8679 bad = []
Bryan O'Sullivan
Get add and locate to use new repo and dirstate walk code....
r724 names = []
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579 m = cmdutil.match(repo, pats, opts)
Matt Mackall
add: use match.bad callback more effectively
r8679 oldbad = m.bad
Matt Mackall
many, many trivial check-code fixups
r10282 m.bad = lambda x, y: bad.append(x) or oldbad(x, y)
Matt Mackall
add: use match.bad callback more effectively
r8679
for f in repo.walk(m):
exact = m.exact(f)
if exact or f not in repo.dirstate:
names.append(f)
if ui.verbose or not exact:
ui.status(_('adding %s\n') % m.rel(f))
Thomas Arendsen Hein
Don't require opts['dry_run'] to be set to fix external tools like tailor.
r2503 if not opts.get('dry_run'):
Dirkjan Ochtman
move working dir/dirstate methods from localrepo to workingctx
r11303 bad += [f for f in repo[None].add(names) if f in m.files()]
Matt Mackall
add: use match.bad callback more effectively
r8679 return bad and 1 or 0
mpm@selenic.com
commands: migrate status and branch...
r213
Bryan O'Sullivan
Get addremove to use new walk code....
r766 def addremove(ui, repo, *pats, **opts):
Thomas Arendsen Hein
Documentation fixes for addremove....
r3181 """add all new files, delete all missing files
Vadim Gelfer
deprecate addremove command.
r2181
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Add all new files and remove all missing files from the
repository.
New files are ignored if they match any of the patterns in
.hgignore. As with add, these changes take effect at the next
commit.
Vadim Gelfer
addremove: add -s/--similarity option...
r2958
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 Use the -s/--similarity option to detect renamed files. With a
Martin Geisler
commands: wrap docstrings at 70 characters...
r9249 parameter greater than 0, this compares every removed file with
every added file and records those similar enough as renames. This
option takes a percentage between 0 (disabled) and 100 (files must
be identical) as its parameter. Detecting renamed files this way
Arnab Bose
commands: mention "hg status -C" in addremove help
r11518 can be expensive. After using this option, :hg:`status -C` can be
used to check which files were identified as moved or renamed.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 if all files are successfully added.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Bryan O'Sullivan
addremove: print meaningful error message if --similar not numeric
r4966 try:
Dirkjan Ochtman
commands: addremove does similarity 100 by default
r11551 sim = float(opts.get('similarity') or 100)
Bryan O'Sullivan
addremove: print meaningful error message if --similar not numeric
r4966 except ValueError:
raise util.Abort(_('similarity must be a number'))
Vadim Gelfer
addremove: add -s/--similarity option...
r2958 if sim < 0 or sim > 100:
raise util.Abort(_('similarity must be between 0 and 100'))
Matt Mackall
many, many trivial check-code fixups
r10282 return cmdutil.addremove(repo, pats, opts, similarity=sim / 100.0)
mpm@selenic.com
hg checkout: refuse to checkout if there are outstanding changes...
r219
Bryan O'Sullivan
Convert annotate over to walk interface....
r733 def annotate(ui, repo, *pats, **opts):
timeless
Improve English for help text of many core hg commands....
r8779 """show changeset information by line for each file
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 List changes in files, showing the revision id responsible for
each line
timeless
Improve English for help text of many core hg commands....
r8779 This command is useful for discovering when a change was made and
by whom.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 Without the -a/--text option, annotate will avoid processing files
timeless
Improve English for help text of many core hg commands....
r8779 it detects as binary. With -a, annotate will annotate the file
anyway, although the results will probably be neither useful
nor desirable.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Thomas Arendsen Hein
Make annotate --follow an alias for -f/--file to behave like in older versions...
r10579 if opts.get('follow'):
# --follow is deprecated and now just an alias for -f/--file
# to mimic the behavior of Mercurial before version 1.5
opts['file'] = 1
Thomas Arendsen Hein
Make annotae/grep print short dates with -q/--quiet....
r6134 datefunc = ui.quiet and util.shortdate or util.datestr
getdate = util.cachefunc(lambda x: datefunc(x[0].date()))
lupus@debian.org
Added --date option to annotate.
r1522
mpm@selenic.com
Handle empty file list for annotate
r744 if not pats:
timeless
Generally replace "file name" with "filename" in help and comments.
r8761 raise util.Abort(_('at least one filename or pattern is required'))
mpm@selenic.com
Handle empty file list for annotate
r744
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857 opmap = [('user', lambda x: ui.shortuser(x[0].user())),
('number', lambda x: str(x[0].rev())),
('changeset', lambda x: short(x[0].node())),
('date', getdate),
Dirkjan Ochtman
commands: annotate follows by default, separate -f/--file option
r10369 ('file', lambda x: x[0].path()),
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857 ]
Matt Mackall
many, many trivial check-code fixups
r10282 if (not opts.get('user') and not opts.get('changeset')
Dirkjan Ochtman
commands: annotate follows by default, separate -f/--file option
r10369 and not opts.get('date') and not opts.get('file')):
Thomas Arendsen Hein
Some cleanups in commands.annotate()....
r714 opts['number'] = 1
mpm@selenic.com
Beginning of new command parsing interface...
r209
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857 linenumber = opts.get('line_number') is not None
Benoit Boissinot
fix coding style (reported by pylint)
r10394 if linenumber and (not opts.get('changeset')) and (not opts.get('number')):
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857 raise util.Abort(_('at least one of -n/-c is required for -l'))
funcmap = [func for op, func in opmap if opts.get(op)]
if linenumber:
lastfunc = funcmap[-1]
funcmap[-1] = lambda x: "%s:%s" % (lastfunc(x), x[1])
Alexander Solovyov
commands: optional options where possible...
r7131 ctx = repo[opts.get('rev')]
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579 m = cmdutil.match(repo, pats, opts)
Dirkjan Ochtman
commands: annotate follows by default, separate -f/--file option
r10369 follow = not opts.get('no_follow')
Matt Mackall
context: add walk method
r6764 for abs in ctx.walk(m):
fctx = ctx[abs]
Alexander Solovyov
commands: optional options where possible...
r7131 if not opts.get('text') and util.binary(fctx.data()):
Matt Mackall
walk: remove rel and exact returns
r6584 ui.write(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs))
mpm@selenic.com
Teach annotate about binary files
r1016 continue
Dirkjan Ochtman
commands: annotate follows by default, separate -f/--file option
r10369 lines = fctx.annotate(follow=follow, linenumber=linenumber)
mpm@selenic.com
Beginning of new command parsing interface...
r209 pieces = []
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857 for f in funcmap:
l = [f(n) for n, dummy in lines]
if l:
FUJIWARA Katsunori
i18n: use encoding.colwidth() for correct column width...
r11611 sized = [(x, encoding.colwidth(x)) for x in l]
ml = max([w for x, w in sized])
pieces.append(["%s%s" % (' ' * (ml - w), x) for x, w in sized])
mpm@selenic.com
Beginning of new command parsing interface...
r209
mpm@selenic.com
Fixes for annotate...
r771 if pieces:
for p, l in zip(zip(*pieces), lines):
ui.write("%s: %s" % (" ".join(p), l[1]))
mpm@selenic.com
Beginning of new command parsing interface...
r209
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112 def archive(ui, repo, dest, **opts):
timeless
Improve English for help text of many core hg commands....
r8779 '''create an unversioned archive of a repository revision
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112
By default, the revision used is the parent of the working
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 directory; use -r/--rev to specify a different revision.
David Wolever
archive: autodetect archive type by extension (issue2058)
r10650 The archive type is automatically detected based on file
extension (or override using -t/--type).
Valid types are:
Martin Geisler
commands: use field lists instead of literal blocks in docstrings...
r9892
:``files``: a directory full of files (default)
:``tar``: tar archive, uncompressed
:``tbz2``: tar archive, compressed using bzip2
:``tgz``: tar archive, compressed using gzip
:``uzip``: zip archive, uncompressed
:``zip``: zip archive, compressed using deflate
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112
The exact name of the destination archive or directory is given
Martin Geisler
Use hg role in help strings
r10973 using a format string; see :hg:`help export` for details.
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112
Each member added to an archive file has a directory prefix
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 prepended. Use -p/--prefix to specify a format string for the
prefix. The default is the basename of the archive, with suffixes
removed.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112 '''
Alexander Solovyov
commands: optional options where possible...
r7131 ctx = repo[opts.get('rev')]
Brendan Cully
archive: abort on empty repository. Fixes #624.
r5061 if not ctx:
Matt Mackall
archive: fix bogus error message with no working directory
r7528 raise util.Abort(_('no working directory: please specify a revision'))
Brendan Cully
archive: abort on empty repository. Fixes #624.
r5061 node = ctx.node()
Vadim Gelfer
refactor text diff/patch code....
r2874 dest = cmdutil.make_filename(repo, dest, node)
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112 if os.path.realpath(dest) == repo.root:
raise util.Abort(_('repository root cannot be destination'))
David Wolever
archive: autodetect archive type by extension (issue2058)
r10650
Martin Geisler
archival: move commands.archive.guess_type to archival.guesskind...
r11557 kind = opts.get('type') or archival.guesskind(dest) or 'files'
Alexander Solovyov
commands: optional options where possible...
r7131 prefix = opts.get('prefix')
David Wolever
archive: autodetect archive type by extension (issue2058)
r10650
Vadim Gelfer
archive: make "hg archive -t XXX -" to write to stdout
r2476 if dest == '-':
if kind == 'files':
raise util.Abort(_('cannot archive plain files to stdout'))
dest = sys.stdout
Matt Mackall
many, many trivial check-code fixups
r10282 if not prefix:
prefix = os.path.basename(repo.root) + '-%h'
David Wolever
archive: autodetect archive type by extension (issue2058)
r10650
Vadim Gelfer
refactor text diff/patch code....
r2874 prefix = cmdutil.make_filename(repo, prefix, node)
David Wolever
archive: autodetect archive type by extension (issue2058)
r10650 matchfn = cmdutil.match(repo, [], opts)
Alexander Solovyov
commands: optional options where possible...
r7131 archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
Vadim Gelfer
archive: make "hg archive -t XXX -" to write to stdout
r2476 matchfn, prefix)
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112
Daniel Holth
accept -r REV in more places...
r4450 def backout(ui, repo, node=None, rev=None, **opts):
Vadim Gelfer
add backout command....
r2158 '''reverse effect of earlier changeset
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 Commit the backed out changes as a new changeset. The new
Vadim Gelfer
backout command: better help.
r2254 changeset is a child of the backed out changeset.
Vadim Gelfer
add backout command....
r2158
timeless
Improve English for help text of many core hg commands....
r8779 If you backout a changeset other than the tip, a new head is
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 created. This head will be the new tip and you should merge this
timeless
Improve English for help text of many core hg commands....
r8779 backout changeset with another head.
Vadim Gelfer
backout command: better help.
r2254
The --merge option remembers the parent of the working directory
before starting the backout, then merges the new head with that
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 changeset afterwards. This saves you from doing the merge by hand.
The result of this merge is not committed, as with a normal merge.
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help dates` for a list of formats valid for -d/--date.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163 '''
Daniel Holth
accept -r REV in more places...
r4450 if rev and node:
raise util.Abort(_("please specify just one revision"))
if not rev:
rev = node
Vadim Gelfer
add backout command....
r2158
Thomas Arendsen Hein
Fix and test 'hg backout' without or with too many revisions.
r4726 if not rev:
raise util.Abort(_("please specify a revision to backout"))
Thomas Arendsen Hein
Fix bad behaviour when specifying an invalid date (issue700)...
r6139 date = opts.get('date')
if date:
opts['date'] = util.parsedate(date)
Matt Mackall
dispatch: move dispatching code to cmdutil
r4549 cmdutil.bail_if_changed(repo)
Matt Mackall
cmdutil: make bail_if_changed bail on uncommitted merge
r5716 node = repo.lookup(rev)
Vadim Gelfer
add backout command....
r2158 op1, op2 = repo.dirstate.parents()
Matt Mackall
backout: disallow across branches (issue655)
r5568 a = repo.changelog.ancestor(op1, node)
if a != node:
timeless
Improve English for help text of many core hg commands....
r8779 raise util.Abort(_('cannot backout change on a different branch'))
Matt Mackall
backout: disallow across branches (issue655)
r5568
Vadim Gelfer
backout: allow backout of merge changeset with --parent option....
r2614 p1, p2 = repo.changelog.parents(node)
if p1 == nullid:
timeless
Improve English for help text of many core hg commands....
r8779 raise util.Abort(_('cannot backout a change with no parents'))
Vadim Gelfer
add backout command....
r2158 if p2 != nullid:
Alexander Solovyov
commands: optional options where possible...
r7131 if not opts.get('parent'):
timeless
Improve English for help text of many core hg commands....
r8779 raise util.Abort(_('cannot backout a merge changeset without '
Vadim Gelfer
backout: allow backout of merge changeset with --parent option....
r2614 '--parent'))
p = repo.lookup(opts['parent'])
if p not in (p1, p2):
Marcos Chaves
fix warnings generated by pygettext.py.
r3679 raise util.Abort(_('%s is not a parent of %s') %
Thomas Arendsen Hein
Indentation cleanups for 2956948b81f3.
r3680 (short(p), short(node)))
Vadim Gelfer
backout: allow backout of merge changeset with --parent option....
r2614 parent = p
else:
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('parent'):
Vadim Gelfer
backout: allow backout of merge changeset with --parent option....
r2614 raise util.Abort(_('cannot use --parent on non-merge changeset'))
parent = p1
Matt Mackall
backout: disallow across branches (issue655)
r5568
Matt Mackall
backout: reverse changeset belongs on current branch...
r6423 # the backout should appear on the same branch
branch = repo.dirstate.branch()
Matt Mackall
Introduce update helper functions: update, merge, clean, and revert
r2808 hg.clean(repo, node, show_stats=False)
Matt Mackall
backout: reverse changeset belongs on current branch...
r6423 repo.dirstate.setbranch(branch)
Vadim Gelfer
add backout command....
r2158 revert_opts = opts.copy()
Matt Mackall
Add --date support to update and revert...
r3814 revert_opts['date'] = None
Vadim Gelfer
revert: require --all to revert all files.
r2982 revert_opts['all'] = True
Vadim Gelfer
add backout command....
r2158 revert_opts['rev'] = hex(parent)
Alexis S. L. Carvalho
revert: don't assume ignored files will be returned in the unknown list...
r6031 revert_opts['no_backup'] = None
Vadim Gelfer
add backout command....
r2158 revert(ui, repo, **revert_opts)
commit_opts = opts.copy()
commit_opts['addremove'] = False
Thomas Arendsen Hein
Small cleanups to backout command:...
r2159 if not commit_opts['message'] and not commit_opts['logfile']:
Martin Geisler
do not translate commit messages...
r9183 # we don't translate commit messages
Martin Geisler
commands: remove ineffective parenthesis
r9197 commit_opts['message'] = "Backed out changeset %s" % short(node)
Vadim Gelfer
fix coding style of backout editor change.
r2268 commit_opts['force_editor'] = True
Vadim Gelfer
add backout command....
r2158 commit(ui, repo, **commit_opts)
def nice(node):
return '%d:%s' % (repo.changelog.rev(node), short(node))
ui.status(_('changeset %s backs out changeset %s\n') %
(nice(repo.changelog.tip()), nice(node)))
Vadim Gelfer
print message after backout that tells that backout adds new head.
r2493 if op1 != node:
Gilles Moris
Reverse the way backout is doing the merge...
r6161 hg.clean(repo, op1, show_stats=False)
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('merge'):
Matt Mackall
many, many trivial check-code fixups
r10282 ui.status(_('merging with changeset %s\n')
% nice(repo.changelog.tip()))
Gilles Moris
Reverse the way backout is doing the merge...
r6161 hg.merge(repo, hex(repo.changelog.tip()))
Vadim Gelfer
print message after backout that tells that backout adds new head.
r2493 else:
ui.status(_('the backout changeset is a new head - '
'do not forget to merge\n'))
Christian Ebert
fix hg backup option recommendation for auto-merge
r2761 ui.status(_('(use "backout --merge" '
'if you want to auto-merge)\n'))
Vadim Gelfer
add backout command....
r2158
Alexander Solovyov
bisect: ability to check revision with command
r7227 def bisect(ui, repo, rev=None, extra=None, command=None,
Matt Mackall
bisect: make bisect a built-in command
r5775 reset=None, good=None, bad=None, skip=None, noupdate=None):
"""subdivision search of changesets
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 This command helps to find changesets which introduce problems. To
use, mark the earliest changeset you know exhibits the problem as
bad, then mark the latest changeset which is free from the problem
as good. Bisect will update your working directory to a revision
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 for testing (unless the -U/--noupdate option is specified). Once
timeless
Improve English for help text of many core hg commands....
r8779 you have performed tests, mark the working directory as good or
bad, and bisect will either update to another candidate changeset
Dirkjan Ochtman
bisect: expand help text to explain REV argument and --noupdate
r6928 or announce that it has found the bad revision.
Dirkjan Ochtman
clean up trailing spaces
r7184
Dirkjan Ochtman
bisect: expand help text to explain REV argument and --noupdate
r6928 As a shortcut, you can also use the revision argument to mark a
revision as good or bad without checking it out first.
Alexander Solovyov
bisect: ability to check revision with command
r7227
timeless
Improve English for help text of many core hg commands....
r8779 If you supply a command, it will be used for automatic bisection.
Its exit status will be used to mark revisions as good or bad:
status 0 means good, 125 means to skip the revision, 127
(command not found) will abort the bisection, and any other
non-zero exit status means the revision is bad.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Matt Mackall
bisect: make bisect a built-in command
r5775 """
Alexander Solovyov
bisect: ability to check revision with command
r7227 def print_result(nodes, good):
Matt Mackall
bisect: make bisect a built-in command
r5775 displayer = cmdutil.show_changeset(ui, repo, {})
Bernhard Leiner
Add support for multiple possible bisect results (issue1228, issue1182)...
r6858 if len(nodes) == 1:
# narrowed it down to a single revision
Wagner Bruna
commands, i18n: avoid untranslated strings as message parameters
r8088 if good:
ui.write(_("The first good revision is:\n"))
else:
ui.write(_("The first bad revision is:\n"))
Dirkjan Ochtman
cmdutil: use change contexts for cset-printer and cset-templater
r7369 displayer.show(repo[nodes[0]])
Bernhard Leiner
Add support for multiple possible bisect results (issue1228, issue1182)...
r6858 else:
# multiple possible revisions
Wagner Bruna
commands, i18n: avoid untranslated strings as message parameters
r8088 if good:
ui.write(_("Due to skipped revisions, the first "
"good revision could be any of:\n"))
else:
ui.write(_("Due to skipped revisions, the first "
"bad revision could be any of:\n"))
Bernhard Leiner
Add support for multiple possible bisect results (issue1228, issue1182)...
r6858 for n in nodes:
Dirkjan Ochtman
cmdutil: use change contexts for cset-printer and cset-templater
r7369 displayer.show(repo[n])
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer.close()
Alexander Solovyov
bisect: ability to check revision with command
r7227
def check_state(state, interactive=True):
if not state['good'] or not state['bad']:
if (good or bad or skip or reset) and interactive:
return
if not state['good']:
raise util.Abort(_('cannot bisect (no known good revisions)'))
else:
raise util.Abort(_('cannot bisect (no known bad revisions)'))
return True
# backward compatibility
if rev in "good bad reset init".split():
ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n"))
cmd, rev, extra = rev, extra, None
if cmd == "good":
good = True
elif cmd == "bad":
bad = True
else:
reset = True
elif extra or good + bad + skip + reset + bool(command) > 1:
raise util.Abort(_('incompatible arguments'))
if reset:
p = repo.join("bisect.state")
if os.path.exists(p):
os.unlink(p)
return
state = hbisect.load_state(repo)
if command:
changesets = 1
Benoit Boissinot
bisect: improve hg bisect -c (relative paths, error handling)...
r7590 try:
while changesets:
# update state
Matt Mackall
bisect: use util.system and fix good/bad when using -c...
r9584 status = util.system(command)
Benoit Boissinot
bisect: improve hg bisect -c (relative paths, error handling)...
r7590 if status == 125:
transition = "skip"
elif status == 0:
transition = "good"
# status < 0 means process was killed
elif status == 127:
raise util.Abort(_("failed to execute %s") % command)
elif status < 0:
raise util.Abort(_("%s killed") % command)
else:
transition = "bad"
Patrick Mezard
bisect: improve --command output...
r8805 ctx = repo[rev or '.']
state[transition].append(ctx.node())
ui.status(_('Changeset %d:%s: %s\n') % (ctx, ctx, transition))
Benoit Boissinot
bisect: improve hg bisect -c (relative paths, error handling)...
r7590 check_state(state, interactive=False)
# bisect
nodes, changesets, good = hbisect.bisect(repo.changelog, state)
# update to next check
cmdutil.bail_if_changed(repo)
hg.clean(repo, nodes[0], show_stats=False)
finally:
hbisect.save_state(repo, state)
Matt Mackall
commands: initial audit of exit codes...
r11177 print_result(nodes, good)
return
Alexander Solovyov
bisect: ability to check revision with command
r7227
# update state
node = repo.lookup(rev or '.')
Benoit Boissinot
bisect: no need to save the state if it wasn't changed
r9689 if good or bad or skip:
if good:
state['good'].append(node)
elif bad:
state['bad'].append(node)
elif skip:
state['skip'].append(node)
hbisect.save_state(repo, state)
Alexander Solovyov
bisect: ability to check revision with command
r7227
if not check_state(state):
return
# actually bisect
nodes, changesets, good = hbisect.bisect(repo.changelog, state)
if changesets == 0:
print_result(nodes, good)
Bernhard Leiner
Add support for multiple possible bisect results (issue1228, issue1182)...
r6858 else:
assert len(nodes) == 1 # only a single node can be tested next
node = nodes[0]
Matt Mackall
bisect: make bisect a built-in command
r5775 # compute the approximate number of remaining tests
tests, size = 0, 2
while size <= changesets:
tests, size = tests + 1, size * 2
rev = repo.changelog.rev(node)
Cédric Duval
bisect: fix format specifiers for integers
r9012 ui.write(_("Testing changeset %d:%s "
"(%d changesets remaining, ~%d tests)\n")
Joel Rosdahl
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
r6217 % (rev, short(node), changesets, tests))
Matt Mackall
bisect: make bisect a built-in command
r5775 if not noupdate:
cmdutil.bail_if_changed(repo)
return hg.clean(repo, node)
Brendan Cully
branch: require --force to shadow existing branches
r4202 def branch(ui, repo, label=None, **opts):
Matt Mackall
add branch and branches commands
r3502 """set or show the current branch name
Brendan Cully
Notify the user that hg branch does not create a branch until commit
r4601 With no argument, show the current branch name. With one argument,
timeless
Improve English for help text of many core hg commands....
r8779 set the working directory branch name (the branch will not exist
in the repository until the next commit). Standard practice
recommends that primary development take place on the 'default'
branch.
Brendan Cully
branch: require --force to shadow existing branches
r4202
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 Unless -f/--force is specified, branch will not let you set a
timeless
Improve English for help text of many core hg commands....
r8779 branch name that already exists, even if it's inactive.
Thomas Arendsen Hein
Mention 'hg update' to switch branches in help for branch and branches.
r5999
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 Use -C/--clean to reset the working directory branch to that of
the parent of the working directory, negating a previous branch
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 change.
Sune Foldager
branch: added more support for named branches...
r7006
Martin Geisler
Use hg role in help strings
r10973 Use the command :hg:`update` to switch to an existing branch. Use
:hg:`commit --close-branch` to mark this branch as closed.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Matt Mackall
add branch and branches commands
r3502 """
Sune Foldager
branch: added more support for named branches...
r7006 if opts.get('clean'):
label = repo[None].parents()[0].branch()
repo.dirstate.setbranch(label)
ui.status(_('reset working directory to branch %s\n') % label)
elif label:
Steve Borho
commands: label from user is in local encoding...
r10315 utflabel = encoding.fromlocal(label)
if not opts.get('force') and utflabel in repo.branchtags():
Matt Mackall
use repo[changeid] to get a changectx
r6747 if label not in [p.branch() for p in repo.parents()]:
Brendan Cully
branch: require --force to shadow existing branches
r4202 raise util.Abort(_('a branch of the same name already exists'
Yuya Nishihara
branch: help misuse of hg branch to switch branches...
r10596 " (use 'hg update' to switch to it)"))
Steve Borho
commands: label from user is in local encoding...
r10315 repo.dirstate.setbranch(utflabel)
Brendan Cully
Notify the user that hg branch does not create a branch until commit
r4601 ui.status(_('marked working directory as branch %s\n') % label)
Matt Mackall
add branch and branches commands
r3502 else:
Matt Mackall
move encoding bits from util to encoding...
r7948 ui.write("%s\n" % encoding.tolocal(repo.dirstate.branch()))
Matt Mackall
add branch and branches commands
r3502
Matt Mackall
branches: add --closed flag for consistency with heads
r8991 def branches(ui, repo, active=False, closed=False):
Matt Mackall
add branch and branches commands
r3502 """list repository named branches
Eric Hopper
Change branches to sort 'active' branches first, and add an option to show only active branches.
r4675 List the repository's named branches, indicating which ones are
Matt Mackall
branches: add --closed flag for consistency with heads
r8991 inactive. If -c/--closed is specified, also list branches which have
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 been marked closed (see :hg:`commit --close-branch`).
Matt Mackall
branches: add --closed flag for consistency with heads
r8991
If -a/--active is specified, only show active branches. A branch
is considered active if it contains repository heads.
Thomas Arendsen Hein
Mention 'hg update' to switch branches in help for branch and branches.
r5999
Martin Geisler
Use hg role in help strings
r10973 Use the command :hg:`update` to switch to an existing branch.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0.
Matt Mackall
add branch and branches commands
r3502 """
Matt Mackall
branches: add --closed flag for consistency with heads
r8991
Stefano Tortarolo
Active branches fix (issue1104)
r6631 hexfunc = ui.debugflag and hex or short
Benoit Boissinot
localrepo/branchcache: remove lbranchmap(), convert users to use utf-8 names...
r9675 activebranches = [repo[n].branch() for n in repo.heads()]
John Mulligan
localrepo: remove 'closed' argument to heads(...) function...
r8796 def testactive(tag, node):
realhead = tag in activebranches
open = node in repo.branchheads(tag, closed=False)
return realhead and open
branches = sorted([(testactive(tag, node), repo.changelog.rev(node), tag)
Matt Mackall
replace various uses of list.reverse()
r8210 for tag, node in repo.branchtags().items()],
reverse=True)
Stefano Tortarolo
Active branches fix (issue1104)
r6631
for isactive, node, tag in branches:
if (not active) or isactive:
Benoit Boissinot
localrepo/branchcache: remove lbranchmap(), convert users to use utf-8 names...
r9675 encodedtag = encoding.tolocal(tag)
Eric Hopper
Change branches to sort 'active' branches first, and add an option to show only active branches.
r4675 if ui.quiet:
Benoit Boissinot
localrepo/branchcache: remove lbranchmap(), convert users to use utf-8 names...
r9675 ui.write("%s\n" % encodedtag)
Eric Hopper
Change branches to sort 'active' branches first, and add an option to show only active branches.
r4675 else:
John Mulligan
branch closing: referencing open and closed branches/heads...
r7656 hn = repo.lookup(node)
if isactive:
notice = ''
elif hn not in repo.branchheads(tag, closed=False):
Matt Mackall
branches: add --closed flag for consistency with heads
r8991 if not closed:
continue
Martin Geisler
commands: mark strings for translation
r9951 notice = _(' (closed)')
John Mulligan
branch closing: referencing open and closed branches/heads...
r7656 else:
Martin Geisler
commands: mark strings for translation
r9951 notice = _(' (inactive)')
Benoit Boissinot
localrepo/branchcache: remove lbranchmap(), convert users to use utf-8 names...
r9675 rev = str(node).rjust(31 - encoding.colwidth(encodedtag))
data = encodedtag, rev, hexfunc(hn), notice
Stefano Tortarolo
branches unparseable output fix (issue1230)
r6814 ui.write("%s %s:%s%s\n" % data)
Matt Mackall
add branch and branches commands
r3502
Vadim Gelfer
push, outgoing, bundle: fall back to "default" if "default-push" not defined
r2494 def bundle(ui, repo, fname, dest=None, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """create a changegroup file
Thomas Arendsen Hein
Corrected help text for bundle.
r3511 Generate a compressed changegroup file collecting changesets not
timeless
help: miscellaneous language fixes
r7807 known to be in another repository.
Thomas Arendsen Hein
Corrected help text for bundle.
r3511
timeless
help: Improved body text
r10376 If you omit the destination repository, then hg assumes the
destination will have all the nodes you specify with --base
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 parameters. To create a bundle containing all changesets, use
Henrik Stuart
help: describe bundle compression methods (issue1523)
r8903 -a/--all (or --base null).
Stefano Mioli
commands: improve bundle compression methods description
r8958 You can change compression method with the -t/--type option.
The available compression methods are: none, bzip2, and
Henrik Stuart
help: describe bundle compression methods (issue1523)
r8903 gzip (by default, bundles are compressed using bzip2).
Thomas Arendsen Hein
Corrected help text for bundle.
r3511
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 The bundle file can then be transferred using conventional means
and applied to another repository with the unbundle or pull
command. This is useful when direct push and pull are not
available or when exporting an entire repository is undesirable.
Thomas Arendsen Hein
Corrected help text for bundle.
r3511
Applying bundles preserves all changeset contents including
permissions, copy/rename information, and revision history.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if no changes found.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 revs = opts.get('rev') or None
John Mulligan
Add --all option to bundle command
r6171 if opts.get('all'):
base = ['null']
else:
base = opts.get('base')
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 if base:
if dest:
Martin Geisler
commands: typo in bundle abort message...
r8669 raise util.Abort(_("--base is incompatible with specifying "
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 "a destination"))
Benoit Boissinot
bundle --base: use the right set for the base
r3318 base = [repo.lookup(rev) for rev in base]
# create the right base
# XXX: nodesbetween / changegroup* should be "fixed" instead
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 o = []
Benoit Boissinot
revlog: use set instead of dict
r8464 has = set((nullid,))
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 for n in base:
Matt Mackall
bundle: don't use sets.Set
r3631 has.update(repo.changelog.reachable(n))
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 if revs:
Nicolas Dumazet
bundle: lookup revisions after addbranchrevs...
r11636 revs = [repo.lookup(rev) for rev in revs]
visit = revs[:]
has.difference_update(visit)
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 else:
Benoit Boissinot
bundle --base: use the right set for the base
r3318 visit = repo.changelog.heads()
Matt Mackall
bundle: don't use sets.Set
r3631 seen = {}
Benoit Boissinot
bundle --base: use the right set for the base
r3318 while visit:
n = visit.pop(0)
Matt Mackall
bundle: don't use sets.Set
r3631 parents = [p for p in repo.changelog.parents(n) if p not in has]
Benoit Boissinot
bundle --base: use the right set for the base
r3318 if len(parents) == 0:
Benoit Boissinot
bundle: exclude csets given in --base, unless they are in --rev (issue1910)...
r10479 if n not in has:
o.append(n)
Benoit Boissinot
bundle --base: use the right set for the base
r3318 else:
Benoit Boissinot
fix graph traversal in commands.bundle (it wasn't O(n))
r3512 for p in parents:
if p not in seen:
Matt Mackall
bundle: don't use sets.Set
r3631 seen[p] = 1
Benoit Boissinot
fix graph traversal in commands.bundle (it wasn't O(n))
r3512 visit.append(p)
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 else:
Sune Foldager
interpret repo#name url syntax as branch instead of revision...
r10365 dest = ui.expandpath(dest or 'default-push', dest or 'default')
Sune Foldager
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
r10379 dest, branches = hg.parseurl(dest, opts.get('branch'))
Matt Mackall
remoteui: move from cmdutil to hg
r11273 other = hg.repository(hg.remoteui(repo, opts), dest)
Sune Foldager
interpret repo#name url syntax as branch instead of revision...
r10365 revs, checkout = hg.addbranchrevs(repo, other, branches, revs)
Nicolas Dumazet
bundle: lookup revisions after addbranchrevs...
r11636 if revs:
revs = [repo.lookup(rev) for rev in revs]
Dirkjan Ochtman
move discovery methods from localrepo into new discovery module
r11301 o = discovery.findoutgoing(repo, other, force=opts.get('force'))
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284
Benoit Boissinot
bundle: fix bundle generation for empty changegroup
r10616 if not o:
ui.status(_("no changes found\n"))
Matt Mackall
commands: initial audit of exit codes...
r11177 return 1
Benoit Boissinot
bundle: fix bundle generation for empty changegroup
r10616
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 if revs:
cg = repo.changegroupsubset(o, revs, 'bundle')
else:
cg = repo.changegroup(o, 'bundle')
Benoit Allard
add compression type type parameter to bundle command
r6570
bundletype = opts.get('type', 'bzip2').lower()
btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'}
bundletype = btypes.get(bundletype)
if bundletype not in changegroup.bundletypes:
raise util.Abort(_('unknown bundle type specified with --type'))
changegroup.writebundle(cg, fname, bundletype)
mpm@selenic.com
Add preliminary support for the bundle and unbundle commands
r1218
Bryan O'Sullivan
Switch cat command to use walk code....
r1254 def cat(ui, repo, file1, *pats, **opts):
Thomas Arendsen Hein
doc string fix: hg cat and manifest default to current parent revision.
r3914 """output the current or given revision of files
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Print the specified files as they were at the given revision. If
no revision is given, the parent of the working directory is used,
Thomas Arendsen Hein
doc fix: hg tags defaults to current parent revision, too....
r3915 or tip if no revision is checked out.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Output may be to a file, in which case the name of the file is
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 given using a format string. The formatting rules are the same as
Martin Geisler
commands: use field lists instead of literal blocks in docstrings...
r9892 for the export command, with the following additions:
:``%s``: basename of file being printed
:``%d``: dirname of file being printed, or '.' if in repository root
:``%p``: root-relative path name of file being printed
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Alexander Solovyov
commands: optional options where possible...
r7131 ctx = repo[opts.get('rev')]
Matt Mackall
cat: return an error on failure
r4697 err = 1
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579 m = cmdutil.match(repo, (file1,) + pats, opts)
Matt Mackall
context: add walk method
r6764 for abs in ctx.walk(m):
Alexander Solovyov
commands: optional options where possible...
r7131 fp = cmdutil.make_file(repo, opts.get('output'), ctx.node(), pathname=abs)
Matt Mackall
context: add walk method
r6764 data = ctx[abs].data()
Thomas Arendsen Hein
cat --decode: Drop short option, use opts.get() instead of opts[]...
r6094 if opts.get('decode'):
Jesse Glick
Option --decode for hg cat to apply decode filters....
r6093 data = repo.wwritedata(abs, data)
fp.write(data)
Matt Mackall
cat: return an error on failure
r4697 err = 0
return err
mpm@selenic.com
migrate remaining commands...
r248
Thomas Arendsen Hein
Use python function instead of external 'cp' command when cloning repos....
r698 def clone(ui, source, dest=None, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """make a copy of an existing repository
Create a copy of an existing repository in a new directory.
If no destination directory name is specified, it defaults to the
basename of the source.
The location of the source is added to the new repository's
.hg/hgrc file, as the default to be used for future pulls.
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help urls` for valid source format details.
Matt Mackall
mention default branch in branch and clone help
r7942
Martin Geisler
commands: mark "ssh://" as inline literals in help texts
r9970 It is possible to specify an ``ssh://`` URL as the destination, but no
Matt Mackall
mention default branch in branch and clone help
r7942 .hg/hgrc and working directory will be created on the remote side.
Martin Geisler
Use hg role in help strings
r10973 Please see :hg:`help urls` for important details about ``ssh://`` URLs.
Matt Mackall
mention default branch in branch and clone help
r7942
Adrian Buehlmann
clone: add option -u/--updaterev
r9714 A set of changesets (tags, or branch names) to pull may be specified
by listing each changeset (tag, or branch name) with -r/--rev.
If -r/--rev is used, the cloned repository will contain only a subset
of the changesets of the source repository. Only the set of changesets
Wagner Bruna
clone: simplify help text
r9806 defined by all -r/--rev options (including all their ancestors)
will be pulled into the destination repository.
Adrian Buehlmann
clone: add option -u/--updaterev
r9714 No subsequent changesets (including subsequent tags) will be present
in the destination.
Using -r/--rev (or 'clone src#rev dest') implies --pull, even for
local source repositories.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 For efficiency, hardlinks are used for cloning whenever the source
Inaky Perez-Gonzalez
Expand clone help with hardlink information
r2762 and destination are on the same filesystem (note this applies only
timeless
commands: document and test hg clone update priority
r10637 to the repository data, not to the working directory). Some
Inaky Perez-Gonzalez
Expand clone help with hardlink information
r2762 filesystems, such as AFS, implement hardlinking incorrectly, but
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 do not report errors. In these cases, use the --pull option to
Inaky Perez-Gonzalez
Expand clone help with hardlink information
r2762 avoid hardlinking.
timeless
commands: document and test hg clone update priority
r10637 In some cases, you can clone repositories and the working directory
Martin Geisler
commands: wrap docstrings at 70 characters...
r9249 using full hardlinks with ::
Inaky Perez-Gonzalez
Expand clone help with hardlink information
r2762
$ cp -al REPO REPOCLONE
Martin Geisler
Change double spaces to single spaces in help texts.
r7983 This is the fastest way to clone, but it is not always safe. The
Bryan O'Sullivan
issue 1053: heavily qualify the "cp -al" advice for cloning
r6509 operation is not atomic (making sure REPO is not modified during
the operation is up to you) and you have to make sure your editor
Martin Geisler
Change double spaces to single spaces in help texts.
r7983 breaks hardlinks (Emacs and most Linux Kernel tools do so). Also,
Bryan O'Sullivan
issue 1053: heavily qualify the "cp -al" advice for cloning
r6509 this is not compatible with certain extensions that place their
metadata under the .hg directory, such as mq.
timeless
commands: document and test hg clone update priority
r10637
Mercurial will update the working directory to the first applicable
revision from this list:
Martin Geisler
commands: remove extra indentation from list in help text
r10645 a) null if -U or the source repository has no changesets
b) if -u . and the source repository is local, the first parent of
the source repository's working directory
c) the changeset specified with -u (if a branch name, this means the
latest head of that branch)
d) the changeset specified with -r
e) the tipmost head specified with -b
f) the tipmost head specified with the url#branch source syntax
g) the tipmost head of the default branch
h) tip
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Adrian Buehlmann
clone: add option -u/--updaterev
r9714 if opts.get('noupdate') and opts.get('updaterev'):
raise util.Abort(_("cannot specify both --noupdate and --updaterev"))
Matt Mackall
remoteui: move from cmdutil to hg
r11273 r = hg.clone(hg.remoteui(ui, opts), source, dest,
Matt Mackall
commands: initial audit of exit codes...
r11177 pull=opts.get('pull'),
stream=opts.get('uncompressed'),
rev=opts.get('rev'),
update=opts.get('updaterev') or not opts.get('noupdate'),
branch=opts.get('branch'))
return r is None
mpm@selenic.com
Whitespace cleanups...
r515
Bryan O'Sullivan
Adapt commit to use file matching code....
r813 def commit(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """commit the specified files or all outstanding changes
Martin Geisler
Change double spaces to single spaces in help texts.
r7983 Commit changes to the given files into the repository. Unlike a
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 centralized RCS, this operation is a local operation. See
:hg:`push` for a way to actively distribute your changes.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
Use hg role in help strings
r10973 If a list of files is omitted, all changes reported by :hg:`status`
mcmillen@cs.cmu.edu
Spelling fix: "commited" -> "committed"
r1995 will be committed.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Bryan O'Sullivan
commit: when committing the results of a merge, it's all or nothing...
r6385 If you are committing the result of a merge, do not provide any
timeless
Generally replace "file name" with "filename" in help and comments.
r8761 filenames or -I/-X filters.
Bryan O'Sullivan
commit: when committing the results of a merge, it's all or nothing...
r6385
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 If no commit message is specified, the configured editor is
started to prompt you for a message.
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help dates` for a list of formats valid for -d/--date.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if nothing changed.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
John Mulligan
branch closing: mark closed branches with a 'close' extra...
r7655 extra = {}
if opts.get('close_branch'):
Gilles Moris
commit: prevent closing non-head changesets
r11163 if repo['.'].node() not in repo.branchheads():
# The topo heads set is included in the branch heads set of the
# current branch, so it's sufficient to test branchheads
raise util.Abort(_('can only close branch heads'))
John Mulligan
branch closing: mark closed branches with a 'close' extra...
r7655 extra['close'] = 1
Matt Mackall
commit: move commit editor to cmdutil, pass as function
r8407 e = cmdutil.commiteditor
if opts.get('force_editor'):
e = cmdutil.commitforceeditor
Matt Mackall
match: stop passing files through commitfunc
r6600 def commitfunc(ui, repo, message, match, opts):
Matt Mackall
commit: drop the now-unused files parameter
r8706 return repo.commit(message, opts.get('user'), opts.get('date'), match,
editor=e, extra=extra)
Dirkjan Ochtman
warn about new heads on commit (issue842)
r6336
Matt Mackall
commit: note new branch heads rather than topological heads...
r11173 branch = repo[None].branch()
bheads = repo.branchheads(branch)
Alexis S. L. Carvalho
Avoid calling heads() twice on every hg commit....
r6369 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
if not node:
Matt Mackall
commit: lose some pointless 'nothing changed' messages...
r8995 ui.status(_("nothing changed\n"))
Matt Mackall
commands: initial audit of exit codes...
r11177 return 1
Matt Mackall
commit: note new branch heads rather than topological heads...
r11173
ctx = repo[node]
parents = ctx.parents()
Gilles Moris
commit: fix display of 'created new head' message (issue2186)...
r11317 if bheads and not [x for x in parents
if x.node() in bheads and x.branch() == branch]:
Dirkjan Ochtman
warn about new heads on commit (issue842)
r6336 ui.status(_('created new head\n'))
Gilles Moris
commit: fix display of 'created new head' message (issue2186)...
r11317 # The message is not printed for initial roots. For the other
# changesets, it is printed in the following situations:
#
# Par column: for the 2 parents with ...
# N: null or no parent
# B: parent is on another named branch
# C: parent is a regular non head changeset
# H: parent was a branch head of the current branch
# Msg column: whether we print "created new head" message
# In the following, it is assumed that there already exists some
# initial branch heads of the current branch, otherwise nothing is
# printed anyway.
#
# Par Msg Comment
# NN y additional topo root
#
# BN y additional branch root
# CN y additional topo head
# HN n usual case
#
# BB y weird additional branch root
# CB y branch merge
# HB n merge with named branch
#
# CC y additional head from merge
# CH n merge with a head
#
# HH n head merge: head count decreases
mpm@selenic.com
big heap of command clean-up work...
r245
Gilles Moris
commit: inform the commiter when resurrecting a closed changeset
r11164 if not opts.get('close_branch'):
for r in parents:
Robert Bauck Hamar
commands: only warn when reopening the workdir's branch...
r11515 if r.extra().get('close') and r.branch() == branch:
Gilles Moris
commit: inform the commiter when resurrecting a closed changeset
r11164 ui.status(_('reopening closed branch head %d\n') % r)
Gilles Moris
Have verbose and debug flag print the changeset rev and hash when committing....
r6935 if ui.debugflag:
Matt Mackall
commit: note new branch heads rather than topological heads...
r11173 ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx.hex()))
Gilles Moris
Have verbose and debug flag print the changeset rev and hash when committing....
r6935 elif ui.verbose:
Matt Mackall
commit: note new branch heads rather than topological heads...
r11173 ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
Gilles Moris
Have verbose and debug flag print the changeset rev and hash when committing....
r6935
Bryan O'Sullivan
Add rename/mv command....
r1253 def copy(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """mark files as copied for the next commit
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 Mark dest as having copies of source files. If dest is a
directory, copies are put in that directory. If dest is a file,
timeless
help: miscellaneous language fixes
r7807 the source must be a single file.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
By default, this command copies the contents of files as they
timeless
Improve English for help text of many core hg commands....
r8779 exist in the working directory. If invoked with -A/--after, the
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 operation is recorded, but no copying is performed.
timeless
help: miscellaneous language fixes
r7807 This command takes effect with the next commit. To undo a copy
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 before that, see :hg:`revert`.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if errors are encountered.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
repo locks: use True/False
r4914 wlock = repo.wlock(False)
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 try:
Matt Mackall
copy: handle rename internally...
r5610 return cmdutil.copy(ui, repo, pats, opts)
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 finally:
Ronny Pfannschmidt
switch lock releasing in the core from gc to explicit
r8109 wlock.release()
mpm@selenic.com
Add hg copy...
r363
Thomas Arendsen Hein
Make hg debugancestor accept -R by making it an optionalrepo command.
r6189 def debugancestor(ui, repo, *args):
mpm@selenic.com
Add debugancestor command
r1262 """find the ancestor revision of two revisions in a given index"""
Thomas Arendsen Hein
debugancestor: use *args instead of *opts, to not confuse with option dicts.
r6188 if len(args) == 3:
index, rev1, rev2 = args
Bryan O'Sullivan
debugancestor: make the index argument optional, defaulting to 00changelog.i
r6178 r = revlog.revlog(util.opener(os.getcwd(), audit=False), index)
Alexis S. L. Carvalho
debugancestor: use repo.lookup when no revlog was specified
r6253 lookup = r.lookup
Thomas Arendsen Hein
debugancestor: use *args instead of *opts, to not confuse with option dicts.
r6188 elif len(args) == 2:
Thomas Arendsen Hein
Make hg debugancestor accept -R by making it an optionalrepo command.
r6189 if not repo:
raise util.Abort(_("There is no Mercurial repository here "
"(.hg not found)"))
Thomas Arendsen Hein
debugancestor: use *args instead of *opts, to not confuse with option dicts.
r6188 rev1, rev2 = args
Bryan O'Sullivan
debugancestor: make the index argument optional, defaulting to 00changelog.i
r6178 r = repo.changelog
Alexis S. L. Carvalho
debugancestor: use repo.lookup when no revlog was specified
r6253 lookup = repo.lookup
Bryan O'Sullivan
debugancestor: make the index argument optional, defaulting to 00changelog.i
r6178 else:
raise util.Abort(_('either two or three arguments required'))
Alexis S. L. Carvalho
debugancestor: use repo.lookup when no revlog was specified
r6253 a = r.ancestor(lookup(rev1), lookup(rev2))
mpm@selenic.com
Add debugancestor command
r1262 ui.write("%d:%s\n" % (r.rev(a), hex(a)))
Peter Arrenbrecht
debugbuilddag: build a changelog dag from a concise description...
r11337 def debugbuilddag(ui, repo, text,
mergeable_file=False,
appended_file=False,
overwritten_file=False,
new_file=False):
"""builds a repo with a given dag from scratch in the current empty repo
Elements:
- "+n" is a linear run of n nodes based on the current default parent
- "." is a single node based on the current default parent
- "$" resets the default parent to null (implied at the start);
otherwise the default parent is always the last node created
- "<p" sets the default parent to the backref p
- "*p" is a fork at parent p, which is a backref
- "*p1/p2" is a merge of parents p1 and p2, which are backrefs
- "/p2" is a merge of the preceding node and p2
- ":tag" defines a local tag for the preceding node
- "@branch" sets the named branch for subsequent nodes
- "!command" runs the command using your shell
- "!!my command\\n" is like "!", but to the end of the line
- "#...\\n" is a comment up to the end of the line
Whitespace between the above elements is ignored.
A backref is either
- a number n, which references the node curr-n, where curr is the current
node, or
- the name of a local tag you placed earlier using ":tag", or
- empty to denote the default parent.
All string valued-elements are either strictly alphanumeric, or must
be enclosed in double quotes ("..."), with "\" as escape character.
Note that the --overwritten-file and --appended-file options imply the
use of "HGMERGE=internal:local" during DAG buildup.
"""
if not (mergeable_file or appended_file or overwritten_file or new_file):
Martin Geisler
commands: get rid of generic exception in debugbuilddag
r11342 raise util.Abort(_('need at least one of -m, -a, -o, -n'))
Peter Arrenbrecht
debugbuilddag: build a changelog dag from a concise description...
r11337
if len(repo.changelog) > 0:
Martin Geisler
commands: get rid of generic exception in debugbuilddag
r11342 raise util.Abort(_('repository is not empty'))
Peter Arrenbrecht
debugbuilddag: build a changelog dag from a concise description...
r11337
if overwritten_file or appended_file:
# we don't want to fail in merges during buildup
os.environ['HGMERGE'] = 'internal:local'
def writefile(fname, text, fmode="w"):
f = open(fname, fmode)
try:
f.write(text)
finally:
f.close()
if mergeable_file:
linesperrev = 2
# determine number of revs in DAG
n = 0
for type, data in dagparser.parsedag(text):
if type == 'n':
n += 1
# make a file with k lines per rev
writefile("mf", "\n".join(str(i) for i in xrange(0, n * linesperrev))
+ "\n")
at = -1
atbranch = 'default'
for type, data in dagparser.parsedag(text):
if type == 'n':
Martin Geisler
commands: format is a Python2.6 function
r11338 ui.status('node %s\n' % str(data))
Peter Arrenbrecht
debugbuilddag: build a changelog dag from a concise description...
r11337 id, ps = data
p1 = ps[0]
if p1 != at:
update(ui, repo, node=p1, clean=True)
at = p1
if repo.dirstate.branch() != atbranch:
branch(ui, repo, atbranch, force=True)
if len(ps) > 1:
p2 = ps[1]
merge(ui, repo, node=p2)
if mergeable_file:
f = open("mf", "r+")
try:
lines = f.read().split("\n")
lines[id * linesperrev] += " r%i" % id
f.seek(0)
f.write("\n".join(lines))
finally:
f.close()
if appended_file:
writefile("af", "r%i\n" % id, "a")
if overwritten_file:
writefile("of", "r%i\n" % id)
if new_file:
writefile("nf%i" % id, "r%i\n" % id)
commit(ui, repo, addremove=True, message="r%i" % id, date=(id, 0))
at = id
elif type == 'l':
id, name = data
ui.status('tag %s\n' % name)
tag(ui, repo, name, local=True)
elif type == 'a':
ui.status('branch %s\n' % data)
atbranch = data
elif type in 'cC':
r = util.system(data, cwd=repo.root)
if r:
desc, r = util.explain_exit(r)
raise util.Abort(_('%s command %s') % (data, desc))
Dirkjan Ochtman
add debugcommands command: an easy to parse command + option index
r7880 def debugcommands(ui, cmd='', *args):
Matt Mackall
commands: initial audit of exit codes...
r11177 """list all available commands and options"""
Matt Mackall
replace util.sort with sorted built-in...
r8209 for cmd, vals in sorted(table.iteritems()):
Dirkjan Ochtman
add debugcommands command: an easy to parse command + option index
r7880 cmd = cmd.split('|')[0].strip('^')
opts = ', '.join([i[1] for i in vals[1]])
ui.write('%s: %s\n' % (cmd, opts))
Alexis S. L. Carvalho
add --options to debugcomplete and change bash_completion to use it...
r2034 def debugcomplete(ui, cmd='', **opts):
Benoit Boissinot
new command debugcomplete...
r1887 """returns the completion list associated with the given command"""
Alexis S. L. Carvalho
add --options to debugcomplete and change bash_completion to use it...
r2034
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('options'):
Alexis S. L. Carvalho
add --options to debugcomplete and change bash_completion to use it...
r2034 options = []
otables = [globalopts]
if cmd:
Matt Mackall
findcmd: have dispatch look up strict flag
r7213 aliases, entry = cmdutil.findcmd(cmd, table, False)
Alexis S. L. Carvalho
add --options to debugcomplete and change bash_completion to use it...
r2034 otables.append(entry[1])
for t in otables:
for o in t:
Matt Mackall
debugcomplete: don't list deprecated options
r10958 if "(DEPRECATED)" in o[3]:
continue
Alexis S. L. Carvalho
add --options to debugcomplete and change bash_completion to use it...
r2034 if o[0]:
options.append('-%s' % o[0])
options.append('--%s' % o[1])
ui.write("%s\n" % "\n".join(options))
return
Brendan Cully
Make debugcomplete -v print aliases as well as commands
r7509 cmdlist = cmdutil.findpossible(cmd, table)
if ui.verbose:
cmdlist = [' '.join(c[0]) for c in cmdlist.values()]
Matt Mackall
replace util.sort with sorted built-in...
r8209 ui.write("%s\n" % "\n".join(sorted(cmdlist)))
Benoit Boissinot
new command debugcomplete...
r1887
Matt Mackall
add debugfsinfo to check fs capabilities
r5741 def debugfsinfo(ui, path = "."):
Matt Mackall
commands: initial audit of exit codes...
r11177 """show information detected about current filesystem"""
Alejandro Santos
compat: use open() instead of file() everywhere
r9031 open('.debugfsinfo', 'w').write('')
Matt Mackall
add debugfsinfo to check fs capabilities
r5741 ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no'))
ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no'))
Matt Mackall
rename checkfolding to checkcase
r6746 ui.write('case-sensitive: %s\n' % (util.checkcase('.debugfsinfo')
Matt Mackall
add debugfsinfo to check fs capabilities
r5741 and 'yes' or 'no'))
os.unlink('.debugfsinfo')
Matt Mackall
use repo[changeid] to get a changectx
r6747 def debugrebuildstate(ui, repo, rev="tip"):
Benoit Boissinot
add 'debugrebuildstate' to rebuild the dirstate from a given revision...
r1755 """rebuild the dirstate as it would look like for the given revision"""
Matt Mackall
use repo[changeid] to get a changectx
r6747 ctx = repo[rev]
Benoit Boissinot
fix typo in debugrebuildstate
r1760 wlock = repo.wlock()
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 try:
Matt Mackall
use repo[changeid] to get a changectx
r6747 repo.dirstate.rebuild(ctx.node(), ctx.manifest())
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 finally:
Ronny Pfannschmidt
switch lock releasing in the core from gc to explicit
r8109 wlock.release()
Benoit Boissinot
add 'debugrebuildstate' to rebuild the dirstate from a given revision...
r1755
mpm@selenic.com
A bunch of parsing/help updates...
r596 def debugcheckstate(ui, repo):
"""validate the correctness of the current dirstate"""
mpm@selenic.com
add dirstate debugging commands...
r460 parent1, parent2 = repo.dirstate.parents()
Matt Mackall
use repo[changeid] to get a changectx
r6747 m1 = repo[parent1].manifest()
m2 = repo[parent2].manifest()
mpm@selenic.com
add dirstate debugging commands...
r460 errors = 0
Matt Mackall
dirstate: add __contains__ and make __getitem__ more useful...
r4906 for f in repo.dirstate:
state = repo.dirstate[f]
mpm@selenic.com
add dirstate debugging commands...
r460 if state in "nr" and f not in m1:
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
mpm@selenic.com
add dirstate debugging commands...
r460 errors += 1
if state in "a" and f in m1:
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
mpm@selenic.com
add dirstate debugging commands...
r460 errors += 1
if state in "m" and f not in m1 and f not in m2:
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 ui.warn(_("%s in state %s, but not in either manifest\n") %
mpm@selenic.com
Remove all remaining print statements...
r582 (f, state))
mpm@selenic.com
add dirstate debugging commands...
r460 errors += 1
for f in m1:
Matt Mackall
dirstate: add __contains__ and make __getitem__ more useful...
r4906 state = repo.dirstate[f]
mpm@selenic.com
add dirstate debugging commands...
r460 if state not in "nrm":
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
mpm@selenic.com
add dirstate debugging commands...
r460 errors += 1
if errors:
Muli Ben-Yehuda
strictly adher to 80 chars per line
r1602 error = _(".hg/dirstate inconsistent with current parent's manifest")
raise util.Abort(error)
mpm@selenic.com
add dirstate debugging commands...
r460
Alexis S. L. Carvalho
add --untrusted to showconfig
r3553 def showconfig(ui, repo, *values, **opts):
Vadim Gelfer
debugconfig: allow to print by section and exact item name
r2410 """show combined config settings from all hgrc files
Martin Geisler
commands: expand "arg" -> "argument" in showconfig help strings...
r8664 With no arguments, print names and values of all config items.
With one argument of the form section.name, print just the value
of that config item.
With multiple arguments, print names and values of all config
items with matching section names.
Martin Geisler
commands: describe --debug in showconfig help
r8279
timeless
Improve English for help text of many core hg commands....
r8779 With --debug, the source (filename and line number) is printed
for each config item.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Martin Geisler
commands: describe --debug in showconfig help
r8279 """
Vadim Gelfer
debugconfig: allow to print by section and exact item name
r2410
Mads Kiilerich
showconfig: show rc paths with --debug
r11048 for f in util.rcpath():
ui.debug(_('read config from: %s\n') % f)
Alexis S. L. Carvalho
add --untrusted to showconfig
r3553 untrusted = bool(opts.get('untrusted'))
Vadim Gelfer
debugconfig: allow to print by section and exact item name
r2410 if values:
if len([v for v in values if '.' in v]) > 1:
raise util.Abort(_('only one config item permitted'))
Alexis S. L. Carvalho
add --untrusted to showconfig
r3553 for section, name, value in ui.walkconfig(untrusted=untrusted):
Vadim Gelfer
debugconfig: allow to print by section and exact item name
r2410 sectname = section + '.' + name
if values:
for v in values:
if v == section:
Matt Mackall
showconfig: show source file and line with --debug
r8182 ui.debug('%s: ' %
ui.configsource(section, name, untrusted))
Vadim Gelfer
debugconfig: allow to print by section and exact item name
r2410 ui.write('%s=%s\n' % (sectname, value))
elif v == sectname:
Matt Mackall
showconfig: show source file and line with --debug
r8182 ui.debug('%s: ' %
ui.configsource(section, name, untrusted))
Vadim Gelfer
debugconfig: allow to print by section and exact item name
r2410 ui.write(value, '\n')
else:
Matt Mackall
showconfig: show source file and line with --debug
r8182 ui.debug('%s: ' %
ui.configsource(section, name, untrusted))
Vadim Gelfer
debugconfig: allow to print by section and exact item name
r2410 ui.write('%s=%s\n' % (sectname, value))
Bryan O'Sullivan
Add commands.debugconfig....
r1028
Matt Mackall
pushkey: add debugpushkey command for testing
r11371 def debugpushkey(ui, repopath, namespace, *keyinfo):
'''access the pushkey key/value protocol
With two args, list the keys in the given namespace.
With five args, set a key to new if it currently is set to old.
Reports success or failure.
'''
target = hg.repository(ui, repopath)
if keyinfo:
key, old, new = keyinfo
r = target.pushkey(namespace, key, old, new)
ui.status(str(r) + '\n')
return not(r)
else:
for k, v in target.listkeys(namespace).iteritems():
ui.write("%s\t%s\n" % (k.encode('string-escape'),
v.encode('string-escape')))
Matt Mackall
revset: add a debugrevspec command
r11276 def debugrevspec(ui, repo, expr):
'''parse and apply a revision specification'''
if ui.verbose:
tree = revset.parse(expr)
ui.note(tree, "\n")
func = revset.match(expr)
for c in func(repo, range(len(repo))):
ui.write("%s\n" % c)
Matt Mackall
Add debugsetparents command
r1395 def debugsetparents(ui, repo, rev1, rev2=None):
TK Soh
minor fix on command help docstrings
r1470 """manually set the parents of the current working directory
Matt Mackall
Add debugsetparents command
r1395
This is useful for writing repository conversion tools, but should
be used with care.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Matt Mackall
Add debugsetparents command
r1395 """
if not rev2:
rev2 = hex(nullid)
Alexis S. L. Carvalho
debugsetparents: wlock the repo before updating the dirstate
r4247 wlock = repo.wlock()
try:
repo.dirstate.setparents(repo.lookup(rev1), repo.lookup(rev2))
finally:
Ronny Pfannschmidt
switch lock releasing in the core from gc to explicit
r8109 wlock.release()
Matt Mackall
Add debugsetparents command
r1395
Alexis S. L. Carvalho
debugstate: add --nodates...
r6296 def debugstate(ui, repo, nodates=None):
mpm@selenic.com
A bunch of parsing/help updates...
r596 """show the contents of the current dirstate"""
Alexis S. L. Carvalho
debugstate: add --nodates...
r6296 timestr = ""
showdate = not nodates
Matt Mackall
replace util.sort with sorted built-in...
r8209 for file_, ent in sorted(repo.dirstate._map.iteritems()):
Alexis S. L. Carvalho
debugstate: add --nodates...
r6296 if showdate:
if ent[3] == -1:
# Pad or slice to locale representation
Matt Mackall
many, many trivial check-code fixups
r10282 locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ",
time.localtime(0)))
Alexis S. L. Carvalho
debugstate: add --nodates...
r6296 timestr = 'unset'
Matt Mackall
many, many trivial check-code fixups
r10282 timestr = (timestr[:locale_len] +
' ' * (locale_len - len(timestr)))
Alexis S. L. Carvalho
debugstate: add --nodates...
r6296 else:
Matt Mackall
many, many trivial check-code fixups
r10282 timestr = time.strftime("%Y-%m-%d %H:%M:%S ",
time.localtime(ent[3]))
Bryan O'Sullivan
debugstate: print symlinks as 'lnk', not '777'
r5156 if ent[1] & 020000:
mode = 'lnk'
else:
mode = '%3o' % (ent[1] & 0777)
Alexis S. L. Carvalho
debugstate: add --nodates...
r6296 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
Benoit Boissinot
fix users of dirstate.copies broken by b1f10d3223c1
r3159 for f in repo.dirstate.copies():
ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
mpm@selenic.com
add dirstate debugging commands...
r460
Matt Mackall
subrepo: introduce basic state parsing
r8812 def debugsub(ui, repo, rev=None):
if rev == '':
rev = None
Matt Mackall
many, many trivial check-code fixups
r10282 for k, v in sorted(repo[rev].substate.items()):
Matt Mackall
subrepo: introduce basic state parsing
r8812 ui.write('path %s\n' % k)
ui.write(' source %s\n' % v[0])
ui.write(' revision %s\n' % v[1])
Peter Arrenbrecht
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text...
r11336 def debugdag(ui, repo, file_=None, *revs, **opts):
"""format the changelog or an index DAG as a concise textual description
If you pass a revlog index, the revlog's DAG is emitted. If you list
revision numbers, they get labelled in the output as rN.
Otherwise, the changelog DAG of the current repo is emitted.
"""
spaces = opts.get('spaces')
dots = opts.get('dots')
if file_:
rlog = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
revs = set((int(r) for r in revs))
def events():
for r in rlog:
yield 'n', (r, list(set(p for p in rlog.parentrevs(r) if p != -1)))
if r in revs:
yield 'l', (r, "r%i" % r)
elif repo:
cl = repo.changelog
tags = opts.get('tags')
branches = opts.get('branches')
if tags:
labels = {}
for l, n in repo.tags().items():
labels.setdefault(cl.rev(n), []).append(l)
def events():
b = "default"
for r in cl:
if branches:
newb = cl.read(cl.node(r))[5]['branch']
if newb != b:
yield 'a', newb
b = newb
yield 'n', (r, list(set(p for p in cl.parentrevs(r) if p != -1)))
if tags:
ls = labels.get(r)
if ls:
for l in ls:
yield 'l', (r, l)
else:
raise util.Abort(_('need repo for changelog dag'))
for line in dagparser.dagtextlines(events(),
addspaces=spaces,
wraplabels=True,
wrapannotations=True,
wrapnonlinear=dots,
usedots=dots,
maxlinewidth=70):
ui.write(line)
ui.write("\n")
mpm@selenic.com
Add debugdata for dumping revlog revision data
r1039 def debugdata(ui, file_, rev):
Matt Mackall
revlog: simplify revlog version handling...
r4258 """dump the contents of a data file revision"""
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_[:-2] + ".i")
Anupam Kapoor
Fix traceback during invalid rev identifier for debugdata
r1313 try:
ui.write(r.revision(r.lookup(rev)))
except KeyError:
Thomas Arendsen Hein
Never apply string formatting to generated errors with util.Abort....
r3072 raise util.Abort(_('invalid revision identifier %s') % rev)
mpm@selenic.com
Add debugdata for dumping revlog revision data
r1039
Matt Mackall
Add date matching support...
r3812 def debugdate(ui, date, range=None, **opts):
Matt Mackall
add debugdate command
r3805 """parse and display a date"""
Matt Mackall
Add date matching support...
r3812 if opts["extended"]:
d = util.parsedate(date, util.extendeddateformats)
else:
d = util.parsedate(date)
Matt Mackall
add debugdate command
r3805 ui.write("internal: %s %s\n" % d)
ui.write("standard: %s\n" % util.datestr(d))
Matt Mackall
Add date matching support...
r3812 if range:
m = util.matchdate(range)
ui.write("match: %s\n" % m(d[0]))
Matt Mackall
add debugdate command
r3805
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 def debugindex(ui, file_):
mpm@selenic.com
A bunch of parsing/help updates...
r596 """dump the contents of an index file"""
Matt Mackall
revlog: simplify revlog version handling...
r4258 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
Martin Geisler
commands: removed unnecessary string concatenation
r7737 ui.write(" rev offset length base linkrev"
mpm@selenic.com
Reformat debugindex output
r989 " nodeid p1 p2\n")
Matt Mackall
add __len__ and __iter__ methods to repo and revlog
r6750 for i in r:
mason@suse.com
Implement revlogng....
r2072 node = r.node(i)
Matt Mackall
debugindex: more robust for damaged indexes
r5311 try:
pp = r.parents(node)
except:
pp = [nullid, nullid]
mpm@selenic.com
Reformat debugindex output
r989 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
Matt Mackall
linkrev: take a revision number rather than a hash
r7361 i, r.start(i), r.length(i), r.base(i), r.linkrev(i),
mason@suse.com
Implement revlogng....
r2072 short(node), short(pp[0]), short(pp[1])))
mpm@selenic.com
migrate remaining commands...
r248
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 def debugindexdot(ui, file_):
timeless
Improve English for help text of many core hg commands....
r8779 """dump an index DAG as a graphviz dot file"""
Matt Mackall
revlog: simplify revlog version handling...
r4258 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
mpm@selenic.com
Remove all remaining print statements...
r582 ui.write("digraph G {\n")
Matt Mackall
add __len__ and __iter__ methods to repo and revlog
r6750 for i in r:
Samuel Masham
Update debugindexdot to work with RevlogNG.
r2287 node = r.node(i)
pp = r.parents(node)
ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
if pp[1] != nullid:
ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
mpm@selenic.com
Remove all remaining print statements...
r582 ui.write("}\n")
mpm@selenic.com
migrate remaining commands...
r248
Matt Mackall
Add debuginstall command to do basic install tests
r3844 def debuginstall(ui):
Matt Mackall
commands: initial audit of exit codes...
r11177 '''test Mercurial installation
Returns 0 on success.
'''
Matt Mackall
Add debuginstall command to do basic install tests
r3844
Matt Mackall
Make debuginstall actually attempt to use external patch and merge...
r3846 def writetemp(contents):
Thomas Arendsen Hein
Use a prefix for debuginstall tempfiles....
r4849 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
Matt Mackall
Make debuginstall actually attempt to use external patch and merge...
r3846 f = os.fdopen(fd, "wb")
f.write(contents)
f.close()
return name
Matt Mackall
Add debuginstall command to do basic install tests
r3844 problems = 0
# encoding
Matt Mackall
move encoding bits from util to encoding...
r7948 ui.status(_("Checking encoding (%s)...\n") % encoding.encoding)
Matt Mackall
Add debuginstall command to do basic install tests
r3844 try:
Matt Mackall
move encoding bits from util to encoding...
r7948 encoding.fromlocal("test")
Matt Mackall
Add debuginstall command to do basic install tests
r3844 except util.Abort, inst:
ui.write(" %s\n" % inst)
Matt Mackall
Add some remedies and a username check to debuginstall
r3848 ui.write(_(" (check that your locale is properly set)\n"))
Matt Mackall
Add debuginstall command to do basic install tests
r3844 problems += 1
# compiled modules
ui.status(_("Checking extensions...\n"))
try:
import bdiff, mpatch, base85
except Exception, inst:
ui.write(" %s\n" % inst)
Matt Mackall
Add some remedies and a username check to debuginstall
r3848 ui.write(_(" One or more extensions could not be found"))
ui.write(_(" (check that you compiled the extensions)\n"))
Matt Mackall
Add debuginstall command to do basic install tests
r3844 problems += 1
# templates
ui.status(_("Checking templates...\n"))
try:
import templater
Peter Arrenbrecht
cleanup: drop variables for unused return values...
r7874 templater.templater(templater.templatepath("map-cmdline.default"))
Matt Mackall
Add debuginstall command to do basic install tests
r3844 except Exception, inst:
ui.write(" %s\n" % inst)
Matt Mackall
Add some remedies and a username check to debuginstall
r3848 ui.write(_(" (templates seem to have been installed incorrectly)\n"))
Matt Mackall
Add debuginstall command to do basic install tests
r3844 problems += 1
# patch
ui.status(_("Checking patch...\n"))
Patrick Mezard
debuginstall: stop looking for patch utility, just test it
r5310 patchproblems = 0
a = "1\n2\n3\n4\n"
b = "1\n2\n3\ninsert\n4\n"
fa = writetemp(a)
Dustin Sallings
Use both the from and to name in mdiff.unidiff....
r5482 d = mdiff.unidiff(a, None, b, None, os.path.basename(fa),
os.path.basename(fa))
Patrick Mezard
debuginstall: stop looking for patch utility, just test it
r5310 fd = writetemp(d)
files = {}
try:
patch.patch(fd, ui, cwd=os.path.dirname(fa), files=files)
except util.Abort, e:
ui.write(_(" patch call failed:\n"))
ui.write(" " + str(e) + "\n")
patchproblems += 1
Matt Mackall
Make debuginstall actually attempt to use external patch and merge...
r3846 else:
Patrick Mezard
debuginstall: stop looking for patch utility, just test it
r5310 if list(files) != [os.path.basename(fa)]:
ui.write(_(" unexpected patch output!\n"))
patchproblems += 1
Alejandro Santos
compat: use open() instead of file() everywhere
r9031 a = open(fa).read()
Patrick Mezard
debuginstall: stop looking for patch utility, just test it
r5310 if a != b:
ui.write(_(" patch test failed!\n"))
patchproblems += 1
if patchproblems:
if ui.config('ui', 'patch'):
ui.write(_(" (Current patch tool may be incompatible with patch,"
" or misconfigured. Please check your .hgrc file)\n"))
Thomas Arendsen Hein
Removed trailing whitespace and tabs from python files
r4516 else:
Thomas Arendsen Hein
Removed tabs and trailing whitespace in python files
r5760 ui.write(_(" Internal patcher failure, please report this error"
Dirkjan Ochtman
change wiki/bts URLs to point to new hostname
r8936 " to http://mercurial.selenic.com/bts/\n"))
Patrick Mezard
debuginstall: stop looking for patch utility, just test it
r5310 problems += patchproblems
os.unlink(fa)
os.unlink(fd)
Matt Mackall
Add debuginstall command to do basic install tests
r3844
# editor
ui.status(_("Checking commit editor...\n"))
Osku Salerma
Use VISUAL in addition to EDITOR when choosing the editor to use.
r5660 editor = ui.geteditor()
Bryan O'Sullivan
Introduce find_exe. Use instead of find_in_path for programs....
r4488 cmdpath = util.find_exe(editor) or util.find_exe(editor.split()[0])
Matt Mackall
Add debuginstall command to do basic install tests
r3844 if not cmdpath:
Benoit Boissinot
debuginstall: fix a copy/paste error
r3855 if editor == 'vi':
Matt Mackall
Add debuginstall command to do basic install tests
r3844 ui.write(_(" No commit editor set and can't find vi in PATH\n"))
Matt Mackall
Add some remedies and a username check to debuginstall
r3848 ui.write(_(" (specify a commit editor in your .hgrc file)\n"))
Matt Mackall
Add debuginstall command to do basic install tests
r3844 else:
ui.write(_(" Can't find editor '%s' in PATH\n") % editor)
Matt Mackall
Add some remedies and a username check to debuginstall
r3848 ui.write(_(" (specify a commit editor in your .hgrc file)\n"))
Matt Mackall
Add debuginstall command to do basic install tests
r3844 problems += 1
Matt Mackall
Add some remedies and a username check to debuginstall
r3848 # check username
ui.status(_("Checking username...\n"))
Martin Geisler
commands: call ui.username carefully in debuginstall...
r9734 try:
user = ui.username()
except util.Abort, e:
ui.write(" %s\n" % e)
Matt Mackall
Add some remedies and a username check to debuginstall
r3848 ui.write(_(" (specify a username in your .hgrc file)\n"))
Martin Geisler
commands: call ui.username carefully in debuginstall...
r9734 problems += 1
Matt Mackall
Add some remedies and a username check to debuginstall
r3848
Matt Mackall
Add debuginstall command to do basic install tests
r3844 if not problems:
ui.status(_("No problems detected\n"))
else:
ui.write(_("%s problems detected,"
" please check your install!\n") % problems)
return problems
Matt Mackall
refactor debugrenamed
r3652 def debugrename(ui, repo, file1, *pats, **opts):
bos@serpentine.internal.keyresearch.com
Add doc string for debugrename.
r1194 """dump rename information"""
Matt Mackall
refactor debugrenamed
r3652
Matt Mackall
make debugrename work on p1, not tip
r6748 ctx = repo[opts.get('rev')]
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579 m = cmdutil.match(repo, (file1,) + pats, opts)
Matt Mackall
context: add walk method
r6764 for abs in ctx.walk(m):
fctx = ctx[abs]
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579 o = fctx.filelog().renamed(fctx.filenode())
Matt Mackall
walk: remove rel and exact returns
r6584 rel = m.rel(abs)
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579 if o:
ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1])))
Matt Mackall
refactor debugrenamed
r3652 else:
ui.write(_("%s not renamed\n") % rel)
mpm@selenic.com
Add some rename debugging support
r1116
Bryan O'Sullivan
Clean up walk and changes code to use normalised names properly....
r820 def debugwalk(ui, repo, *pats, **opts):
Thomas Arendsen Hein
Added missing doc strings for two new debug commmands.
r1053 """show how files match on given patterns"""
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579 m = cmdutil.match(repo, pats, opts)
Matt Mackall
walk: remove cmdutil.walk
r6585 items = list(repo.walk(m))
Thomas Arendsen Hein
Cleanups to commands.py
r1065 if not items:
return
Matt Mackall
walk: return a single value
r6586 fmt = 'f %%-%ds %%-%ds %%s' % (
max([len(abs) for abs in items]),
max([len(m.rel(abs)) for abs in items]))
for abs in items:
line = fmt % (abs, m.rel(abs), m.exact(abs) and 'exact' or '')
Thomas Arendsen Hein
Make debugwalk strip trailing spaces and remove these from test-walk.out
r1309 ui.write("%s\n" % line.rstrip())
Bryan O'Sullivan
Clean up walk and changes code to use normalised names properly....
r820
Bryan O'Sullivan
Convert diff command over to using walk code.
r732 def diff(ui, repo, *pats, **opts):
Benoit Boissinot
make all commands be repo-wide by default...
r1568 """diff repository (or selected files)
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Show differences between revisions for the specified files.
Differences between files are shown using the unified diff format.
Matt Mackall
Add notes about diff/merge asymmetry to export, diff, and log
r3822 NOTE: diff may generate unexpected results for merges, as it will
default to comparing against the working directory's first parent
changeset if no revisions are specified.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 When two revision arguments are given, then changes are shown
between those revisions. If only one revision is specified then
that revision is compared to the working directory, and, when no
revisions are specified, the working directory files are compared
to its parent.
timeless
commands: correct diff -c explanation
r10527 Alternatively you can specify -c/--change with a revision to see
the changes in that changeset relative to its first parent.
timeless
commands: mention diff -c
r10520
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 Without the -a/--text option, diff will avoid generating diffs of
files it detects as binary. With -a, diff will generate a diff
anyway, probably with undesirable results.
Use the -g/--git option to generate diffs in the git extended diff
Martin Geisler
Use hg role in help strings
r10973 format. For more information, read :hg:`help diffs`.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Stepan Koltsov
diff: add --change option to display single changeset diff (issue1420)
r7628
revs = opts.get('rev')
change = opts.get('change')
Brodie Rao
diff: add --stat for diffstat output...
r9640 stat = opts.get('stat')
Martin Geisler
diff: change --inverse to --reverse...
r9857 reverse = opts.get('reverse')
Stepan Koltsov
diff: add --change option to display single changeset diff (issue1420)
r7628
if revs and change:
msg = _('cannot specify --rev and --change at the same time')
raise util.Abort(msg)
elif change:
node2 = repo.lookup(change)
node1 = repo[node2].parents()[0].node()
else:
node1, node2 = cmdutil.revpair(repo, revs)
mpm@selenic.com
big heap of command clean-up work...
r245
Martin Geisler
diff: change --inverse to --reverse...
r9857 if reverse:
Yannick Gingras
diff: add --inverse option...
r9725 node1, node2 = node2, node1
Brodie Rao
diffstat: with --git, mark binary files with Bin...
r9642 diffopts = patch.diffopts(ui, opts)
Matt Mackall
walk: remove remaining users of cmdutils.matchpats
r6582 m = cmdutil.match(repo, pats, opts)
Yuya Nishihara
commands: refactor diff --stat and qdiff --stat...
r11050 cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat)
Thomas Arendsen Hein
Show revisions in diffs like CVS, based on a patch from Goffredo Baroncelli....
r396
mpm@selenic.com
[PATCH] New export patch...
r580 def export(ui, repo, *changesets, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """dump the header and diffs for one or more changesets
Print the changeset header and diffs for one or more revisions.
Steve Losh
commands: fix the list of changeset header information in 'hg help export'
r10334 The information shown in the changeset header is: author, date,
Steve Losh
commands: fix more changeset header information in 'hg help export'
r10335 branch name (if non-default), changeset hash, parent(s) and commit
comment.
Matt Mackall
Add notes about diff/merge asymmetry to export, diff, and log
r3822
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 NOTE: export may generate unexpected diff output for merge
changesets, as it will compare the merge changeset against its
first parent only.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Output may be to a file, in which case the name of the file is
Martin Geisler
commands: use field lists instead of literal blocks in docstrings...
r9892 given using a format string. The formatting rules are as follows:
:``%%``: literal "%" character
:``%H``: changeset hash (40 bytes of hexadecimal)
:``%N``: number of patches being generated
:``%R``: changeset revision number
:``%b``: basename of the exporting repository
:``%h``: short-form changeset hash (12 bytes of hexadecimal)
:``%n``: zero-padded sequence number, starting at 1
:``%r``: zero-padded changeset revision number
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 Without the -a/--text option, export will avoid generating diffs
of files it detects as binary. With -a, export will generate a
diff anyway, probably with undesirable results.
Use the -g/--git option to generate diffs in the git extended diff
Martin Geisler
Use hg role in help strings
r10973 format. See :hg:`help diffs` for more information.
Dirkjan Ochtman
help: commands supporting --git point to the gitdiffs topic (issue1352)
r7307
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 With the --switch-parent option, the diff will be against the
second parent. It can be useful to review a merge.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Alexander Solovyov
commands.export: accept -r option as revision specification...
r10015 changesets += tuple(opts.get('rev', []))
shaleh@speakeasy.net
check export options for changeset before running...
r610 if not changesets:
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 raise util.Abort(_("export requires at least one changeset"))
Thomas Arendsen Hein
Removed unused ui parameter from revpair/revrange and fix its users.
r3707 revs = cmdutil.revrange(repo, changesets)
Vadim Gelfer
refactor text diff/patch code....
r2874 if len(revs) > 1:
ui.note(_('exporting patches:\n'))
else:
ui.note(_('exporting patch:\n'))
Benoit Boissinot
patch/diff: move patch.export() to cmdutil.export()...
r10611 cmdutil.export(repo, revs, template=opts.get('output'),
Alexander Solovyov
commands: optional options where possible...
r7131 switch_parent=opts.get('switch_parent'),
Matt Mackall
Move ui.diffopts to patch.diffopts where it belongs
r2888 opts=patch.diffopts(ui, opts))
mpm@selenic.com
Migrate rawcommit, import, export, history, and merge...
r246
Steve Losh
Add a forget command for easily untracking files....
r8902 def forget(ui, repo, *pats, **opts):
"""forget the specified files on the next commit
Mark the specified files so they will no longer be tracked
after the next commit.
This only removes files from the current branch, not from the
entire project history, and it does not delete them from the
working directory.
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 To undo a forget before the next commit, see :hg:`add`.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Steve Losh
Add a forget command for easily untracking files....
r8902 """
if not pats:
raise util.Abort(_('no files specified'))
m = cmdutil.match(repo, pats, opts)
s = repo.status(match=m, clean=True)
forget = sorted(s[0] + s[1] + s[3] + s[6])
Matt Mackall
commands: initial audit of exit codes...
r11177 errs = 0
Steve Losh
Add a forget command for easily untracking files....
r8902
for f in m.files():
if f not in repo.dirstate and not os.path.isdir(m.rel(f)):
ui.warn(_('not removing %s: file is already untracked\n')
% m.rel(f))
Matt Mackall
commands: initial audit of exit codes...
r11177 errs = 1
Steve Losh
Add a forget command for easily untracking files....
r8902
for f in forget:
if ui.verbose or not m.exact(f):
ui.status(_('removing %s\n') % m.rel(f))
Dirkjan Ochtman
move working dir/dirstate methods from localrepo to workingctx
r11303 repo[None].remove(forget, unlink=False)
Matt Mackall
commands: initial audit of exit codes...
r11177 return errs
Steve Losh
Add a forget command for easily untracking files....
r8902
Thomas Arendsen Hein
Remove some options from 'hg grep':...
r1108 def grep(ui, repo, pattern, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """search for a pattern in specified files and revisions
Search revisions of files for a regular expression.
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 This command behaves differently than Unix grep. It only accepts
Python/Perl regexps. It searches repository history, not the
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 working directory. It always prints the revision number in which a
match appears.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
By default, grep only prints output for the first revision of a
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 file in which it finds a match. To get it to print every revision
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 that contains a change in match status ("-" for a match that
becomes a non-match, or "+" for a non-match that becomes a match),
use the --all flag.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 if a match is found, 1 otherwise.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Bryan O'Sullivan
Add grep command....
r1057 reflags = 0
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('ignore_case'):
Thomas Arendsen Hein
Cleanups to commands.py
r1065 reflags |= re.I
Giorgos Keramidas
hg grep: handle re.compile errors & update tests/test-grep
r4877 try:
regexp = re.compile(pattern, reflags)
except Exception, inst:
Thomas Arendsen Hein
Remove trailing ! from two error messages as this was confusing.
r6057 ui.warn(_("grep: invalid match pattern: %s\n") % inst)
Matt Mackall
commands: initial audit of exit codes...
r11177 return 1
bos@serpentine.internal.keyresearch.com
grep: extend functionality, add man page entry, add unit test....
r1146 sep, eol = ':', '\n'
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('print0'):
bos@serpentine.internal.keyresearch.com
grep: extend functionality, add man page entry, add unit test....
r1146 sep = eol = '\0'
Bryan O'Sullivan
Add grep command....
r1057
Matt Mackall
fix memory usage of revlog caches by limiting cache size [issue1639]
r9097 getfile = util.lrucachefunc(repo.file)
Bryan O'Sullivan
Add grep command....
r1057
def matchlines(body):
bos@serpentine.internal.keyresearch.com
grep: speed up matching, and only return one match per line.
r1059 begin = 0
linenum = 0
while True:
match = regexp.search(body, begin)
Thomas Arendsen Hein
Cleanups to commands.py
r1065 if not match:
break
bos@serpentine.internal.keyresearch.com
grep: speed up matching, and only return one match per line.
r1059 mstart, mend = match.span()
linenum += body.count('\n', begin, mstart) + 1
lstart = body.rfind('\n', begin, mstart) + 1 or begin
Matt Mackall
grep: avoid infinite loop when trailing newline is missing
r7230 begin = body.find('\n', mend) + 1 or len(body)
lend = begin - 1
bos@serpentine.internal.keyresearch.com
grep: speed up matching, and only return one match per line.
r1059 yield linenum, mstart - lstart, mend - lstart, body[lstart:lend]
Bryan O'Sullivan
Add grep command....
r1057
Eric Hopper
Convert all classes to new-style classes by deriving them from object.
r1559 class linestate(object):
Bryan O'Sullivan
Add grep command....
r1057 def __init__(self, line, linenum, colstart, colend):
self.line = line
self.linenum = linenum
self.colstart = colstart
self.colend = colend
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869
Paul Moore
python 2.6 compatibility: add __hash__ to classes that have __eq__
r6469 def __hash__(self):
return hash((self.linenum, self.line))
Thomas Arendsen Hein
Cleanups to commands.py
r1065 def __eq__(self, other):
return self.line == other.line
Bryan O'Sullivan
Add grep command....
r1057
matches = {}
Brendan Cully
grep: add --follow support.
r2870 copies = {}
Bryan O'Sullivan
Add grep command....
r1057 def grepbody(fn, rev, body):
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 matches[rev].setdefault(fn, [])
Bryan O'Sullivan
Add grep command....
r1057 m = matches[rev][fn]
for lnum, cstart, cend, line in matchlines(body):
s = linestate(line, lnum, cstart, cend)
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 m.append(s)
def difflinestates(a, b):
sm = difflib.SequenceMatcher(None, a, b)
for tag, alo, ahi, blo, bhi in sm.get_opcodes():
if tag == 'insert':
Benoit Boissinot
use xrange instead of range
r3472 for i in xrange(blo, bhi):
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 yield ('+', b[i])
elif tag == 'delete':
Benoit Boissinot
use xrange instead of range
r3472 for i in xrange(alo, ahi):
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 yield ('-', a[i])
elif tag == 'replace':
Benoit Boissinot
use xrange instead of range
r3472 for i in xrange(alo, ahi):
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 yield ('-', a[i])
Benoit Boissinot
use xrange instead of range
r3472 for i in xrange(blo, bhi):
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 yield ('+', b[i])
Matt Mackall
walkchangerevs: internalize ctx caching
r9655 def display(fn, ctx, pstates, states):
rev = ctx.rev()
Thomas Arendsen Hein
Make annotae/grep print short dates with -q/--quiet....
r6134 datefunc = ui.quiet and util.shortdate or util.datestr
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 found = False
bos@serpentine.internal.keyresearch.com
grep: extend functionality, add man page entry, add unit test....
r1146 filerevmatches = {}
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('all'):
FUJIWARA Katsunori
compare grep result between target and its parent...
r8849 iter = difflinestates(pstates, states)
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 else:
FUJIWARA Katsunori
compare grep result between target and its parent...
r8849 iter = [('', l) for l in states]
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 for change, l in iter:
Matt Mackall
walkchangerevs: internalize ctx caching
r9655 cols = [fn, str(rev)]
Brodie Rao
grep: make use of output labeling
r10816 before, match, after = None, None, None
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('line_number'):
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 cols.append(str(l.linenum))
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('all'):
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 cols.append(change)
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('user'):
Matt Mackall
walkchangerevs: internalize ctx caching
r9655 cols.append(ui.shortuser(ctx.user()))
Thomas Arendsen Hein
Add hg grep -d/--date to list the commit date of matched revisions....
r6133 if opts.get('date'):
Matt Mackall
walkchangerevs: internalize ctx caching
r9655 cols.append(datefunc(ctx.date()))
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('files_with_matches'):
Matt Mackall
walkchangerevs: internalize ctx caching
r9655 c = (fn, rev)
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 if c in filerevmatches:
continue
bos@serpentine.internal.keyresearch.com
grep: extend functionality, add man page entry, add unit test....
r1146 filerevmatches[c] = 1
else:
Brodie Rao
grep: make use of output labeling
r10816 before = l.line[:l.colstart]
match = l.line[l.colstart:l.colend]
after = l.line[l.colend:]
ui.write(sep.join(cols))
if before is not None:
ui.write(sep + before)
ui.write(match, label='grep.match')
ui.write(after)
ui.write(eol)
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 found = True
return found
Bryan O'Sullivan
Add grep command....
r1057
Bryan O'Sullivan
grep: change default to printing first matching rev....
r1145 skip = {}
FUJIWARA Katsunori
compare grep result between target and its parent...
r8849 revfiles = {}
Matt Mackall
walkchangerevs: pull out matchfn...
r9652 matchfn = cmdutil.match(repo, pats, opts)
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 found = False
Brendan Cully
grep: add --follow support.
r2870 follow = opts.get('follow')
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662
def prep(ctx, fns):
rev = ctx.rev()
pctx = ctx.parents()[0]
parent = pctx.rev()
matches.setdefault(rev, {})
matches.setdefault(parent, {})
files = revfiles.setdefault(rev, [])
for fn in fns:
flog = getfile(fn)
try:
fnode = ctx.filenode(fn)
except error.LookupError:
continue
copied = flog.renamed(fnode)
copy = follow and copied and copied[0]
if copy:
copies.setdefault(rev, {})[fn] = copy
if fn in skip:
if copy:
skip[copy] = True
continue
files.append(fn)
if fn not in matches[rev]:
grepbody(fn, rev, flog.read(fnode))
pfn = copy or fn
if pfn not in matches[parent]:
Bryan O'Sullivan
Add grep command....
r1057 try:
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 fnode = pctx.filenode(pfn)
grepbody(pfn, parent, flog.read(fnode))
Matt Mackall
errors: move revlog errors...
r7633 except error.LookupError:
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 pass
Matt Mackall
walkchangerevs: drop ui arg
r9665 for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep):
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 rev = ctx.rev()
parent = ctx.parents()[0].rev()
for fn in sorted(revfiles.get(rev, [])):
states = matches[rev][fn]
copy = copies.get(rev, {}).get(fn)
if fn in skip:
FUJIWARA Katsunori
compare grep result between target and its parent...
r8849 if copy:
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 skip[copy] = True
continue
pstates = matches.get(parent, {}).get(copy or fn, [])
if pstates or states:
r = display(fn, ctx, pstates, states)
found = found or r
if r and not opts.get('all'):
skip[fn] = True
FUJIWARA Katsunori
compare grep result between target and its parent...
r8849 if copy:
skip[copy] = True
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 del matches[rev]
del revfiles[rev]
Bryan O'Sullivan
Add grep command....
r1057
Matt Mackall
commands: initial audit of exit codes...
r11177 return not found
Eric Hopper
Add option to heads to show only heads for current branch.
r4648 def heads(ui, repo, *branchrevs, **opts):
"""show current repository heads or show branch heads
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 With no arguments, show all repository branch heads.
Eric Hopper
Add option to heads to show only heads for current branch.
r4648
Greg Ward
commands: tweak help for 'heads'....
r9502 Repository "heads" are changesets with no child changesets. They are
where development generally takes place and are the usual targets
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 for update and merge operations. Branch heads are changesets that have
no child changeset on the same branch.
If one or more REVs are given, only branch heads on the branches
associated with the specified changesets are shown.
Greg Ward
commands: tweak help for 'heads'....
r9502
If -c/--closed is specified, also show branch heads marked closed
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 (see :hg:`commit --close-branch`).
Greg Ward
commands: tweak help for 'heads'....
r9502
If STARTREV is specified, only those heads that are descendants of
STARTREV will be displayed.
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350
If -t/--topo is specified, named branch mechanics will be ignored and only
changesets without children will be shown.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 if matching heads are found, 1 if not.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Dirkjan Ochtman
commands: simplify heads a little bit before I start hacking it up
r10328
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('rev'):
Eric Hopper
Add option to heads to show only heads for current branch.
r4648 start = repo.lookup(opts['rev'])
else:
start = None
Dirkjan Ochtman
commands: simplify heads a little bit before I start hacking it up
r10328
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 if opts.get('topo'):
heads = [repo[h] for h in repo.heads(start)]
Benoit Boissinot
add a -r/--rev option to heads to show only heads descendant from rev
r1550 else:
Dirkjan Ochtman
commands: externalize branchheads so we can do it for all branches at once
r10348 heads = []
for b, ls in repo.branchmap().iteritems():
if start is None:
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 heads += [repo[h] for h in ls]
Dirkjan Ochtman
commands: externalize branchheads so we can do it for all branches at once
r10348 continue
startrev = repo.changelog.rev(start)
descendants = set(repo.changelog.descendants(startrev))
descendants.add(startrev)
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 rev = repo.changelog.rev
heads += [repo[h] for h in ls if rev(h) in descendants]
if branchrevs:
decode, encode = encoding.fromlocal, encoding.tolocal
branches = set(repo[decode(br)].branch() for br in branchrevs)
heads = [h for h in heads if h.branch() in branches]
Dirkjan Ochtman
commands: simplify heads a little bit before I start hacking it up
r10328
Dirkjan Ochtman
commands: actually implement --closed for topological heads
r10349 if not opts.get('closed'):
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 heads = [h for h in heads if not h.extra().get('close')]
Dirkjan Ochtman
commands: actually implement --closed for topological heads
r10349
if opts.get('active') and branchrevs:
dagheads = repo.heads(start)
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 heads = [h for h in heads if h.node() in dagheads]
Dirkjan Ochtman
commands: actually implement --closed for topological heads
r10349
if branchrevs:
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 haveheads = set(h.branch() for h in heads)
Dirkjan Ochtman
commands: don't do too much work for error messages
r10346 if branches - haveheads:
headless = ', '.join(encode(b) for b in branches - haveheads)
msg = _('no open branch heads found on branches %s')
if opts.get('rev'):
msg += _(' (started at %s)' % opts['rev'])
ui.warn((msg + '\n') % headless)
Eric Hopper
Add option to heads to show only heads for current branch.
r4648 if not heads:
return 1
Dirkjan Ochtman
commands: simplify heads a little bit before I start hacking it up
r10328
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 heads = sorted(heads, key=lambda x: -x.rev())
Matt Mackall
templates: move changeset templating bits to cmdutils
r3643 displayer = cmdutil.show_changeset(ui, repo, opts)
Dirkjan Ochtman
commands: always order heads recent to oldest
r10331 for ctx in heads:
displayer.show(ctx)
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer.close()
mpm@selenic.com
Beginning of multi-head support...
r221
Brodie Rao
dispatch: provide help for disabled extensions and commands...
r10364 def help_(ui, name=None, with_version=False, unknowncmd=False):
Matt Mackall
help: update help...
r7210 """show help for a given topic or a help overview
Matt Mackall
alphabetize help_ in commands
r3655
timeless
Improve English for help text of many core hg commands....
r8779 With no arguments, print a list of commands with short help messages.
Matt Mackall
alphabetize help_ in commands
r3655
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Given a topic, extension, or command name, print help for that
Matt Mackall
commands: initial audit of exit codes...
r11177 topic.
Returns 0 if successful.
"""
Matt Mackall
alphabetize help_ in commands
r3655 option_lists = []
Martin Geisler
commands: use minirst parser when displaying help
r9157 textwidth = util.termwidth() - 2
Matt Mackall
alphabetize help_ in commands
r3655
Alexis S. L. Carvalho
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output...
r4315 def addglobalopts(aliases):
if ui.verbose:
option_lists.append((_("global options:"), globalopts))
if name == 'shortlist':
option_lists.append((_('use "hg help" for the full list '
'of commands'), ()))
else:
if name == 'shortlist':
msg = _('use "hg help" for the full list of commands '
'or "hg -v" for details')
elif aliases:
msg = _('use "hg -v help%s" to show aliases and '
'global options') % (name and " " + name or "")
else:
msg = _('use "hg -v help %s" to show global options') % name
option_lists.append((msg, ()))
Matt Mackall
alphabetize help_ in commands
r3655 def helpcmd(name):
if with_version:
version_(ui)
ui.write('\n')
Johannes Stezenbach
help: enable listing of a subset of the command list...
r6652
try:
Brodie Rao
dispatch: provide help for disabled extensions and commands...
r10364 aliases, entry = cmdutil.findcmd(name, table, strict=unknowncmd)
Matt Mackall
error: move UnknownCommand and AmbiguousCommand
r7643 except error.AmbiguousCommand, inst:
Alejandro Santos
compat: don't reference an exception var inside a lambda
r9035 # py3k fix: except vars can't be used outside the scope of the
# except block, nor can be used inside a lambda. python issue4617
prefix = inst.args[0]
select = lambda c: c.lstrip('^').startswith(prefix)
Johannes Stezenbach
help: enable listing of a subset of the command list...
r6652 helplist(_('list of commands:\n\n'), select)
return
Brodie Rao
help: don't display bogus help messages for invalid aliases
r10021 # check if it's an invalid alias and display its error if it is
if getattr(entry[0], 'badalias', False):
Brodie Rao
dispatch: provide help for disabled extensions and commands...
r10364 if not unknowncmd:
entry[0](ui)
Brodie Rao
help: don't display bogus help messages for invalid aliases
r10021 return
Matt Mackall
alphabetize help_ in commands
r3655 # synopsis
Henri Wiechers
commands: minor refactoring...
r9901 if len(entry) > 2:
if entry[2].startswith('hg'):
ui.write("%s\n" % entry[2])
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 else:
Henri Wiechers
commands: minor refactoring...
r9901 ui.write('hg %s %s\n' % (aliases[0], entry[2]))
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 else:
ui.write('hg %s\n' % aliases[0])
Thomas Arendsen Hein
Move aliases section in help below synopsis (issue362)...
r5783
# aliases
if not ui.quiet and len(aliases) > 1:
ui.write(_("\naliases: %s\n") % ', '.join(aliases[1:]))
Matt Mackall
alphabetize help_ in commands
r3655
# description
Henri Wiechers
commands: minor refactoring...
r9901 doc = gettext(entry[0].__doc__)
Matt Mackall
alphabetize help_ in commands
r3655 if not doc:
Martin Geisler
lowercase help output...
r7598 doc = _("(no help text available)")
Yuya Nishihara
alias: fixes exception when displaying translated help text...
r10564 if hasattr(entry[0], 'definition'): # aliased command
Steve Losh
dispatch: add shell aliases...
r11524 if entry[0].definition.startswith('!'): # shell alias
doc = _('shell alias for::\n\n %s') % entry[0].definition[1:]
else:
doc = _('alias for: hg %s\n\n%s') % (entry[0].definition, doc)
Matt Mackall
alphabetize help_ in commands
r3655 if ui.quiet:
Nicolas Dumazet
for calls expecting bool args, pass bool instead of int...
r9136 doc = doc.splitlines()[0]
Martin Geisler
commands: support verbose help
r10445 keep = ui.verbose and ['verbose'] or []
formatted, pruned = minirst.format(doc, textwidth, keep=keep)
ui.write("\n%s\n" % formatted)
if pruned:
ui.write(_('\nuse "hg -v help %s" to show verbose help\n') % name)
Matt Mackall
alphabetize help_ in commands
r3655
if not ui.quiet:
# options
Henri Wiechers
commands: minor refactoring...
r9901 if entry[1]:
option_lists.append((_("options:\n"), entry[1]))
Alexis S. L. Carvalho
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output...
r4315
addglobalopts(False)
Matt Mackall
alphabetize help_ in commands
r3655
Alexis S. L. Carvalho
help: avoid traceback if an extension has only debug commands
r4950 def helplist(header, select=None):
Matt Mackall
alphabetize help_ in commands
r3655 h = {}
cmds = {}
Dirkjan Ochtman
use dict.iteritems() rather than dict.items()...
r7622 for c, e in table.iteritems():
Matt Mackall
alphabetize help_ in commands
r3655 f = c.split("|", 1)[0]
if select and not select(f):
continue
Dirkjan Ochtman
help: show extension commands in short list, separate extension list in help...
r7197 if (not select and name != 'shortlist' and
e[0].__module__ != __name__):
Dirkjan Ochtman
remove extension commands from global help
r7126 continue
Matt Mackall
alphabetize help_ in commands
r3655 if name == "shortlist" and not f.startswith("^"):
continue
f = f.lstrip("^")
if not ui.debugflag and f.startswith("debug"):
continue
Dan Villiom Podlaski Christiansen
commands: hide deprecated commands....
r9128 doc = e[0].__doc__
if doc and 'DEPRECATED' in doc and not ui.verbose:
continue
doc = gettext(doc)
Matt Mackall
alphabetize help_ in commands
r3655 if not doc:
Martin Geisler
lowercase help output...
r7598 doc = _("(no help text available)")
Nicolas Dumazet
for calls expecting bool args, pass bool instead of int...
r9136 h[f] = doc.splitlines()[0].rstrip()
Matt Mackall
alphabetize help_ in commands
r3655 cmds[f] = c.lstrip("^")
Alexis S. L. Carvalho
help: avoid traceback if an extension has only debug commands
r4950 if not h:
ui.status(_('no commands defined\n'))
return
ui.status(header)
Matt Mackall
replace util.sort with sorted built-in...
r8209 fns = sorted(h)
Matt Mackall
alphabetize help_ in commands
r3655 m = max(map(len, fns))
for f in fns:
if ui.verbose:
commands = cmds[f].replace("|",", ")
ui.write(" %s:\n %s\n"%(commands, h[f]))
else:
FUJIWARA Katsunori
replace Python standard textwrap by MBCS sensitive one for i18n text...
r11297 ui.write('%s\n' % (util.wrap(h[f],
initindent=' %-*s ' % (m, f),
hangindent=' ' * (m + 4))))
Matt Mackall
alphabetize help_ in commands
r3655
Alexis S. L. Carvalho
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output...
r4315 if not ui.quiet:
addglobalopts(True)
Matt Mackall
Add basic support for help topics and a dates topic
r3795 def helptopic(name):
Martin Geisler
restructure helptable...
r7012 for names, header, doc in help.helptable:
if name in names:
break
else:
Matt Mackall
error: move UnknownCommand and AmbiguousCommand
r7643 raise error.UnknownCommand(name)
Matt Mackall
Add basic support for help topics and a dates topic
r3795
# description
if not doc:
Martin Geisler
lowercase help output...
r7598 doc = _("(no help text available)")
Dirkjan Ochtman
some modernization cleanups, forward compatibility
r8366 if hasattr(doc, '__call__'):
Matt Mackall
Allow topics to be callables
r3796 doc = doc()
Matt Mackall
Add basic support for help topics and a dates topic
r3795
Martin Geisler
commands: use minirst parser when displaying help
r9157 ui.write("%s\n\n" % header)
Martin Geisler
help: un-indent help topics...
r9540 ui.write("%s\n" % minirst.format(doc, textwidth, indent=4))
Matt Mackall
Add basic support for help topics and a dates topic
r3795
Matt Mackall
alphabetize help_ in commands
r3655 def helpext(name):
try:
Matt Mackall
Create a separate module for managing extensions
r4544 mod = extensions.find(name)
Brodie Rao
dispatch: provide help for disabled extensions and commands...
r10364 doc = gettext(mod.__doc__) or _('no help text available')
Matt Mackall
alphabetize help_ in commands
r3655 except KeyError:
Brodie Rao
dispatch: provide help for disabled extensions and commands...
r10364 mod = None
doc = extensions.disabledext(name)
if not doc:
raise error.UnknownCommand(name)
David Soria Parra
commands: Check if helptext contains a newline before we split
r9280 if '\n' not in doc:
head, tail = doc, ""
else:
head, tail = doc.split('\n', 1)
Martin Geisler
commands: use minirst parser when displaying help
r9157 ui.write(_('%s extension - %s\n\n') % (name.split('.')[-1], head))
if tail:
ui.write(minirst.format(tail, textwidth))
ui.status('\n\n')
Benoit Boissinot
fix hg help <ext> for extension that do not define any command...
r4009
Brodie Rao
dispatch: provide help for disabled extensions and commands...
r10364 if mod:
try:
ct = mod.cmdtable
except AttributeError:
ct = {}
modcmds = set([c.split('|', 1)[0] for c in ct])
helplist(_('list of commands:\n\n'), modcmds.__contains__)
else:
ui.write(_('use "hg help extensions" for information on enabling '
'extensions\n'))
def helpextcmd(name):
cmd, ext, mod = extensions.disabledcmd(name, ui.config('ui', 'strict'))
doc = gettext(mod.__doc__).splitlines()[0]
msg = help.listexts(_("'%s' is provided by the following "
"extension:") % cmd, {ext: doc}, len(ext),
indent=4)
ui.write(minirst.format(msg, textwidth))
ui.write('\n\n')
ui.write(_('use "hg help extensions" for information on enabling '
'extensions\n'))
Matt Mackall
alphabetize help_ in commands
r3655
if name and name != 'shortlist':
Matt Mackall
Add basic support for help topics and a dates topic
r3795 i = None
Brodie Rao
dispatch: provide help for disabled extensions and commands...
r10364 if unknowncmd:
queries = (helpextcmd,)
else:
queries = (helptopic, helpcmd, helpext, helpextcmd)
for f in queries:
Matt Mackall
Add basic support for help topics and a dates topic
r3795 try:
f(name)
i = None
break
Matt Mackall
error: move UnknownCommand and AmbiguousCommand
r7643 except error.UnknownCommand, inst:
Matt Mackall
Add basic support for help topics and a dates topic
r3795 i = inst
if i:
raise i
Matt Mackall
alphabetize help_ in commands
r3655
else:
# program name
if ui.verbose or with_version:
version_(ui)
else:
ui.status(_("Mercurial Distributed SCM\n"))
ui.status('\n')
# list of commands
if name == "shortlist":
Alexis S. L. Carvalho
help: avoid traceback if an extension has only debug commands
r4950 header = _('basic commands:\n\n')
Alexis S. L. Carvalho
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output...
r4315 else:
Alexis S. L. Carvalho
help: avoid traceback if an extension has only debug commands
r4950 header = _('list of commands:\n\n')
helplist(header)
Dirkjan Ochtman
help: don't show extension list on extension help
r9839 if name != 'shortlist':
exts, maxlength = extensions.enabled()
text = help.listexts(_('enabled extensions:'), exts, maxlength)
if text:
ui.write("\n%s\n" % minirst.format(text, textwidth))
Matt Mackall
alphabetize help_ in commands
r3655
# list all option lists
opt_output = []
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 multioccur = False
Matt Mackall
alphabetize help_ in commands
r3655 for title, options in option_lists:
Alexis S. L. Carvalho
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output...
r4315 opt_output.append(("\n%s" % title, None))
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 for option in options:
if len(option) == 5:
shortopt, longopt, default, desc, optlabel = option
else:
shortopt, longopt, default, desc = option
optlabel = _("VALUE") # default label
Matt Mackall
many, many trivial check-code fixups
r10282 if _("DEPRECATED") in desc and not ui.verbose:
Benoit Boissinot
fix spaces/identation issues
r10339 continue
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 if isinstance(default, list):
numqualifier = " %s [+]" % optlabel
multioccur = True
elif (default is not None) and not isinstance(default, bool):
numqualifier = " %s" % optlabel
else:
numqualifier = ""
opt_output.append(("%2s%s" %
(shortopt and "-%s" % shortopt,
longopt and " --%s%s" %
(longopt, numqualifier)),
Matt Mackall
alphabetize help_ in commands
r3655 "%s%s" % (desc,
default
and _(" (default: %s)") % default
or "")))
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 if multioccur:
msg = _("\n[+] marked option can be specified multiple times")
if ui.verbose and name != 'shortlist':
FUJIWARA Katsunori
i18n: use encoding.colwidth() for correct column width...
r11611 opt_output.append((msg, None))
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 else:
FUJIWARA Katsunori
i18n: use encoding.colwidth() for correct column width...
r11611 opt_output.insert(-1, (msg, None))
Matt Mackall
alphabetize help_ in commands
r3655
Dirkjan Ochtman
help: show help topics by default in 'hg help', with longest available id
r7196 if not name:
Matt Mackall
help: update help...
r7210 ui.write(_("\nadditional help topics:\n\n"))
Johannes Stezenbach
help: list special help topics with -v
r6653 topics = []
Martin Geisler
restructure helptable...
r7012 for names, header, doc in help.helptable:
Martin Geisler
commands: simpler sort of help topic names
r9537 topics.append((sorted(names, key=len, reverse=True)[0], header))
Johannes Stezenbach
help: list special help topics with -v
r6653 topics_len = max([len(s[0]) for s in topics])
for t, desc in topics:
ui.write(" %-*s %s\n" % (topics_len, t, desc))
Matt Mackall
alphabetize help_ in commands
r3655 if opt_output:
FUJIWARA Katsunori
i18n: use encoding.colwidth() for correct column width...
r11611 colwidth = encoding.colwidth
# normalize: (opt or message, desc or None, width of opt)
entries = [desc and (opt, desc, colwidth(opt)) or (opt, None, 0)
for opt, desc in opt_output]
hanging = max([e[2] for e in entries])
for opt, desc, width in entries:
if desc:
initindent = ' %s%s ' % (opt, ' ' * (hanging - width))
hangindent = ' ' * (hanging + 3)
ui.write('%s\n' % (util.wrap(desc,
FUJIWARA Katsunori
replace Python standard textwrap by MBCS sensitive one for i18n text...
r11297 initindent=initindent,
hangindent=hangindent)))
Matt Mackall
alphabetize help_ in commands
r3655 else:
FUJIWARA Katsunori
i18n: use encoding.colwidth() for correct column width...
r11611 ui.write("%s\n" % opt)
mpm@selenic.com
Beginning of multi-head support...
r221
Matt Mackall
identify: take a path to a remote repo...
r4671 def identify(ui, repo, source=None,
rev=None, num=None, id=None, branch=None, tags=None):
Matt Mackall
identify: accept a revision argument
r4665 """identify the working copy or specified revision
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 With no revision, print a summary of the current state of the
Martin Geisler
expand "repo" to "repository" in help texts
r8027 repository.
Matt Mackall
identify: take a path to a remote repo...
r4671
timeless
Improve English for help text of many core hg commands....
r8779 Specifying a path to a repository root or Mercurial bundle will
cause lookup to operate on that repository/bundle.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 This summary identifies the repository state using one or two
parent hash identifiers, followed by a "+" if there are
uncommitted changes in the working directory, a list of tags for
this revision and a branch name for non-default branches.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 if successful.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
identify: show nullid for empty repo
r4662
Alexis S. L. Carvalho
make identify an optionalrepo command...
r5330 if not repo and not source:
raise util.Abort(_("There is no Mercurial repository here "
"(.hg not found)"))
Matt Mackall
Only show long hashes with --debug, not --verbose
r2966 hexfunc = ui.debugflag and hex or short
Matt Mackall
identify: add support for output flags
r4666 default = not (num or id or branch or tags)
output = []
Matt Mackall
identify: use contexts
r4664
Dirkjan Ochtman
identify: have consistent output for local repositories...
r7757 revs = []
Matt Mackall
identify: take a path to a remote repo...
r4671 if source:
Sune Foldager
interpret repo#name url syntax as branch instead of revision...
r10365 source, branches = hg.parseurl(ui.expandpath(source))
Dirkjan Ochtman
identify: have consistent output for local repositories...
r7757 repo = hg.repository(ui, source)
Sune Foldager
interpret repo#name url syntax as branch instead of revision...
r10365 revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
Dirkjan Ochtman
identify: have consistent output for local repositories...
r7757
if not repo.local():
Matt Mackall
identify: take a path to a remote repo...
r4671 if not rev and revs:
rev = revs[0]
Matt Mackall
identify: work with remote repos
r4667 if not rev:
rev = "tip"
if num or branch or tags:
raise util.Abort(
"can't query remote revision number, branch, or tags")
Dirkjan Ochtman
identify: have consistent output for local repositories...
r7757 output = [hexfunc(repo.lookup(rev))]
Matt Mackall
identify: work with remote repos
r4667 elif not rev:
Matt Mackall
use repo[changeid] to get a changectx
r6747 ctx = repo[None]
Matt Mackall
identify: accept a revision argument
r4665 parents = ctx.parents()
Matt Mackall
identify: add support for output flags
r4666 changed = False
if default or id or num:
Dirkjan Ochtman
identify: don't include unknown in status
r10515 changed = util.any(repo.status())
Matt Mackall
identify: add support for output flags
r4666 if default or id:
output = ["%s%s" % ('+'.join([hexfunc(p.node()) for p in parents]),
(changed) and "+" or "")]
if num:
output.append("%s%s" % ('+'.join([str(p.rev()) for p in parents]),
(changed) and "+" or ""))
Matt Mackall
identify: accept a revision argument
r4665 else:
Matt Mackall
use repo[changeid] to get a changectx
r6747 ctx = repo[rev]
Matt Mackall
identify: add support for output flags
r4666 if default or id:
output = [hexfunc(ctx.node())]
if num:
output.append(str(ctx.rev()))
Dirkjan Ochtman
identify: have consistent output for local repositories...
r7757 if repo.local() and default and not ui.quiet:
Matt Mackall
move encoding bits from util to encoding...
r7948 b = encoding.tolocal(ctx.branch())
Matt Mackall
identify: add support for output flags
r4666 if b != 'default':
output.append("(%s)" % b)
Matt Mackall
Report branch for hg id
r3415
Thomas Arendsen Hein
Improvements for hg identify:...
r386 # multiple tags for a single parent separated by '/'
Matt Mackall
identify: add support for output flags
r4666 t = "/".join(ctx.tags())
if t:
output.append(t)
if branch:
Matt Mackall
move encoding bits from util to encoding...
r7948 output.append(encoding.tolocal(ctx.branch()))
Matt Mackall
identify: add support for output flags
r4666
if tags:
output.extend(ctx.tags())
Thomas Arendsen Hein
added hg identify|id (based on a patch from Andrew Thompson)...
r339
Thomas Arendsen Hein
Improvements for hg identify:...
r386 ui.write("%s\n" % ' '.join(output))
Thomas Arendsen Hein
added hg identify|id (based on a patch from Andrew Thompson)...
r339
mpm@selenic.com
Commands cleanup...
r437 def import_(ui, repo, patch1, *patches, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """import an ordered set of patches
timeless@mozdev.org
minor documentation improvements
r9649 Import a list of patches and commit them individually (unless
--no-commit is specified).
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
If there are outstanding changes in the working directory, import
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 will abort unless given the -f/--force flag.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 You can import a patch straight from a mail message. Even patches
timeless
Improve English for help text of many core hg commands....
r8779 as attachments work (to use the body part, it must have type
text/plain or text/x-patch). From and Subject headers of email
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 message are used as default committer and commit message. All
Vadim Gelfer
import: make help clearer. suggested by asak.
r2515 text/plain body parts before first diff are added to commit
message.
Vadim Gelfer
import: parse email messages
r2504
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 If the imported patch was generated by :hg:`export`, user and
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 description from patch override values from message headers and
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 body. Values given on command line with -m/--message and -u/--user
override these.
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004
If --exact is specified, import will set the working directory to
the parent of each patch before applying it, and will abort if the
resulting changeset has a different ID than the one recorded in
the patch. This may happen due to character set problems or other
deficiencies in the text patch format.
Brendan Cully
Add import --exact....
r4263
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 With -s/--similarity, hg will attempt to discover renames and
copies in the patch in the same way as 'addremove'.
Brendan Cully
import: add similarity option (issue295)
r7402
Dirkjan Ochtman
commands: add note about import retrieving patches from URLs
r8931 To read a patch from standard input, use "-" as the patch name. If
a URL is specified, the patch will be downloaded from it.
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help dates` for a list of formats valid for -d/--date.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
mpm@selenic.com
Commands cleanup...
r437 patches = (patch1,) + patches
mpm@selenic.com
[PATCH] Clean up destination directory if a clone fails....
r500
Thomas Arendsen Hein
Fix bad behaviour when specifying an invalid date (issue700)...
r6139 date = opts.get('date')
if date:
opts['date'] = util.parsedate(date)
Brendan Cully
import: add similarity option (issue295)
r7402 try:
sim = float(opts.get('similarity') or 0)
except ValueError:
raise util.Abort(_('similarity must be a number'))
if sim < 0 or sim > 100:
raise util.Abort(_('similarity must be between 0 and 100'))
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('exact') or not opts.get('force'):
Matt Mackall
dispatch: move dispatching code to cmdutil
r4549 cmdutil.bail_if_changed(repo)
mpm@selenic.com
hg import: abort with uncommitted changes, override with --force
r966
mpm@selenic.com
Commands cleanup...
r437 d = opts["base"]
strip = opts["strip"]
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 wlock = lock = None
Brendan Cully
import: import each patch in a file or stream as a separate change...
r10384
def tryone(ui, hunk):
Matt Mackall
fix up a bunch of check-code warnings
r10413 tmpname, message, user, date, branch, nodeid, p1, p2 = \
patch.extract(ui, hunk)
Brendan Cully
import: import each patch in a file or stream as a separate change...
r10384
if not tmpname:
return None
commitid = _('to working directory')
try:
cmdline_message = cmdutil.logmessage(opts)
if cmdline_message:
# pickup the cmdline msg
message = cmdline_message
elif message:
# pickup the patch msg
message = message.strip()
else:
# launch the editor
message = None
ui.debug('message:\n%s\n' % message)
wp = repo.parents()
if opts.get('exact'):
if not nodeid or not p1:
raise util.Abort(_('not a Mercurial patch'))
p1 = repo.lookup(p1)
p2 = repo.lookup(p2 or hex(nullid))
if p1 != wp[0].node():
hg.clean(repo, p1)
repo.dirstate.setparents(p1, p2)
elif p2:
try:
p1 = repo.lookup(p1)
p2 = repo.lookup(p2)
if p1 == wp[0].node():
repo.dirstate.setparents(p1, p2)
except error.RepoError:
pass
if opts.get('exact') or opts.get('import_branch'):
repo.dirstate.setbranch(branch or 'default')
files = {}
try:
patch.patch(tmpname, ui, strip=strip, cwd=repo.root,
files=files, eolmode=None)
finally:
files = patch.updatedir(ui, repo, files,
similarity=sim / 100.0)
if not opts.get('no_commit'):
if opts.get('exact'):
m = None
else:
m = cmdutil.matchfiles(repo, files or [])
n = repo.commit(message, opts.get('user') or user,
opts.get('date') or date, match=m,
editor=cmdutil.commiteditor)
if opts.get('exact'):
if hex(n) != nodeid:
repo.rollback()
raise util.Abort(_('patch is damaged'
' or loses information'))
# Force a dirstate write so that the next transaction
# backups an up-do-date file.
repo.dirstate.write()
if n:
commitid = short(n)
return commitid
finally:
os.unlink(tmpname)
Peter Arrenbrecht
whitespace cleanup
r10405
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 try:
wlock = repo.wlock()
lock = repo.lock()
Brendan Cully
import: import each patch in a file or stream as a separate change...
r10384 lastcommit = None
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 for p in patches:
pf = os.path.join(d, p)
if pf == '-':
ui.status(_("applying patch from stdin\n"))
Benoit Boissinot
use our urlopener (proxy handling, etc) instead of urllib
r7271 pf = sys.stdin
Vadim Gelfer
import: allow to import stdin with file name "-"
r2400 else:
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 ui.status(_("applying %s\n") % p)
Benoit Boissinot
use our urlopener (proxy handling, etc) instead of urllib
r7271 pf = url.open(ui, pf)
Brendan Cully
import: import each patch in a file or stream as a separate change...
r10384
haspatch = False
for hunk in patch.split(pf):
commitid = tryone(ui, hunk)
if commitid:
haspatch = True
if lastcommit:
ui.status(_('applied %s\n') % lastcommit)
lastcommit = commitid
if not haspatch:
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 raise util.Abort(_('no diffs found'))
finally:
Ronny Pfannschmidt
switch lock releasing in the core from gc to explicit
r8109 release(lock, wlock)
mpm@selenic.com
Commands cleanup...
r437
TK Soh
Add -p to incoming and outgoing commands to show patch
r1192 def incoming(ui, repo, source="default", **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """show new changesets found in source
Thomas Arendsen Hein
More detailed documentation about ssh:// URLs; fixes issue170.
r1979 Show new changesets found in the specified path/URL or the default
timeless
Improve English for help text of many core hg commands....
r8779 pull location. These are the changesets that would have been pulled
if a pull at the time you issued this command.
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004
For remote repository, using --bundle avoids downloading the
changesets twice if the incoming is followed by a pull.
Thomas Arendsen Hein
More detailed documentation about ssh:// URLs; fixes issue170.
r1979
See pull for valid source format details.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 if there are incoming changes, 1 otherwise.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Thomas Arendsen Hein
Add option -l/--limit to hg incoming and hg outgoing.
r6191 limit = cmdutil.loglimit(opts)
Sune Foldager
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
r10379 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
Matt Mackall
remoteui: move from cmdutil to hg
r11273 other = hg.repository(hg.remoteui(repo, opts), source)
Benoit Boissinot
factor out the url handling from httprepo...
r7270 ui.status(_('comparing with %s\n') % url.hidepassword(source))
Sune Foldager
interpret repo#name url syntax as branch instead of revision...
r10365 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
Matt Mackall
Add support for url#id syntax...
r4478 if revs:
Bryan O'Sullivan
Push capability checking into protocol-level code.
r5259 revs = [other.lookup(rev) for rev in revs]
Dirkjan Ochtman
move discovery methods from localrepo into new discovery module
r11301
tmp = discovery.findcommonincoming(repo, other, heads=revs,
force=opts.get('force'))
common, incoming, rheads = tmp
Benoit Boissinot
incoming: add support for remote repo using bundlerepo
r1944 if not incoming:
Matt Mackall
hg in: if no incoming csets, remove existing bundle
r3933 try:
os.unlink(opts["bundle"])
except:
pass
TK Soh
show message if no changes found on incoming
r1993 ui.status(_("no changes found\n"))
Matt Mackall
incoming/outgoing: return failure if no changes found
r3931 return 1
Benoit Boissinot
incoming: add support for remote repo using bundlerepo
r1944
cleanup = None
Thomas Arendsen Hein
Delete bundle file of hg incoming in case of errors, preserve existing files....
r1974 try:
fname = opts["bundle"]
if fname or not other.local():
# create a bundle (uncompressed if other repo is not local)
Benoit Boissinot
protocol: use changegroupsubset() if possible (issue1389)...
r7415
if revs is None and other.capable('changegroupsubset'):
revs = rheads
Thomas Arendsen Hein
Make "hg incoming -r revision_number" work for remote repos (issue566)...
r4451 if revs is None:
cg = other.changegroup(incoming, "incoming")
else:
cg = other.changegroupsubset(incoming, revs, 'incoming')
Thomas Arendsen Hein
Use 'bundletype' instead of 'type' to not shadow built-in function.
r3706 bundletype = other.local() and "HG10BZ" or "HG10UN"
fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
Thomas Arendsen Hein
Delete bundle file of hg incoming in case of errors, preserve existing files....
r1974 # keep written bundle?
if opts["bundle"]:
cleanup = None
if not other.local():
# use the created uncompressed bundlerepo
other = bundlerepo.bundlerepository(ui, repo.root, fname)
Benoit Boissinot
add -r/--rev arguments to incoming and outgoing
r2521 o = other.changelog.nodesbetween(incoming, revs)[0]
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('newest_first'):
Thomas Arendsen Hein
Delete bundle file of hg incoming in case of errors, preserve existing files....
r1974 o.reverse()
Matt Mackall
templates: move changeset templating bits to cmdutils
r3643 displayer = cmdutil.show_changeset(ui, other, opts)
Thomas Arendsen Hein
Add option -l/--limit to hg incoming and hg outgoing.
r6191 count = 0
Thomas Arendsen Hein
Delete bundle file of hg incoming in case of errors, preserve existing files....
r1974 for n in o:
Nicolas Dumazet
cmdutil: replace sys.maxint with None as default value in loglimit...
r10111 if limit is not None and count >= limit:
Thomas Arendsen Hein
Add option -l/--limit to hg incoming and hg outgoing.
r6191 break
Thomas Arendsen Hein
Delete bundle file of hg incoming in case of errors, preserve existing files....
r1974 parents = [p for p in other.changelog.parents(n) if p != nullid]
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('no_merges') and len(parents) == 2:
Thomas Arendsen Hein
Delete bundle file of hg incoming in case of errors, preserve existing files....
r1974 continue
Thomas Arendsen Hein
Add option -l/--limit to hg incoming and hg outgoing.
r6191 count += 1
Dirkjan Ochtman
cmdutil: use change contexts for cset-printer and cset-templater
r7369 displayer.show(other[n])
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer.close()
Thomas Arendsen Hein
Delete bundle file of hg incoming in case of errors, preserve existing files....
r1974 finally:
if hasattr(other, 'close'):
other.close()
if cleanup:
os.unlink(cleanup)
Benoit Boissinot
incoming: add support for remote repo using bundlerepo
r1944
Thomas Arendsen Hein
Add ui method to set --ssh/--remotecmd, use it in init/clone/pull/push/in/out....
r2598 def init(ui, dest=".", **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """create a new repository in the given directory
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 Initialize a new repository in the given directory. If the given
timeless
Improve English for help text of many core hg commands....
r8779 directory does not exist, it will be created.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
If no directory is given, the current directory is used.
Thomas Arendsen Hein
Additional information about URLs in pull/push/clone/init:...
r2590
Martin Geisler
commands: mark "ssh://" as inline literals in help texts
r9970 It is possible to specify an ``ssh://`` URL as the destination.
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help urls` for more information.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
remoteui: move from cmdutil to hg
r11273 hg.repository(hg.remoteui(ui, opts), dest, create=1)
mpm@selenic.com
default path support with .hg/hgrc...
r338
Bryan O'Sullivan
Add locate command....
r627 def locate(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """locate files matching specific patterns
timeless
Improve English for help text of many core hg commands....
r8779 Print files under Mercurial control in the working directory whose
names match the given patterns.
By default, this command searches all directories in the working
directory. To search just the current directory and its
subdirectories, use "--include .".
If no patterns are given to match, this command prints the names
of all files under Mercurial control in the working directory.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
If you want to feed the output of this command into the "xargs"
Martin Geisler
commands: use double quotes consistently in help texts
r8032 command, use the -0 option to both this command and "xargs". This
will avoid the problem of "xargs" treating single filenames that
timeless
Improve English for help text of many core hg commands....
r8779 contain whitespace as multiple filenames.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 if a match is found, 1 otherwise.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Alexander Solovyov
commands: optional options where possible...
r7131 end = opts.get('print0') and '\0' or '\n'
Matt Mackall
context: add walk method
r6764 rev = opts.get('rev') or None
mpm@selenic.com
Refactor matchpats and walk...
r742
Alexis S. L. Carvalho
locate: exit(1) if we didn't print any file
r4196 ret = 1
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579 m = cmdutil.match(repo, pats, opts, default='relglob')
Matt Mackall
many, many trivial check-code fixups
r10282 m.bad = lambda x, y: False
Matt Mackall
context: add walk method
r6764 for abs in repo[rev].walk(m):
if not rev and abs not in repo.dirstate:
Alexis S. L. Carvalho
locate: don't print "file not found" messages....
r4308 continue
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('fullpath'):
Martin Geisler
use repo.wjoin(f) instead of os.path.join(repo.root, f)
r7570 ui.write(repo.wjoin(abs), end)
Bryan O'Sullivan
Get add and locate to use new repo and dirstate walk code....
r724 else:
Matt Mackall
walk: remove rel and exact returns
r6584 ui.write(((pats and m.rel(abs)) or abs), end)
Alexis S. L. Carvalho
locate: exit(1) if we didn't print any file
r4196 ret = 0
return ret
Bryan O'Sullivan
Add locate command....
r627
Bryan O'Sullivan
Rewrite log command. New version is faster and more featureful....
r1031 def log(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """show revision history of entire repository or files
Vadim Gelfer
log: add -f/--follow option, to follow rename/copy
r2741 Print the revision history of the specified files or the entire
project.
File history is shown without following rename or copy history of
timeless
Generally replace "file name" with "filename" in help and comments.
r8761 files. Use -f/--follow with a filename to follow history across
renames and copies. --follow without a filename will only show
Brendan Cully
Add log option --follow-first to follow only the first parent of...
r2784 ancestors or descendants of the starting revision. --follow-first
only follows the first parent of merge revisions.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Brendan Cully
Make log --follow revision range start default to working dir parent.
r2783 If no revision range is specified, the default is tip:0 unless
--follow is set, in which case the working directory parent is
Martin Geisler
commands: advertise "hg help revsets" in help for log
r11384 used as the starting revision. You can specify a revision set for
log, see :hg:`help revsets` for more information.
Brendan Cully
Make log --follow revision range start default to working dir parent.
r2783
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help dates` for a list of formats valid for -d/--date.
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163
timeless
Improve English for help text of many core hg commands....
r8779 By default this command prints revision number and changeset id,
tags, non-trivial parents, user, date and time, and a summary for
each commit. When the -v/--verbose switch is used, the list of
changed files and full commit message are shown.
Matt Mackall
Add notes about diff/merge asymmetry to export, diff, and log
r3822
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 NOTE: log -p/--patch may generate unexpected diff output for merge
timeless
help: miscellaneous language fixes
r7807 changesets, as it will only compare the merge changeset against
timeless
Improve English for help text of many core hg commands....
r8779 its first parent. Also, only files different from BOTH parents
will appear in files:.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Vadim Gelfer
add -l,--limit to log command.
r1756
Matt Mackall
walkchangerevs: pull out matchfn...
r9652 matchfn = cmdutil.match(repo, pats, opts)
Thomas Arendsen Hein
Move finding/checking the log limit to cmdutil
r6190 limit = cmdutil.loglimit(opts)
Vadim Gelfer
add -l,--limit to log command.
r1756 count = 0
Patrick Mezard
templatekw: change {file_copies} behaviour, add {file_copies_switch}...
r10060 endrev = None
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('copies') and opts.get('rev'):
endrev = max(cmdutil.revrange(repo, opts.get('rev'))) + 1
Brendan Cully
Show copies in hg log....
r3197
Matt Mackall
Add --date support to log...
r3813 df = False
if opts["date"]:
df = util.matchdate(opts["date"])
Benoit Boissinot
log -b: use opts.get() instead of assuming opts is correctly filled
r10963 branches = opts.get('branch', []) + opts.get('only_branch', [])
opts['branch'] = [repo.lookupbranch(b) for b in branches]
Steve Losh
commands: Add 'hg log --branch' and deprecate 'hg log --only-branch'...
r10957
Mads Kiilerich
log: follow filenames through renames (issue647)...
r11488 displayer = cmdutil.show_changeset(ui, repo, opts, True)
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 def prep(ctx, fns):
Matt Mackall
walkchangerevs: internalize ctx caching
r9655 rev = ctx.rev()
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 parents = [p for p in repo.changelog.parentrevs(rev)
if p != nullrev]
if opts.get('no_merges') and len(parents) == 2:
return
if opts.get('only_merges') and len(parents) != 2:
return
Steve Losh
commands: Add 'hg log --branch' and deprecate 'hg log --only-branch'...
r10957 if opts.get('branch') and ctx.branch() not in opts['branch']:
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 return
if df and not df(ctx.date()[0]):
return
Matt Mackall
log: tidy up some filter tests
r9663 if opts['user'] and not [k for k in opts['user'] if k in ctx.user()]:
return
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 if opts.get('keyword'):
for k in [kw.lower() for kw in opts['keyword']]:
Matt Mackall
log: tidy up some filter tests
r9663 if (k in ctx.user().lower() or
k in ctx.description().lower() or
k in " ".join(ctx.files()).lower()):
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 break
Matt Mackall
log: tidy up some filter tests
r9663 else:
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 return
Patrick Mezard
templatekw: change {file_copies} behaviour, add {file_copies_switch}...
r10060 copies = None
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 if opts.get('copies') and rev:
Patrick Mezard
templatekw: change {file_copies} behaviour, add {file_copies_switch}...
r10060 copies = []
getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 for fn in ctx.files():
rename = getrenamed(fn, rev)
if rename:
copies.append((fn, rename[0]))
Mads Kiilerich
log: follow filenames through renames (issue647)...
r11488 revmatchfn = None
if opts.get('patch') or opts.get('stat'):
Yuya Nishihara
log: fix missing diff output for hg log -p in sub directory...
r11508 revmatchfn = cmdutil.match(repo, fns, default='path')
Mads Kiilerich
log: follow filenames through renames (issue647)...
r11488
displayer.show(ctx, copies=copies, matchfn=revmatchfn)
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662
Matt Mackall
walkchangerevs: drop ui arg
r9665 for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep):
Benoit Boissinot
log --limit: break after a limited number of csets (broken by f3d60543924f)
r9687 if count == limit:
break
if displayer.flush(ctx.rev()):
count += 1
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer.close()
mpm@selenic.com
hg help: use docstrings only...
r255
Bryan O'Sullivan
manifest: accept -r for rev specification
r5155 def manifest(ui, repo, node=None, rev=None):
Thomas Arendsen Hein
doc string fix: hg cat and manifest default to current parent revision.
r3914 """output the current or given revision of the project manifest
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Print a list of version controlled files for the given revision.
Patrick Mezard
Fix manifest default rev doc when no rev is checked out (issue1603)
r8041 If no revision is given, the first parent of the working directory
timeless
Improve English for help text of many core hg commands....
r8779 is used, or the null revision if no revision is checked out.
With -v, print file permissions, symlink and executable bits.
With --debug, print file revision hashes.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
make manifest friendlier...
r3736
Bryan O'Sullivan
manifest: accept -r for rev specification
r5155 if rev and node:
raise util.Abort(_("please specify just one revision"))
if not node:
node = rev
Matt Mackall
manifest: remove execf/linkf methods
r6749 decor = {'l':'644 @ ', 'x':'755 * ', '':'644 '}
ctx = repo[node]
for f in ctx:
Matt Mackall
make manifest friendlier...
r3736 if ui.debugflag:
Matt Mackall
manifest: remove execf/linkf methods
r6749 ui.write("%40s " % hex(ctx.manifest()[f]))
Matt Mackall
make manifest friendlier...
r3736 if ui.verbose:
Matt Mackall
manifest: remove execf/linkf methods
r6749 ui.write(decor[ctx.flags(f)])
Matt Mackall
make manifest friendlier...
r3736 ui.write("%s\n" % f)
mpm@selenic.com
hg help: use docstrings only...
r255
Dirkjan Ochtman
merge: add -S/--show option to review revisions without merging
r8387 def merge(ui, repo, node=None, **opts):
Benoit Boissinot
various doc fixes...
r4014 """merge working directory with another revision
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019
timeless
Improve English for help text of many core hg commands....
r8779 The current working directory is updated with all changes made in
the requested revision since the last common predecessor revision.
Martin Geisler
commands: better merge help text
r7977
Files that changed between either parent are marked as changed for
the next commit and a commit must be performed before any further
timeless
Improve English for help text of many core hg commands....
r8779 updates to the repository are allowed. The next commit will have
two parents.
Vadim Gelfer
merge with other head by default, not tip....
r2915
If no revision is specified, the working directory's parent is a
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 head revision, and the current branch contains exactly one other
head, the other head is merged with by default. Otherwise, an
timeless
Improve English for help text of many core hg commands....
r8779 explicit revision with which to merge with must be provided.
Matt Mackall
commands: initial audit of exit codes...
r11177
Matt Mackall
merge: document how to 'undo' a merge
r11452 To undo an uncommitted merge, use :hg:`update --clean .` which
will check out a clean copy of the original merge parent, losing
all changes.
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success, 1 if there are unresolved files.
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019 """
Matt Mackall
Factor doupdate into _lookup + hg.update
r2806
Dirkjan Ochtman
merge: add -S/--show option to review revisions without merging
r8387 if opts.get('rev') and node:
Daniel Holth
accept -r REV in more places...
r4450 raise util.Abort(_("please specify just one revision"))
if not node:
Dirkjan Ochtman
merge: add -S/--show option to review revisions without merging
r8387 node = opts.get('rev')
Daniel Holth
accept -r REV in more places...
r4450
Matt Mackall
Remove deprecated old-style branch support
r3876 if not node:
Matt Mackall
use repo.changectx(None) to get a workingctx
r6740 branch = repo.changectx(None).branch()
Dirkjan Ochtman
merge: use correct branch name for counting heads
r6844 bheads = repo.branchheads(branch)
Dirkjan Ochtman
merge: only in-branch merges can be implicit
r6723 if len(bheads) > 2:
Greg Ward
merge: when current branch has 1 or > 2 heads, actually abort....
r11353 raise util.Abort(_(
'branch \'%s\' has %d heads - '
'please merge with an explicit rev\n'
'(run \'hg heads .\' to see heads)')
% (branch, len(bheads)))
Dirkjan Ochtman
merge: only in-branch merges can be implicit
r6723
Benoit Boissinot
improve error message for 'hg merge' when repo already at branchtip
r5242 parent = repo.dirstate.parents()[0]
Dirkjan Ochtman
merge: only in-branch merges can be implicit
r6723 if len(bheads) == 1:
if len(repo.heads()) > 1:
Greg Ward
merge: when current branch has 1 or > 2 heads, actually abort....
r11353 raise util.Abort(_(
'branch \'%s\' has one head - '
'please merge with an explicit rev\n'
'(run \'hg heads\' to see all heads)')
% branch)
Benoit Boissinot
improve error message for 'hg merge' when repo already at branchtip
r5242 msg = _('there is nothing to merge')
Matt Mackall
use repo[changeid] to get a changectx
r6747 if parent != repo.lookup(repo[None].branch()):
Matt Mackall
i18n: fix complaints from pygettext
r5542 msg = _('%s - use "hg update" instead') % msg
Benoit Boissinot
improve error message for 'hg merge' when repo already at branchtip
r5242 raise util.Abort(msg)
Dirkjan Ochtman
merge: only in-branch merges can be implicit
r6723 if parent not in bheads:
Vadim Gelfer
merge with other head by default, not tip....
r2915 raise util.Abort(_('working dir not at a head rev - '
'use "hg update" or merge with an explicit rev'))
Dirkjan Ochtman
merge: only in-branch merges can be implicit
r6723 node = parent == bheads[0] and bheads[-1] or bheads[0]
Dirkjan Ochtman
merge: add -S/--show option to review revisions without merging
r8387
Dirkjan Ochtman
merge: rename -S/--show option to -P/--preview
r8834 if opts.get('preview'):
Greg Ward
merge: fix --preview to show all nodes that will be merged (issue2043)....
r10505 # find nodes that are ancestors of p2 but not of p1
p1 = repo.lookup('.')
p2 = repo.lookup(node)
nodes = repo.changelog.findmissing(common=[p1], heads=[p2])
Dirkjan Ochtman
merge: add -S/--show option to review revisions without merging
r8387 displayer = cmdutil.show_changeset(ui, repo, opts)
Greg Ward
merge: fix --preview to show all nodes that will be merged (issue2043)....
r10505 for node in nodes:
displayer.show(repo[node])
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer.close()
Dirkjan Ochtman
merge: add -S/--show option to review revisions without merging
r8387 return 0
return hg.merge(repo, node, force=opts.get('force'))
Vadim Gelfer
rewrite revert command. fix issues 93, 123, 147....
r2029
Vadim Gelfer
push, outgoing, bundle: fall back to "default" if "default-push" not defined
r2494 def outgoing(ui, repo, dest=None, **opts):
timeless
help: Improved body text
r10376 """show changesets not found in the destination
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Show changesets not found in the specified destination repository
or the default push location. These are the changesets that would
be pushed if a push was requested.
Benoit Boissinot
resync commands.py docstrings with hg.1.txt
r1811
timeless
help: Improved body text
r10376 See pull for details of valid destination formats.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 if there are outgoing changes, 1 otherwise.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Thomas Arendsen Hein
Add option -l/--limit to hg incoming and hg outgoing.
r6191 limit = cmdutil.loglimit(opts)
Sune Foldager
interpret repo#name url syntax as branch instead of revision...
r10365 dest = ui.expandpath(dest or 'default-push', dest or 'default')
Sune Foldager
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
r10379 dest, branches = hg.parseurl(dest, opts.get('branch'))
Sune Foldager
interpret repo#name url syntax as branch instead of revision...
r10365 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
Matt Mackall
Add support for url#id syntax...
r4478 if revs:
revs = [repo.lookup(rev) for rev in revs]
Benoit Boissinot
add remotecmd/ssh option support to incoming/outgoing
r1965
Matt Mackall
remoteui: move from cmdutil to hg
r11273 other = hg.repository(hg.remoteui(repo, opts), dest)
Benoit Boissinot
factor out the url handling from httprepo...
r7270 ui.status(_('comparing with %s\n') % url.hidepassword(dest))
Dirkjan Ochtman
move discovery methods from localrepo into new discovery module
r11301 o = discovery.findoutgoing(repo, other, force=opts.get('force'))
Thomas Arendsen Hein
show message if no changes found on outgoing...
r1994 if not o:
ui.status(_("no changes found\n"))
Matt Mackall
incoming/outgoing: return failure if no changes found
r3931 return 1
Benoit Boissinot
add -r/--rev arguments to incoming and outgoing
r2521 o = repo.changelog.nodesbetween(o, revs)[0]
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('newest_first'):
Michal Kvasnica
allow 'hg out' / 'hg in' to show newest commit first
r1439 o.reverse()
Matt Mackall
templates: move changeset templating bits to cmdutils
r3643 displayer = cmdutil.show_changeset(ui, repo, opts)
Thomas Arendsen Hein
Add option -l/--limit to hg incoming and hg outgoing.
r6191 count = 0
mpm@selenic.com
Add hg outgoing command
r920 for n in o:
Nicolas Dumazet
cmdutil: replace sys.maxint with None as default value in loglimit...
r10111 if limit is not None and count >= limit:
Thomas Arendsen Hein
Add option -l/--limit to hg incoming and hg outgoing.
r6191 break
Benoit Boissinot
add --no-merges (-M) for log, outgoing, incoming
r1435 parents = [p for p in repo.changelog.parents(n) if p != nullid]
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('no_merges') and len(parents) == 2:
Benoit Boissinot
add --no-merges (-M) for log, outgoing, incoming
r1435 continue
Thomas Arendsen Hein
Add option -l/--limit to hg incoming and hg outgoing.
r6191 count += 1
Dirkjan Ochtman
cmdutil: use change contexts for cset-printer and cset-templater
r7369 displayer.show(repo[n])
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer.close()
mpm@selenic.com
Add hg outgoing command
r920
Matt Mackall
remove legacy hg parents REV syntax
r3658 def parents(ui, repo, file_=None, **opts):
Martin Geisler
expand "dir" to "directory" in help texts
r8026 """show the parents of the working directory or revision
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Print the working directory's parent revisions. If a revision is
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 given via -r/--rev, the parent of that revision will be printed.
timeless
Improve English for help text of many core hg commands....
r8779 If a file argument is given, the revision in which the file was
last changed (before the working directory revision or the
argument to --rev if given) is printed.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
remove legacy hg parents REV syntax
r3658 rev = opts.get('rev')
Patrick Mezard
parents: make it match the doc when called on a file...
r5298 if rev:
Matt Mackall
use repo[changeid] to get a changectx
r6747 ctx = repo[rev]
Patrick Mezard
parents: make it match the doc when called on a file...
r5298 else:
Matt Mackall
use repo[changeid] to get a changectx
r6747 ctx = repo[None]
Patrick Mezard
parents: make it match the doc when called on a file...
r5298
Brendan Cully
Make parents with a file but not a revision use working directory revision.
r4586 if file_:
Matt Mackall
walk: remove remaining users of cmdutils.matchpats
r6582 m = cmdutil.match(repo, (file_,), opts)
if m.anypats() or len(m.files()) != 1:
timeless
Generally replace "file name" with "filename" in help and comments.
r8761 raise util.Abort(_('can only specify an explicit filename'))
Matt Mackall
walk: remove remaining users of cmdutils.matchpats
r6582 file_ = m.files()[0]
Patrick Mezard
parents: make it match the doc when called on a file...
r5298 filenodes = []
for cp in ctx.parents():
if not cp:
continue
try:
filenodes.append(cp.filenode(file_))
Matt Mackall
errors: move revlog errors...
r7633 except error.LookupError:
Patrick Mezard
parents: make it match the doc when called on a file...
r5298 pass
if not filenodes:
raise util.Abort(_("'%s' not found in manifest!") % file_)
fl = repo.file(file_)
Matt Mackall
linkrev: take a revision number rather than a hash
r7361 p = [repo.lookup(fl.linkrev(fl.rev(fn))) for fn in filenodes]
mpm@selenic.com
hg help: use docstrings only...
r255 else:
Patrick Mezard
parents: make it match the doc when called on a file...
r5298 p = [cp.node() for cp in ctx.parents()]
mpm@selenic.com
hg help: use docstrings only...
r255
Matt Mackall
templates: move changeset templating bits to cmdutils
r3643 displayer = cmdutil.show_changeset(ui, repo, opts)
mpm@selenic.com
hg help: use docstrings only...
r255 for n in p:
mpm@selenic.com
commands: use node functions directly
r1092 if n != nullid:
Martin Geisler
commands: fix paths command docstring indention
r7743 displayer.show(repo[n])
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer.close()
mpm@selenic.com
hg help: use docstrings only...
r255
Thomas Arendsen Hein
Make hg paths and hg debugconfig work with -R/--repository option....
r1858 def paths(ui, repo, search=None):
Bill Barry
Clarified 'hg paths' command help
r7691 """show aliases for remote repositories
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Show definition of symbolic path name NAME. If no name is given,
timeless
Improve English for help text of many core hg commands....
r8779 show definition of all available names.
Martin Geisler
commands: fix paths command docstring indention
r7743
Martin Geisler
commands: better markup in "hg help paths"
r11009 Path names are defined in the [paths] section of
``/etc/mercurial/hgrc`` and ``$HOME/.hgrc``. If run inside a
repository, ``.hg/hgrc`` is used, too.
Bill Barry
consolidated url help into urls help topic and added information about path aliases
r7693
Faheem Mitha
commands: revised documentation of 'default' and 'default-push'...
r11007 The path names ``default`` and ``default-push`` have a special
meaning. When performing a push or pull operation, they are used
as fallbacks if no location is specified on the command-line.
When ``default-push`` is set, it will be used for push and
``default`` will be used for pull; otherwise ``default`` is used
as the fallback for both. When cloning a repository, the clone
source is written as ``default`` in ``.hg/hgrc``. Note that
Martin Geisler
commands: better markup in "hg help paths"
r11009 ``default`` and ``default-push`` apply to all inbound (e.g.
:hg:`incoming`) and outbound (e.g. :hg:`outgoing`, :hg:`email` and
:hg:`bundle`) operations.
Faheem Mitha
Document 'default' and 'default-push' in paths docstring
r10933
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help urls` for more information.
Nicolas Dumazet
commands: document return values of add and paths commands
r11507
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
TK Soh
Add paths command...
r779 if search:
for name, path in ui.configitems("paths"):
if name == search:
Benoit Boissinot
factor out the url handling from httprepo...
r7270 ui.write("%s\n" % url.hidepassword(path))
TK Soh
Add paths command...
r779 return
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 ui.warn(_("not found!\n"))
TK Soh
Add paths command...
r779 return 1
else:
for name, path in ui.configitems("paths"):
Benoit Boissinot
factor out the url handling from httprepo...
r7270 ui.write("%s = %s\n" % (name, url.hidepassword(path)))
TK Soh
Add paths command...
r779
Alexis S. L. Carvalho
pull -u: if "url#rev" was given, update to rev
r5224 def postincoming(ui, repo, modheads, optupdate, checkout):
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019 if modheads == 0:
return
if optupdate:
Benoit Allard
pull: update to branch tip if there is only one head on the current branch...
r7372 if (modheads <= 1 or len(repo.branchheads()) == 1) or checkout:
Alexis S. L. Carvalho
pull -u: if "url#rev" was given, update to rev
r5224 return hg.update(repo, checkout)
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019 else:
ui.status(_("not updating, since new heads added\n"))
if modheads > 1:
ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
else:
ui.status(_("(run 'hg update' to get a working copy)\n"))
Vadim Gelfer
rewrite revert command. fix issues 93, 123, 147....
r2029
mpm@selenic.com
[PATCH] Unintuive use...
r404 def pull(ui, repo, source="default", **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """pull changes from the specified source
timeless
Improve English for help text of many core hg commands....
r8779 Pull changes from a remote repository to a local one.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
This finds all changes from the repository at the specified path
timeless
Improve English for help text of many core hg commands....
r8779 or URL and adds them to a local repository (the current one unless
-R is specified). By default, this does not update the copy of the
project in the working directory.
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 Use :hg:`incoming` if you want to see what would have been added
by a pull at the time you issued this command. If you then decide
to add those changes to the repository, you should use :hg:`pull
-r X` where ``X`` is the last changeset listed by :hg:`incoming`.
Martin Geisler
commands: make pull help point to the incoming command
r7980
Bill Barry
consolidated url help into urls help topic and added information about path aliases
r7693 If SOURCE is omitted, the 'default' path will be used.
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help urls` for more information.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if an update had unresolved files.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Sune Foldager
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
r10379 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
Matt Mackall
remoteui: move from cmdutil to hg
r11273 other = hg.repository(hg.remoteui(repo, opts), source)
Benoit Boissinot
factor out the url handling from httprepo...
r7270 ui.status(_('pulling from %s\n') % url.hidepassword(source))
Sune Foldager
interpret repo#name url syntax as branch instead of revision...
r10365 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
Matt Mackall
Add support for url#id syntax...
r4478 if revs:
Bryan O'Sullivan
Push capability checking into protocol-level code.
r5259 try:
Matt Mackall
Add support for url#id syntax...
r4478 revs = [other.lookup(rev) for rev in revs]
Matt Mackall
error: move repo errors...
r7637 except error.CapabilityError:
err = _("Other repository doesn't support revision lookup, "
"so a rev cannot be specified.")
raise util.Abort(err)
Matt Mackall
Add support for url#id syntax...
r4478
Alexander Solovyov
commands: optional options where possible...
r7131 modheads = repo.pull(other, heads=revs, force=opts.get('force'))
timeless@mozdev.org
commands: use rev from remote repo when updating as part of a pull
r9645 if checkout:
checkout = str(repo.changelog.rev(other.lookup(checkout)))
Alexander Solovyov
commands: optional options where possible...
r7131 return postincoming(ui, repo, modheads, opts.get('update'), checkout)
mpm@selenic.com
Migrate rawcommit, import, export, history, and merge...
r246
Vadim Gelfer
push, outgoing, bundle: fall back to "default" if "default-push" not defined
r2494 def push(ui, repo, dest=None, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """push changes to the specified destination
Faheem Mitha
commands: updates to push docstring....
r11217 Push changesets from the local repository to the specified
destination.
This operation is symmetrical to pull: it is identical to a pull
in the destination repository from the current one.
By default, push will not allow creation of new heads at the
destination, since multiple heads would make it unclear which head
to use. In this situation, it is recommended to pull and merge
before pushing.
Martin Geisler
commands: document --new-branch flag for push
r11219 Use --new-branch if you want to allow push to create a new named
branch that is not present at the destination. This allows you to
only create a new branch without forcing other changes.
Faheem Mitha
commands: updates to push docstring....
r11217 Use -f/--force to override the default behavior and push all
changesets on all branches.
If -r/--rev is used, the specified revision and all its ancestors
will be pushed to the remote repository.
Bill Barry
consolidated url help into urls help topic and added information about path aliases
r7693
Martin Geisler
Use hg role in help strings
r10973 Please see :hg:`help urls` for important details about ``ssh://``
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 URLs. If DESTINATION is omitted, a default path will be used.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 if push was successful, 1 if nothing to push.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Sune Foldager
interpret repo#name url syntax as branch instead of revision...
r10365 dest = ui.expandpath(dest or 'default-push', dest or 'default')
Sune Foldager
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
r10379 dest, branches = hg.parseurl(dest, opts.get('branch'))
Sune Foldager
interpret repo#name url syntax as branch instead of revision...
r10365 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
Matt Mackall
remoteui: move from cmdutil to hg
r11273 other = hg.repository(hg.remoteui(repo, opts), dest)
Benoit Boissinot
factor out the url handling from httprepo...
r7270 ui.status(_('pushing to %s\n') % url.hidepassword(dest))
Matt Mackall
Add support for url#id syntax...
r4478 if revs:
revs = [repo.lookup(rev) for rev in revs]
Matt Mackall
subrepo: basic push support
r8815
# push subrepos depth-first for coherent ordering
c = repo['']
subs = c.substate # only repos that are committed
for s in sorted(subs):
Matt Mackall
subrepo: propagate and catch push failures
r11067 if not c.sub(s).push(opts.get('force')):
return False
Matt Mackall
subrepo: basic push support
r8815
Sune Foldager
push: add --new-branch option to allow intial push of new branches...
r11211 r = repo.push(other, opts.get('force'), revs=revs,
newbranch=opts.get('new_branch'))
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019 return r == 0
mpm@selenic.com
stopgap hg push support...
r319
mpm@selenic.com
big heap of command clean-up work...
r245 def recover(ui, repo):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """roll back an interrupted transaction
Recover from an interrupted commit or pull.
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 This command tries to fix the repository status after an
interrupted operation. It should only be necessary when Mercurial
suggests it.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 if successful, 1 if nothing to recover or verify fails.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
Automatically run "verify" whenever we run "recover"
r1516 if repo.recover():
Matt Mackall
Move repo.verify
r2778 return hg.verify(repo)
Thomas Arendsen Hein
Never exit directly from commands.dispatch(), but pass return code to caller....
r2057 return 1
mpm@selenic.com
big heap of command clean-up work...
r245
Vadim Gelfer
add --after option to remove command.
r2179 def remove(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """remove the specified files on the next commit
Schedule the indicated files for removal from the repository.
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 This only removes files from the current branch, not from the
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 entire project history. -A/--after can be used to remove only
files that have already been deleted, -f/--force can be used to
force deletion, and -Af can be used to remove files from the next
timeless
Improve English for help text of many core hg commands....
r8779 revision without deleting them from the working directory.
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004
The following table details the behavior of remove for different
file states (columns) and option combinations (rows). The file
Martin Geisler
commands: wrap docstrings at 70 characters...
r9249 states are Added [A], Clean [C], Modified [M] and Missing [!] (as
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 reported by :hg:`status`). The actions are Warn, Remove (from
branch) and Delete (from disk)::
Martin Geisler
commands: use minirst parser when displaying help
r9157
A C M !
none W RD W R
-f R RD RD R
-A W W W R
-Af R R R R
Vadim Gelfer
remove: rewrite to be ~400x faster, bit more friendly...
r2309
Matt Mackall
Add doc notes about revert and hg status vs diff
r3829 This command schedules the files to be removed at the next commit.
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 To undo a remove before that, see :hg:`revert`.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if any warnings encountered.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Dirkjan Ochtman
improved semantics for remove (issue438)...
r6346
Matt Mackall
commands: initial audit of exit codes...
r11177 ret = 0
Dirkjan Ochtman
improved semantics for remove (issue438)...
r6346 after, force = opts.get('after'), opts.get('force')
if not pats and not after:
Vadim Gelfer
add --after option to remove command.
r2179 raise util.Abort(_('no files specified'))
Dirkjan Ochtman
improved semantics for remove (issue438)...
r6346
Matt Mackall
walk: remove remaining users of cmdutils.matchpats
r6582 m = cmdutil.match(repo, pats, opts)
Matt Mackall
remove: work directly off status...
r6761 s = repo.status(match=m, clean=True)
modified, added, deleted, clean = s[0], s[1], s[3], s[6]
Benoit Boissinot
remove: warn if unversionned files are specified (issue1454)
r8533 for f in m.files():
if f not in repo.dirstate and not os.path.isdir(m.rel(f)):
ui.warn(_('not removing %s: file is untracked\n') % m.rel(f))
Matt Mackall
commands: initial audit of exit codes...
r11177 ret = 1
Benoit Boissinot
remove: warn if unversionned files are specified (issue1454)
r8533
Matt Mackall
remove: work directly off status...
r6761 def warn(files, reason):
for f in files:
ui.warn(_('not removing %s: file %s (use -f to force removal)\n')
% (m.rel(f), reason))
Matt Mackall
commands: initial audit of exit codes...
r11177 ret = 1
Matt Mackall
remove: work directly off status...
r6761
if force:
remove, forget = modified + deleted + clean, added
elif after:
remove, forget = deleted, []
warn(modified + added + clean, _('still exists'))
else:
remove, forget = deleted + clean, []
warn(modified, _('is modified'))
warn(added, _('has been marked for add'))
Matt Mackall
replace util.sort with sorted built-in...
r8209 for f in sorted(remove + forget):
Matt Mackall
remove: work directly off status...
r6761 if ui.verbose or not m.exact(f):
ui.status(_('removing %s\n') % m.rel(f))
Dirkjan Ochtman
improved semantics for remove (issue438)...
r6346
Dirkjan Ochtman
move working dir/dirstate methods from localrepo to workingctx
r11303 repo[None].forget(forget)
repo[None].remove(remove, unlink=not after)
Matt Mackall
commands: initial audit of exit codes...
r11177 return ret
mpm@selenic.com
big heap of command clean-up work...
r245
Bryan O'Sullivan
Add rename/mv command....
r1253 def rename(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """rename files; equivalent of copy + remove
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Mark dest as copies of sources; mark sources for deletion. If dest
is a directory, copies are put in that directory. If dest is a
file, there can only be one source.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
By default, this command copies the contents of files as they
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 exist in the working directory. If invoked with -A/--after, the
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 operation is recorded, but no copying is performed.
timeless
help: miscellaneous language fixes
r7807 This command takes effect at the next commit. To undo a rename
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 before that, see :hg:`revert`.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if errors are encountered.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
repo locks: use True/False
r4914 wlock = repo.wlock(False)
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 try:
Matt Mackall
copy: handle rename internally...
r5610 return cmdutil.copy(ui, repo, pats, opts, rename=True)
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 finally:
Ronny Pfannschmidt
switch lock releasing in the core from gc to explicit
r8109 wlock.release()
Bryan O'Sullivan
Add rename/mv command....
r1253
Matt Mackall
resolve: new command...
r6518 def resolve(ui, repo, *pats, **opts):
Greg Ward
resolve: rewrite help to be clearer and more complete (issue2030).
r10559 """various operations to help finish a merge
This command includes several actions that are often useful while
performing a merge, after running ``merge`` but before running
``commit``. (It is only meaningful if your working directory has
two parents.) It is most relevant for merges with unresolved
conflicts, which are typically a result of non-interactive merging with
``internal:merge`` or a command-line merge tool like ``diff3``.
The available actions are:
1) list files that were merged with conflicts (U, for unresolved)
and without conflicts (R, for resolved): ``hg resolve -l``
(this is like ``status`` for merges)
2) record that you have resolved conflicts in certain files:
``hg resolve -m [file ...]`` (default: mark all unresolved files)
3) forget that you have resolved conflicts in certain files:
``hg resolve -u [file ...]`` (default: unmark all resolved files)
4) discard your current attempt(s) at resolving conflicts and
restart the merge from scratch: ``hg resolve file...``
(or ``-a`` for all unresolved files)
Note that Mercurial will not let you commit files with unresolved merge
conflicts. You must use ``hg resolve -m ...`` before you can commit
after a conflicting merge.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if any files fail a resolve attempt.
Matt Mackall
resolve: new command...
r6518 """
timeless
commands: adding --no-status to resolve to match status
r9646 all, mark, unmark, show, nostatus = \
[opts.get(o) for o in 'all mark unmark list no_status'.split()]
Matt Mackall
resolve: require -a switch to resolve all files...
r7527
if (show and (mark or unmark)) or (mark and unmark):
Matt Mackall
resolve: new command...
r6518 raise util.Abort(_("too many options specified"))
Matt Mackall
resolve: require -a switch to resolve all files...
r7527 if pats and all:
raise util.Abort(_("can't specify --all and patterns"))
if not (all or pats or show or mark or unmark):
raise util.Abort(_('no files or directories specified; '
'use --all to remerge all files'))
Matt Mackall
resolve: new command...
r6518
Benoit Boissinot
style: use consistent variable names (*mod) with imports which would shadow
r10651 ms = mergemod.mergestate(repo)
Matt Mackall
resolve: use cmdutil.match
r6594 m = cmdutil.match(repo, pats, opts)
Matt Mackall
commands: initial audit of exit codes...
r11177 ret = 0
Matt Mackall
resolve: new command...
r6518
for f in ms:
Matt Mackall
resolve: use cmdutil.match
r6594 if m(f):
Matt Mackall
resolve: require -a switch to resolve all files...
r7527 if show:
timeless
commands: adding --no-status to resolve to match status
r9646 if nostatus:
ui.write("%s\n" % f)
else:
Brodie Rao
status: make use of output labeling
r10817 ui.write("%s %s\n" % (ms[f].upper(), f),
label='resolve.' +
{'u': 'unresolved', 'r': 'resolved'}[ms[f]])
Matt Mackall
resolve: require -a switch to resolve all files...
r7527 elif mark:
Matt Mackall
resolve: new command...
r6518 ms.mark(f, "r")
Matt Mackall
resolve: require -a switch to resolve all files...
r7527 elif unmark:
Matt Mackall
resolve: new command...
r6518 ms.mark(f, "u")
else:
Matt Mackall
use repo[changeid] to get a changectx
r6747 wctx = repo[None]
Matt Mackall
resolve: new command...
r6518 mctx = wctx.parents()[-1]
Matt Mackall
resolve: keep .orig files
r7847
# backup pre-resolve (merge uses .orig for its own purposes)
a = repo.wjoin(f)
util.copyfile(a, a + ".resolve")
# resolve file
Matt Mackall
commands: initial audit of exit codes...
r11177 if ms.resolve(f, wctx, mctx):
ret = 1
Matt Mackall
resolve: new command...
r6518
Matt Mackall
resolve: keep .orig files
r7847 # replace filemerge's .orig file with our resolve file
util.rename(a + ".resolve", a + ".orig")
Matt Mackall
commands: initial audit of exit codes...
r11177 return ret
Matt Mackall
resolve: keep .orig files
r7847
Benoit Boissinot
make revert use standard matcher
r1472 def revert(ui, repo, *pats, **opts):
Martin Geisler
expand "dir" to "directory" in help texts
r8026 """restore individual files or directories to an earlier state
Matt Mackall
imported patch rev-help
r5574
Mads Kiilerich
revert: Make it clearer when not to use revert
r11459 NOTE: This command is most likely not what you are looking for. revert
will partially overwrite content in the working directory without changing
the working directory parents. Use :hg:`update -r rev` to check out earlier
revisions, or :hg:`update --clean .` to undo a merge which has added
another parent.
Vadim Gelfer
fix doc comments for revert command. people found them confusing.
r2204
Vadim Gelfer
revert: require explicit revision when working dir has two parents.
r2212 With no revision specified, revert the named files or directories
to the contents they had in the parent of the working directory.
This restores the contents of the affected files to an unmodified
Matt Mackall
Add doc notes about revert and hg status vs diff
r3829 state and unschedules adds, removes, copies, and renames. If the
timeless
help: Improved body text
r10376 working directory has two parents, you must explicitly specify a
revision.
Benoit Boissinot
resync commands.py docstrings with hg.1.txt
r1811
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 Using the -r/--rev option, revert the given files or directories
to their contents as of a specific revision. This can be helpful
Martin Geisler
Use hg role in help strings
r10973 to "roll back" some or all of an earlier change. See :hg:`help
dates` for a list of formats valid for -d/--date.
Benoit Boissinot
resync commands.py docstrings with hg.1.txt
r1811
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 Revert modifies the working directory. It does not commit any
changes, or change the parent of the working directory. If you
Vadim Gelfer
fix doc comments for revert command. people found them confusing.
r2204 revert to a revision other than the parent of the working
directory, the reverted files will thus appear modified
afterwards.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 If a file has been deleted, it is restored. If the executable mode
of a file was changed, it is reset.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Benoit Boissinot
make revert use standard matcher
r1472 If names are given, all files matching the names are reverted.
Vadim Gelfer
revert: require --all to revert all files.
r2982 If no arguments are given, no files are reverted.
Matt Mackall
imported patch rev-help
r5574
Modified files are saved with a .orig suffix before reverting.
To disable these backups, use --no-backup.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Vadim Gelfer
revert: require --all to revert all files.
r2982
Matt Mackall
Add --date support to update and revert...
r3814 if opts["date"]:
if opts["rev"]:
raise util.Abort(_("you can't specify a revision and a date"))
opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
Alexander Solovyov
commands: optional options where possible...
r7131 if not pats and not opts.get('all'):
Benoit Boissinot
Add a hint for revert --all when aborting
r3020 raise util.Abort(_('no files or directories specified; '
'use --all to revert the whole repo'))
Vadim Gelfer
revert: require --all to revert all files.
r2982
Vadim Gelfer
revert: require explicit revision when working dir has two parents.
r2212 parent, p2 = repo.dirstate.parents()
Alexander Solovyov
commands: optional options where possible...
r7131 if not opts.get('rev') and p2 != nullid:
Brendan Cully
Move defaultrev into changectx...
r3132 raise util.Abort(_('uncommitted merge - please provide a '
'specific revision'))
Alexander Solovyov
commands: optional options where possible...
r7131 ctx = repo[opts.get('rev')]
Benoit Boissinot
commands.py: use contexts in various places (debug*state, revert)
r3972 node = ctx.node()
mf = ctx.manifest()
Vadim Gelfer
revert: better fix for not printing 'reverting' message
r2407 if node == parent:
pmf = mf
else:
pmf = None
Vadim Gelfer
rewrite revert command. fix issues 93, 123, 147....
r2029
Vadim Gelfer
small changes to revert command....
r2042 # need all matching names in dirstate and manifest of target rev,
# so have to walk both. do not print errors if files exist in one
# but not other.
Vadim Gelfer
rewrite revert command. fix issues 93, 123, 147....
r2029 names = {}
Vadim Gelfer
small changes to revert command....
r2042
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 wlock = repo.wlock()
try:
# walk dirstate.
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579
m = cmdutil.match(repo, pats, opts)
Matt Mackall
many, many trivial check-code fixups
r10282 m.bad = lambda x, y: False
Matt Mackall
walk: return a single value
r6586 for abs in repo.walk(m):
Matt Mackall
walk: remove rel and exact returns
r6584 names[abs] = m.rel(abs), m.exact(abs)
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915
# walk target manifest.
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579 def badfn(path, msg):
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 if path in names:
Matt Mackall
add: use match.bad callback more effectively
r8679 return
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 path_ = path + '/'
for f in names:
if f.startswith(path_):
Matt Mackall
add: use match.bad callback more effectively
r8679 return
Martin Geisler
use ui instead of repo.ui when the former is in scope
r8615 ui.warn("%s: %s\n" % (m.rel(path), msg))
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579 m = cmdutil.match(repo, pats, opts)
m.bad = badfn
Matt Mackall
context: add walk method
r6764 for abs in repo[node].walk(m):
Matt Mackall
walk: remove rel and exact returns
r6584 if abs not in names:
names[abs] = m.rel(abs), m.exact(abs)
Alexis S. L. Carvalho
revert: don't assume ignored files will be returned in the unknown list...
r6031
Matt Mackall
status: use match helpers for various users
r6599 m = cmdutil.matchfiles(repo, names)
Matt Mackall
match: remove files arg from repo.status and friends
r6603 changes = repo.status(match=m)[:4]
Martin Geisler
replace set-like dictionaries with real sets...
r8152 modified, added, removed, deleted = map(set, changes)
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915
Brendan Cully
Merge with crew-stable
r5266 # if f is a rename, also revert the source
cwd = repo.getcwd()
for f in added:
src = repo.dirstate.copied(f)
if src and src not in names and repo.dirstate[src] == 'r':
Martin Geisler
replace set-like dictionaries with real sets...
r8152 removed.add(src)
Brendan Cully
Merge with crew-stable
r5266 names[src] = (repo.pathto(src, cwd), True)
Alexis S. L. Carvalho
revert: unify forget and remove lists...
r6109 def removeforget(abs):
if repo.dirstate[abs] == 'a':
return _('forgetting %s\n')
return _('removing %s\n')
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 revert = ([], _('reverting %s\n'))
add = ([], _('adding %s\n'))
Alexis S. L. Carvalho
revert: unify forget and remove lists...
r6109 remove = ([], removeforget)
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 undelete = ([], _('undeleting %s\n'))
disptable = (
# dispatch table:
# file state
# action if in target manifest
# action if not in target manifest
# make backup if in target manifest
# make backup if not in target manifest
(modified, revert, remove, True, True),
Alexis S. L. Carvalho
revert: unify forget and remove lists...
r6109 (added, revert, remove, True, False),
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 (removed, undelete, None, False, False),
(deleted, revert, remove, False, False),
)
Matt Mackall
replace util.sort with sorted built-in...
r8209 for abs, (rel, exact) in sorted(names.items()):
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 mfentry = mf.get(abs)
target = repo.wjoin(abs)
def handle(xlist, dobackup):
xlist[0].append(abs)
Alexander Solovyov
commands: optional options where possible...
r7131 if dobackup and not opts.get('no_backup') and util.lexists(target):
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 bakname = "%s.orig" % rel
ui.note(_('saving current version of %s as %s\n') %
(rel, bakname))
if not opts.get('dry_run'):
Mads Kiilerich
revert: rename original to .orig instead of copying (issue2282)...
r11629 util.rename(target, bakname)
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 if ui.verbose or not exact:
Alexis S. L. Carvalho
revert: unify forget and remove lists...
r6109 msg = xlist[1]
if not isinstance(msg, basestring):
msg = msg(abs)
ui.status(msg % rel)
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 for table, hitlist, misslist, backuphit, backupmiss in disptable:
Matt Mackall
many, many trivial check-code fixups
r10282 if abs not in table:
continue
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 # file has changed in dirstate
if mfentry:
handle(hitlist, backuphit)
elif misslist is not None:
handle(misslist, backupmiss)
break
Vadim Gelfer
rewrite revert command. fix issues 93, 123, 147....
r2029 else:
Alexis S. L. Carvalho
revert: don't assume ignored files will be returned in the unknown list...
r6031 if abs not in repo.dirstate:
if mfentry:
handle(add, True)
elif exact:
ui.warn(_('file not managed: %s\n') % rel)
continue
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 # file has not changed in dirstate
if node == parent:
Matt Mackall
many, many trivial check-code fixups
r10282 if exact:
ui.warn(_('no changes needed to %s\n') % rel)
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 continue
if pmf is None:
# only need parent manifest in this unlikely case,
# so do not read by default
Matt Mackall
use repo[changeid] to get a changectx
r6747 pmf = repo[parent].manifest()
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 if abs in pmf:
if mfentry:
# if version of file is same in parent and target
# manifests, do nothing
Alexis S. L. Carvalho
revert: revert clean files when only a change of flags is needed
r6030 if (pmf[abs] != mfentry or
pmf.flags(abs) != mf.flags(abs)):
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 handle(revert, False)
else:
handle(remove, False)
if not opts.get('dry_run'):
Alexis S. L. Carvalho
commands.revert: don't call hg.revert...
r6107 def checkout(f):
fc = ctx[f]
Matt Mackall
simplify flag handling...
r6743 repo.wwrite(f, fc.data(), fc.flags())
Alexis S. L. Carvalho
commands.revert: don't call hg.revert...
r6107
Alexis S. L. Carvalho
revert: unify forget and remove lists...
r6109 audit_path = util.path_auditor(repo.root)
for f in remove[0]:
if repo.dirstate[f] == 'a':
repo.dirstate.forget(f)
continue
audit_path(f)
try:
util.unlink(repo.wjoin(f))
except OSError:
pass
repo.dirstate.remove(f)
Alexis S. L. Carvalho
commands.revert: don't call hg.revert...
r6107
Alexis S. L. Carvalho
revert: update state of files in the "checkout" list...
r6299 normal = None
if node == parent:
# We're reverting to our parent. If possible, we'd like status
# to report the file as clean. We have to use normallookup for
# merges to avoid losing information about merged/dirty files.
if p2 != nullid:
normal = repo.dirstate.normallookup
else:
normal = repo.dirstate.normal
Alexis S. L. Carvalho
commands.revert: don't call hg.revert...
r6107 for f in revert[0]:
checkout(f)
Alexis S. L. Carvalho
revert: update state of files in the "checkout" list...
r6299 if normal:
normal(f)
Alexis S. L. Carvalho
commands.revert: don't call hg.revert...
r6107
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 for f in add[0]:
Alexis S. L. Carvalho
commands.revert: don't call hg.revert...
r6107 checkout(f)
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 repo.dirstate.add(f)
Alexis S. L. Carvalho
commands.revert: don't call hg.revert...
r6107
Alexis S. L. Carvalho
revert: only call dirstate.normal when we know the file is clean
r6108 normal = repo.dirstate.normallookup
if node == parent and p2 == nullid:
normal = repo.dirstate.normal
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 for f in undelete[0]:
Alexis S. L. Carvalho
commands.revert: don't call hg.revert...
r6107 checkout(f)
Alexis S. L. Carvalho
revert: only call dirstate.normal when we know the file is clean
r6108 normal(f)
Alexis S. L. Carvalho
commands.revert: don't call hg.revert...
r6107
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 finally:
Ronny Pfannschmidt
switch lock releasing in the core from gc to explicit
r8109 wlock.release()
mpm@selenic.com
[PATCH] hg revert...
r588
Steve Borho
rollback: add dry-run argument, emit transaction description
r10882 def rollback(ui, repo, **opts):
Matt Mackall
commands: improve some command summaries
r10889 """roll back the last transaction (dangerous)
Matt Mackall
imported patch rollback-help
r5575
This command should be used with care. There is only one level of
rollback, and there is no way to undo a rollback. It will also
restore the dirstate at the time of the last transaction, losing
Matt Mackall
rollback: minor clarification (issue828)
r8856 any dirstate changes since that time. This command does not alter
the working directory.
Vadim Gelfer
deprecate undo command, replace with rollback command.
r2227
Transactions are used to encapsulate the effects of all commands
that create new changesets or propagate existing changesets into a
repository. For example, the following commands are transactional,
Martin Geisler
commands, dates: use real lists instead of literal blocks
r9893 and their effects can be rolled back:
- commit
- import
- pull
timeless
help: Improved body text
r10376 - push (with this repository as the destination)
Martin Geisler
commands, dates: use real lists instead of literal blocks
r9893 - unbundle
Vadim Gelfer
deprecate undo command, replace with rollback command.
r2227
This command is not intended for use on public repositories. Once
changes are visible for pull by other users, rolling a transaction
back locally is ineffective (someone else may already have pulled
the changes). Furthermore, a race is possible with readers of the
repository; for example an in-progress pull from the repository
may fail if a rollback is performed.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if no rollback data is available.
Vadim Gelfer
deprecate undo command, replace with rollback command.
r2227 """
Matt Mackall
commands: initial audit of exit codes...
r11177 return repo.rollback(opts.get('dry_run'))
Vadim Gelfer
deprecate undo command, replace with rollback command.
r2227
mpm@selenic.com
[PATCH] add "root" command...
r468 def root(ui, repo):
Martin Geisler
expand "dir" to "directory" in help texts
r8026 """print the root (top) of the current working directory
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Print the root directory of the current repository.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
mpm@selenic.com
[PATCH] add "root" command...
r468 ui.write(repo.root + "\n")
mpm@selenic.com
big heap of command clean-up work...
r245 def serve(ui, repo, **opts):
Matt Mackall
commands: improve some command summaries
r10889 """start stand-alone webserver
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: explain that "hg serve" is mostly for ad-hoc sharing
r11102 Start a local HTTP repository browser and pull server. You can use
this for ad-hoc sharing and browing of repositories. It is
recommended to use a real web server to serve a repository for
longer periods of time.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: explain that "hg serve" does not do authentication
r11103 Please note that the server does not implement access control.
This means that, by default, anybody can read from the server and
nobody can write to it by default. Set the ``web.allow_push``
option to ``*`` to allow everybody to push to the server. You
should use a real web server if you need to authenticate users.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 By default, the server logs accesses to stdout and errors to
Martin Geisler
write options in "-r/--rev" style in help texts
r8277 stderr. Use the -A/--accesslog and -E/--errorlog options to log to
files.
Bryan O'Sullivan
serve: allow --port=0 to specify "server chooses the port number"
r10629
To have the server choose a free port number to listen on, specify
a port number of 0; in this case, the server will print the port
number it uses.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
Add an sshrepository class and hg serve --stdio
r624
if opts["stdio"]:
Thomas Arendsen Hein
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
r2127 if repo is None:
Matt Mackall
error: move repo errors...
r7637 raise error.RepoError(_("There is no Mercurial repository here"
Joel Rosdahl
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
r6217 " (.hg not found)"))
Vadim Gelfer
refactor ssh server.
r2396 s = sshserver.sshserver(ui, repo)
s.serve_forever()
Matt Mackall
Give a response to unknown SSH commands
r2363
Benoit Boissinot
serve: fix port config
r10635 # this way we can check if something was given in the command-line
if opts.get('port'):
opts['port'] = int(opts.get('port'))
Matt Mackall
ui: kill most users of parentui name and arg, replace with .copy()
r8190 baseui = repo and repo.baseui or ui
Michele Cella
adding "prefix" option to "hg serve" (command line and [web] section)...
r5835 optlist = ("name templates style address port prefix ipv6"
Dirkjan Ochtman
server: initialize wsgi app in command, then wrap server around it
r10644 " accesslog errorlog certificate encoding")
mpm@selenic.com
hgweb: change startup argument processing...
r987 for o in optlist.split():
Benoit Boissinot
serve: fix options recording, trailing whitespace
r10630 val = opts.get(o, '')
Thomas Arendsen Hein
make expression shorter, now the line fits into 80 chars
r10631 if val in (None, ''): # should check against default options instead
Benoit Boissinot
serve: fix options recording, trailing whitespace
r10630 continue
baseui.setconfig("web", o, val)
if repo and repo.ui != baseui:
repo.ui.setconfig("web", o, val)
mpm@selenic.com
hgweb: change startup argument processing...
r987
Matt Mackall
serve: webdir_conf -> webconf
r11003 o = opts.get('web_conf') or opts.get('webdir_conf')
Matt Mackall
hgweb: unify hgweb calls in serve
r11004 if not o:
if not repo:
raise error.RepoError(_("There is no Mercurial repository"
" here (.hg not found)"))
o = repo.root
app = hgweb.hgweb(o, baseui=ui)
Thomas Arendsen Hein
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
r2127
Benoit Boissinot
use new style classes
r8778 class service(object):
Bryan O'Sullivan
Refactor commands.serve to allow other commands to run as services....
r4380 def init(self):
Marcos Chaves
Handle CTRL+C in serve under Windows.
r4672 util.set_signal_handler()
Matt Mackall
hgweb: unify hgweb calls in serve
r11004 self.httpd = hgweb.server.create_server(ui, app)
Bryan O'Sullivan
Refactor commands.serve to allow other commands to run as services....
r4380
Bryan O'Sullivan
serve: allow --port=0 to specify "server chooses the port number"
r10629 if opts['port'] and not ui.verbose:
Matt Mackall
many, many trivial check-code fixups
r10282 return
Bryan O'Sullivan
Refactor commands.serve to allow other commands to run as services....
r4380
Michele Cella
hgweb: fixes to make hg serve prefix handling more robust
r5970 if self.httpd.prefix:
prefix = self.httpd.prefix.strip('/') + '/'
else:
prefix = ''
Stephen Deasey
hgweb: clarify which address and port can/cannot be bound at startup (bug 769)...
r6262 port = ':%d' % self.httpd.port
if port == ':80':
port = ''
Benoit Boissinot
hg serve: add clearer message when starting the server with --verbose...
r6419 bindaddr = self.httpd.addr
if bindaddr == '0.0.0.0':
bindaddr = '*'
elif ':' in bindaddr: # IPv6
bindaddr = '[%s]' % bindaddr
fqaddr = self.httpd.fqaddr
if ':' in fqaddr:
fqaddr = '[%s]' % fqaddr
Bryan O'Sullivan
serve: allow --port=0 to specify "server chooses the port number"
r10629 if opts['port']:
Benoit Boissinot
serve: fix options recording, trailing whitespace
r10630 write = ui.status
Bryan O'Sullivan
serve: allow --port=0 to specify "server chooses the port number"
r10629 else:
write = ui.write
write(_('listening at http://%s%s/%s (bound to %s:%d)\n') %
(fqaddr, port, prefix, bindaddr, self.httpd.port))
Bryan O'Sullivan
Refactor commands.serve to allow other commands to run as services....
r4380
def run(self):
self.httpd.serve_forever()
service = service()
cmdutil.service(opts, initfn=service.init, runfn=service.run)
mpm@selenic.com
[PATCH] Clean up destination directory if a clone fails....
r500
Bryan O'Sullivan
Add name matching to status command.
r731 def status(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """show changed files in the working directory
mpm@selenic.com
commands: migrate status and branch...
r213
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 Show status of files in the repository. If names are given, only
files that match are shown. Files that are clean or ignored or
timeless
Improve English for help text of many core hg commands....
r8779 the source of a copy/move operation, are not listed unless
-c/--clean, -i/--ignored, -C/--copies or -A/--all are given.
Unless options described with "show only ..." are given, the
options -mardu are used.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Thomas Arendsen Hein
Extend/correct acc40572da5b regarding -qA and ignored files....
r6201 Option -q/--quiet hides untracked (unknown and ignored) files
Wagner Bruna
commands: fix typo on flag description
r8009 unless explicitly requested with -u/--unknown or -i/--ignored.
Zoran Bosnjak
'hg status -q' output skips non-tracked files....
r6200
Matt Mackall
Add notes about diff/merge asymmetry to export, diff, and log
r3822 NOTE: status may appear to disagree with diff if permissions have
changed or a merge has occurred. The standard diff format does not
report permission changes and diff only reports changes relative
to one merge parent.
Brendan Cully
Add --rev option to status
r3467 If one revision is given, it is used as the base revision.
timeless
Improve English for help text of many core hg commands....
r8779 If two revisions are given, the differences between them are
Gilles Moris
status: add the --change option to display files changed in a revision...
r10014 shown. The --change option can also be used as a shortcut to list
the changed files of a revision from its first parent.
Brendan Cully
Add --rev option to status
r3467
Martin Geisler
commands: use minirst parser when displaying help
r9157 The codes used to show the status of files are::
M = modified
A = added
R = removed
C = clean
! = missing (deleted by non-hg command, but still tracked)
? = not tracked
I = ignored
= origin of the previous file listed as A (added)
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
mpm@selenic.com
Optimize diff and status in subdirectories...
r312
Gilles Moris
status: add the --change option to display files changed in a revision...
r10014 revs = opts.get('rev')
change = opts.get('change')
if revs and change:
msg = _('cannot specify --rev and --change at the same time')
raise util.Abort(msg)
elif change:
node2 = repo.lookup(change)
node1 = repo[node2].parents()[0].node()
else:
node1, node2 = cmdutil.revpair(repo, revs)
Benoit Boissinot
correct the relative path when walking from a subdir...
r1625 cwd = (pats and repo.getcwd()) or ''
Alexander Solovyov
commands: optional options where possible...
r7131 end = opts.get('print0') and '\0' or '\n'
Matt Mackall
status: find copies and renames beyond the working directory
r6276 copy = {}
Matt Mackall
status: refactor status command...
r6605 states = 'modified added removed deleted unknown ignored clean'.split()
Alexander Solovyov
status: make options optional (issue1481)
r7684 show = [k for k in states if opts.get(k)]
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('all'):
Matt Mackall
status: refactor status command...
r6605 show += ui.quiet and (states[:4] + ['clean']) or states
if not show:
show = ui.quiet and states[:4] or states[:5]
stat = repo.status(node1, node2, cmdutil.match(repo, pats, opts),
'ignored' in show, 'clean' in show, 'unknown' in show)
changestates = zip(states, 'MAR!?IC', stat)
Alexander Solovyov
commands: optional options where possible...
r7131 if (opts.get('all') or opts.get('copies')) and not opts.get('no_status'):
Matt Mackall
use repo[changeid] to get a changectx
r6747 ctxn = repo[nullid]
ctx1 = repo[node1]
ctx2 = repo[node2]
Matt Mackall
copies: teach copies about dirstate.copies...
r6646 added = stat[1]
if node2 is None:
added = stat[0] + stat[1] # merged?
Matt Mackall
use repo.changectx(None) to get a workingctx
r6740
Dirkjan Ochtman
use dict.iteritems() rather than dict.items()...
r7622 for k, v in copies.copies(repo, ctx1, ctx2, ctxn)[0].iteritems():
Matt Mackall
copies: teach copies about dirstate.copies...
r6646 if k in added:
copy[k] = v
elif v in added:
Matt Mackall
status: find copies and renames beyond the working directory
r6276 copy[v] = k
Matt Mackall
status: refactor status command...
r6605 for state, char, files in changestates:
if state in show:
Thomas Arendsen Hein
hg status cleanups: Don't translate long options, remove stray semicolon.
r1966 format = "%s %%s%s" % (char, end)
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('no_status'):
Matt Mackall
status: refactor status command...
r6605 format = "%%s%s" % end
for f in files:
Brodie Rao
status: make use of output labeling
r10817 ui.write(format % repo.pathto(f, cwd),
label='status.' + state)
Matt Mackall
status: refactor status command...
r6605 if f in copy:
Brodie Rao
status: make use of output labeling
r10817 ui.write(' %s%s' % (repo.pathto(copy[f], cwd), end),
label='status.copied')
mpm@selenic.com
commands: migrate status and branch...
r213
Matt Mackall
summary: add --remote
r9620 def summary(ui, repo, **opts):
Matt Mackall
Introduce summary command
r9603 """summarize working directory state
This generates a brief summary of the working directory state,
including parents, branch, commit status, and available updates.
Matt Mackall
summary: add --remote
r9620
With the --remote option, this will check the default paths for
incoming and outgoing changes. This can be time-consuming.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Matt Mackall
Introduce summary command
r9603 """
ctx = repo[None]
parents = ctx.parents()
pnode = parents[0].node()
for p in parents:
Eric Eisner
summary: make use of output labeling...
r10832 # label with log.changeset (instead of log.parent) since this
# shows a working directory parent *changeset*:
ui.write(_('parent: %d:%s ') % (p.rev(), str(p)),
label='log.changeset')
Martin Geisler
commands: retrieve tags from context object
r10833 ui.write(' '.join(p.tags()), label='log.tag')
Matt Mackall
summary: add empty repository and no revision checked out hints
r9618 if p.rev() == -1:
if not len(repo):
Martin Geisler
commands: small refactoring in summary
r10834 ui.write(_(' (empty repository)'))
Matt Mackall
summary: add empty repository and no revision checked out hints
r9618 else:
Martin Geisler
commands: small refactoring in summary
r10834 ui.write(_(' (no revision checked out)'))
Eric Eisner
summary: make use of output labeling...
r10832 ui.write('\n')
Matt Mackall
summary: add empty repository and no revision checked out hints
r9618 if p.description():
Eric Eisner
summary: make use of output labeling...
r10832 ui.status(' ' + p.description().splitlines()[0].strip() + '\n',
label='log.summary')
Matt Mackall
Introduce summary command
r9603
branch = ctx.branch()
bheads = repo.branchheads(branch)
Matt Mackall
summary: note non-default branches with -q
r9873 m = _('branch: %s\n') % branch
if branch != 'default':
Eric Eisner
summary: make use of output labeling...
r10832 ui.write(m, label='log.branch')
Matt Mackall
summary: note non-default branches with -q
r9873 else:
Eric Eisner
summary: make use of output labeling...
r10832 ui.status(m, label='log.branch')
Matt Mackall
Introduce summary command
r9603
Matt Mackall
summary: various fixes, add a test...
r10390 st = list(repo.status(unknown=True))[:6]
Matt Mackall
summary: add subrepo status
r11088
Matt Mackall
summary: report copies and renames
r11331 c = repo.dirstate.copies()
copied, renamed = [], []
for d, s in c.iteritems():
if s in st[2]:
st[2].remove(s)
renamed.append(d)
else:
copied.append(d)
if d in st[1]:
st[1].remove(d)
st.insert(3, renamed)
st.insert(4, copied)
Benoit Boissinot
style: use consistent variable names (*mod) with imports which would shadow
r10651 ms = mergemod.mergestate(repo)
Matt Mackall
summary: various fixes, add a test...
r10390 st.append([f for f in ms if ms[f] == 'u'])
Matt Mackall
summary: add subrepo status
r11088
subs = [s for s in ctx.substate if ctx.sub(s).dirty()]
st.append(subs)
Eric Eisner
summary: make use of output labeling...
r10832 labels = [ui.label(_('%d modified'), 'status.modified'),
ui.label(_('%d added'), 'status.added'),
ui.label(_('%d removed'), 'status.removed'),
Matt Mackall
summary: report copies and renames
r11331 ui.label(_('%d renamed'), 'status.copied'),
ui.label(_('%d copied'), 'status.copied'),
Eric Eisner
summary: make use of output labeling...
r10832 ui.label(_('%d deleted'), 'status.deleted'),
ui.label(_('%d unknown'), 'status.unknown'),
ui.label(_('%d ignored'), 'status.ignored'),
Matt Mackall
summary: add subrepo status
r11088 ui.label(_('%d unresolved'), 'resolve.unresolved'),
ui.label(_('%d subrepos'), 'status.modified')]
Matt Mackall
Introduce summary command
r9603 t = []
Matt Mackall
many, many trivial check-code fixups
r10282 for s, l in zip(st, labels):
Martin Geisler
commands: do not split a translated string...
r9607 if s:
t.append(l % len(s))
Matt Mackall
Introduce summary command
r9603
t = ', '.join(t)
FUJIWARA Katsunori
summary: L10N messages hide clean-ness of workdir from 'hg summary'...
r10269 cleanworkdir = False
Matt Mackall
Introduce summary command
r9603
if len(parents) > 1:
Steve Borho
Backed out changeset: e1dde7363601
r11310 t += _(' (merge)')
Matt Mackall
Introduce summary command
r9603 elif branch != parents[0].branch():
Steve Borho
Backed out changeset: e1dde7363601
r11310 t += _(' (new branch)')
Gilles Moris
summary: show if commit will be from a closed head
r11165 elif (parents[0].extra().get('close') and
pnode in repo.branchheads(branch, closed=True)):
Steve Borho
Backed out changeset: e1dde7363601
r11310 t += _(' (head closed)')
Matt Mackall
summary: report copies and renames
r11331 elif not (st[0] or st[1] or st[2] or st[3] or st[4] or st[9]):
Steve Borho
Backed out changeset: e1dde7363601
r11310 t += _(' (clean)')
FUJIWARA Katsunori
summary: L10N messages hide clean-ness of workdir from 'hg summary'...
r10269 cleanworkdir = True
Matt Mackall
Introduce summary command
r9603 elif pnode not in bheads:
Steve Borho
Backed out changeset: e1dde7363601
r11310 t += _(' (new branch head)')
Matt Mackall
Introduce summary command
r9603
FUJIWARA Katsunori
summary: L10N messages hide clean-ness of workdir from 'hg summary'...
r10269 if cleanworkdir:
Steve Borho
Backed out changeset: e1dde7363601
r11310 ui.status(_('commit: %s\n') % t.strip())
Matt Mackall
summary: quieter with -q
r9605 else:
Steve Borho
Backed out changeset: e1dde7363601
r11310 ui.write(_('commit: %s\n') % t.strip())
Matt Mackall
Introduce summary command
r9603
# all ancestors of branch heads - all ancestors of parent = new csets
new = [0] * len(repo)
cl = repo.changelog
Matt Mackall
summary: various fixes, add a test...
r10390 for a in [cl.rev(n) for n in bheads]:
new[a] = 1
Matt Mackall
Introduce summary command
r9603 for a in cl.ancestors(*[cl.rev(n) for n in bheads]):
new[a] = 1
Matt Mackall
summary: various fixes, add a test...
r10390 for a in [p.rev() for p in parents]:
if a >= 0:
new[a] = 0
Matt Mackall
Introduce summary command
r9603 for a in cl.ancestors(*[p.rev() for p in parents]):
new[a] = 0
new = sum(new)
if new == 0:
Matt Mackall
summary: quieter with -q
r9605 ui.status(_('update: (current)\n'))
Matt Mackall
Introduce summary command
r9603 elif pnode not in bheads:
ui.write(_('update: %d new changesets (update)\n') % new)
else:
ui.write(_('update: %d new changesets, %d branch heads (merge)\n') %
(new, len(bheads)))
Matt Mackall
summary: add --remote
r9620 if opts.get('remote'):
t = []
Sune Foldager
fix remaining hg.parseurl uses
r10389 source, branches = hg.parseurl(ui.expandpath('default'))
Matt Mackall
remoteui: move from cmdutil to hg
r11273 other = hg.repository(hg.remoteui(repo, {}), source)
Sune Foldager
fix remaining hg.parseurl uses
r10389 revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev'))
Matt Mackall
summary: add --remote
r9620 ui.debug('comparing with %s\n' % url.hidepassword(source))
repo.ui.pushbuffer()
Dirkjan Ochtman
move discovery methods from localrepo into new discovery module
r11301 common, incoming, rheads = discovery.findcommonincoming(repo, other)
Matt Mackall
summary: add --remote
r9620 repo.ui.popbuffer()
if incoming:
t.append(_('1 or more incoming'))
Sune Foldager
fix remaining hg.parseurl uses
r10389 dest, branches = hg.parseurl(ui.expandpath('default-push', 'default'))
revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
Matt Mackall
remoteui: move from cmdutil to hg
r11273 other = hg.repository(hg.remoteui(repo, {}), dest)
Matt Mackall
summary: add --remote
r9620 ui.debug('comparing with %s\n' % url.hidepassword(dest))
repo.ui.pushbuffer()
Dirkjan Ochtman
move discovery methods from localrepo into new discovery module
r11301 o = discovery.findoutgoing(repo, other)
Matt Mackall
summary: add --remote
r9620 repo.ui.popbuffer()
Matt Mackall
summary: various fixes, add a test...
r10390 o = repo.changelog.nodesbetween(o, None)[0]
Matt Mackall
summary: add --remote
r9620 if o:
t.append(_('%d outgoing') % len(o))
if t:
ui.write(_('remote: %s\n') % (', '.join(t)))
else:
ui.status(_('remote: (synced)\n'))
John Coomes
tag: allow multiple tags to be added or removed...
r6321 def tag(ui, repo, name1, *names, **opts):
"""add one or more tags for the current or given revision
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Name a particular revision using <name>.
Tags are used to name particular revisions of the repository and are
Thomas Arendsen Hein
Fixed typo in tag help, found by John Coomes
r6220 very useful to compare different revisions, to go back to significant
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 earlier versions or to mark branch points as releases, etc.
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 If no revision is given, the parent of the working directory is
used, or tip if no revision is checked out.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
To facilitate version control, distribution, and merging of tags,
they are stored as a file named ".hgtags" which is managed
similarly to other project files and can be hand-edited if
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 necessary. The file '.hg/localtags' is used for local tags (not
Benoit Boissinot
deprecate the use of 'hg tag NAME [REV]'...
r1654 shared among repositories).
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help dates` for a list of formats valid for -d/--date.
Nicolas Dumazet
tag: warn users about tag/branch possible name conflicts...
r11063
Since tag names have priority over branch names during revision
lookup, using an existing branch name as a tag name is discouraged.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
John Coomes
tag: allow multiple tags to be added or removed...
r6321
Matt Mackall
context: avoid using None for working parent
r6739 rev_ = "."
Matt Mackall
tag: strip whitespace from tag names (issue2174)
r11169 names = [t.strip() for t in (name1,) + names]
Martin Geisler
replace set-like dictionaries with real sets...
r8152 if len(names) != len(set(names)):
John Coomes
tag: allow multiple tags to be added or removed...
r6321 raise util.Abort(_('tag names must be unique'))
for n in names:
if n in ['tip', '.', 'null']:
raise util.Abort(_('the name \'%s\' is reserved') % n)
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('rev') and opts.get('remove'):
Matt Mackall
tags: add --remove
r4213 raise util.Abort(_("--rev and --remove are incompatible"))
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('rev'):
Benoit Boissinot
fix 'hg tag <tagname> <revision>...
r1596 rev_ = opts['rev']
Alexander Solovyov
commands: optional options where possible...
r7131 message = opts.get('message')
if opts.get('remove'):
expectedtype = opts.get('local') and 'local' or 'global'
John Coomes
tag: allow multiple tags to be added or removed...
r6321 for n in names:
if not repo.tagtype(n):
raise util.Abort(_('tag \'%s\' does not exist') % n)
if repo.tagtype(n) != expectedtype:
Wagner Bruna
commands, i18n: avoid untranslated strings as message parameters
r8008 if expectedtype == 'global':
raise util.Abort(_('tag \'%s\' is not a global tag') % n)
else:
raise util.Abort(_('tag \'%s\' is not a local tag') % n)
Matt Mackall
tags: add --remove
r4213 rev_ = nullid
if not message:
Martin Geisler
do not translate commit messages...
r9183 # we don't translate commit messages
message = 'Removed tag %s' % ', '.join(names)
Alexander Solovyov
commands: optional options where possible...
r7131 elif not opts.get('force'):
John Coomes
tag: allow multiple tags to be added or removed...
r6321 for n in names:
if n in repo.tags():
raise util.Abort(_('tag \'%s\' already exists '
'(use -f to force)') % n)
Brendan Cully
Move defaultrev into changectx...
r3132 if not rev_ and repo.dirstate.parents()[1] != nullid:
raise util.Abort(_('uncommitted merge - please provide a '
'specific revision'))
Matt Mackall
use repo[changeid] to get a changectx
r6747 r = repo[rev_].node()
Matt Mackall
tag: shorten hash in default commit message...
r2967
if not message:
Martin Geisler
do not translate commit messages...
r9183 # we don't translate commit messages
message = ('Added tag %s for changeset %s' %
John Coomes
tag: allow multiple tags to be added or removed...
r6321 (', '.join(names), short(r)))
Matt Mackall
tag: shorten hash in default commit message...
r2967
Benoit Boissinot
fix incorrect date when committing a tag...
r6243 date = opts.get('date')
if date:
date = util.parsedate(date)
Steve Losh
tag: add -e/--edit option for modifying the commit message
r11185 if opts.get('edit'):
message = ui.edit(message, ui.username())
Alexander Solovyov
commands: optional options where possible...
r7131 repo.tag(names, r, message, opts.get('local'), opts.get('user'), date)
mpm@selenic.com
From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>...
r401
mpm@selenic.com
migrate remaining commands...
r248 def tags(ui, repo):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """list repository tags
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 This lists both regular and local tags. When the -v/--verbose
switch is used, a third column "local" is printed for local tags.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Thomas Arendsen Hein
Handle errors in .hgtags or hgrc [tags] section more gracefully....
r477
Matt Mackall
Only show long hashes with --debug, not --verbose
r2966 hexfunc = ui.debugflag and hex or short
Osku Salerma
Add --verbose support to tags command.
r5658 tagtype = ""
Matt Mackall
replace various uses of list.reverse()
r8210 for t, n in reversed(repo.tagslist()):
Osku Salerma
Add --verbose support to tags command.
r5658 if ui.quiet:
ui.write("%s\n" % t)
continue
mpm@selenic.com
migrate remaining commands...
r248 try:
Thomas Arendsen Hein
Removed trailing whitespace and tabs from python files
r4516 hn = hexfunc(n)
Osku Salerma
Add --verbose support to tags command.
r5658 r = "%5d:%s" % (repo.changelog.rev(n), hn)
Matt Mackall
errors: move revlog errors...
r7633 except error.LookupError:
Brendan Cully
Add revlog.LookupError exception, and use it instead of RevlogError....
r3930 r = " ?:%s" % hn
Thomas Arendsen Hein
Make 'hg tags -q' only list tag names without revision numbers and hashes,...
r2035 else:
Matt Mackall
move encoding bits from util to encoding...
r7948 spaces = " " * (30 - encoding.colwidth(t))
Osku Salerma
Add --verbose support to tags command.
r5658 if ui.verbose:
if repo.tagtype(t) == 'local':
tagtype = " local"
else:
tagtype = ""
ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype))
mpm@selenic.com
migrate remaining commands...
r248
Vadim Gelfer
add -p option to tip. for issue 64.
r1731 def tip(ui, repo, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """show the tip revision
timeless
Improve English for help text of many core hg commands....
r8779 The tip revision (usually just called the tip) is the changeset
most recently added to the repository (and therefore the most
recently changed head).
Patrick Mezard
Make tip help more helpful
r6364
Patrick Mezard
Remove unexpected "Alternately" word from tip help.
r6367 If you have just made a commit, that commit will be the tip. If
you have just pulled changes from another repository, the tip of
that repository becomes the current tip. The "tip" tag is special
and cannot be renamed or assigned to a different changeset.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer = cmdutil.show_changeset(ui, repo, opts)
displayer.show(repo[len(repo) - 1])
displayer.close()
mpm@selenic.com
big heap of command clean-up work...
r245
Giorgos Keramidas
unbundle: accept multiple file arguments...
r4699 def unbundle(ui, repo, fname1, *fnames, **opts):
"""apply one or more changegroup files
Apply one or more compressed changegroup files generated by the
bundle command.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if an update has unresolved files.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Giorgos Keramidas
unbundle: accept multiple file arguments...
r4699 fnames = (fname1,) + fnames
Patrick Mezard
commands: lock() the repo while unbundling (issue1004)
r6180
Ronny Pfannschmidt
switch lock releasing in the core from gc to explicit
r8109 lock = repo.lock()
Patrick Mezard
commands: lock() the repo while unbundling (issue1004)
r6180 try:
for fname in fnames:
Benoit Boissinot
use our urlopener (proxy handling, etc) instead of urllib
r7271 f = url.open(ui, fname)
Patrick Mezard
commands: lock() the repo while unbundling (issue1004)
r6180 gen = changegroup.readbundle(f, fname)
Matt Mackall
addchangegroup: pass in lock to release it before changegroup hook is called...
r11442 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname,
lock=lock)
Patrick Mezard
commands: lock() the repo while unbundling (issue1004)
r6180 finally:
Ronny Pfannschmidt
switch lock releasing in the core from gc to explicit
r8109 lock.release()
Giorgos Keramidas
unbundle: accept multiple file arguments...
r4699
Alexander Solovyov
commands: optional options where possible...
r7131 return postincoming(ui, repo, modheads, opts.get('update'), None)
mpm@selenic.com
Add preliminary support for the bundle and unbundle commands
r1218
Matt Mackall
update: add --check option
r8855 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False):
Matt Mackall
commands: improve some command summaries
r10889 """update working directory (or switch revisions)
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Update the repository's working directory to the specified
Stuart W Marks
help: describe new cross-branch behavior in update help text, plus cleanups
r9718 changeset.
Steve Losh
commands: fix update's help to be more accurate...
r11612 If no changeset is specified, attempt to update to the tip of the
current branch. If this changeset is a descendant of the working
Stuart W Marks
help: describe new cross-branch behavior in update help text, plus cleanups
r9718 directory's parent, update to it, otherwise abort.
The following rules apply when the working directory contains
uncommitted changes:
Stuart W Marks
help: improve wording of update help text
r9831 1. If neither -c/--check nor -C/--clean is specified, and if
the requested changeset is an ancestor or descendant of
the working directory's parent, the uncommitted changes
are merged into the requested changeset and the merged
result is left uncommitted. If the requested changeset is
not an ancestor or descendant (that is, it is on another
branch), the update is aborted and the uncommitted changes
Martin Geisler
commands: use enumerated lists in help texts
r9740 are preserved.
Stuart W Marks
help: describe new cross-branch behavior in update help text, plus cleanups
r9718
2. With the -c/--check option, the update is aborted and the
Martin Geisler
commands: use enumerated lists in help texts
r9740 uncommitted changes are preserved.
Stuart W Marks
help: describe new cross-branch behavior in update help text, plus cleanups
r9718
3. With the -C/--clean option, uncommitted changes are discarded and
Martin Geisler
commands: use enumerated lists in help texts
r9740 the working directory is updated to the requested changeset.
Stuart W Marks
help: describe new cross-branch behavior in update help text, plus cleanups
r9718
Martin Geisler
Use hg role in help strings
r10973 Use null as the changeset to remove the working directory (like
:hg:`clone -U`).
If you want to update just one file to an older changeset, use :hg:`revert`.
See :hg:`help dates` for a list of formats valid for -d/--date.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if there are unresolved files.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Daniel Holth
accept -r REV in more places...
r4450 if rev and node:
raise util.Abort(_("please specify just one revision"))
if not rev:
rev = node
Stuart W Marks
commands: forbid 'hg update --check --clean'
r9450 if check and clean:
Martin Geisler
commands: expand -c and -C in update error message
r9451 raise util.Abort(_("cannot specify both -c/--check and -C/--clean"))
Stuart W Marks
commands: forbid 'hg update --check --clean'
r9450
if check:
Matt Mackall
update: add --check option
r8855 # we could use dirty() but we can ignore merge and branch trivia
c = repo[None]
if c.modified() or c.added() or c.removed():
raise util.Abort(_("uncommitted local changes"))
Matt Mackall
Add --date support to update and revert...
r3814 if date:
Daniel Holth
accept -r REV in more places...
r4450 if rev:
Matt Mackall
Add --date support to update and revert...
r3814 raise util.Abort(_("you can't specify a revision and a date"))
Daniel Holth
accept -r REV in more places...
r4450 rev = cmdutil.finddate(ui, repo, date)
Matt Mackall
Add --date support to update and revert...
r3814
Matt Mackall
update: allow -c to jump branches if clean
r9187 if clean or check:
Daniel Holth
accept -r REV in more places...
r4450 return hg.clean(repo, rev)
Matt Mackall
Introduce update helper functions: update, merge, clean, and revert
r2808 else:
Daniel Holth
accept -r REV in more places...
r4450 return hg.update(repo, rev)
mpm@selenic.com
unify checkout and resolve into update...
r254
mpm@selenic.com
migrate verify...
r247 def verify(ui, repo):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """verify the integrity of the repository
Verify the integrity of the current repository.
This will perform an extensive check of the repository's
integrity, validating the hashes and checksums of each entry in
the changelog, manifest, and tracked files, as well as the
integrity of their crosslinks and indices.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if errors are encountered.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
Move repo.verify
r2778 return hg.verify(repo)
mpm@selenic.com
migrate verify...
r247
Matt Mackall
move show_version to version_
r3651 def version_(ui):
"""output version and copyright information"""
ui.write(_("Mercurial Distributed SCM (version %s)\n")
Matt Mackall
refactor version code...
r7632 % util.version())
Matt Mackall
move show_version to version_
r3651 ui.status(_(
Martin Geisler
commands: update copyright year to 2010
r10206 "\nCopyright (C) 2005-2010 Matt Mackall <mpm@selenic.com> and others\n"
Matt Mackall
move show_version to version_
r3651 "This is free software; see the source for copying conditions. "
"There is NO\nwarranty; "
"not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
))
mpm@selenic.com
hg help: use docstrings only...
r255 # Command options and aliases are listed here, alphabetically
Benoit Boissinot
factor opts: move globalopts to a more logical place...
r3187 globalopts = [
('R', 'repository', '',
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('repository root directory or name of overlay bundle file'),
_('REPO')),
('', 'cwd', '',
_('change working directory'), _('DIR')),
Benoit Boissinot
factor opts: move globalopts to a more logical place...
r3187 ('y', 'noninteractive', None,
_('do not prompt, assume \'yes\' for any required answers')),
('q', 'quiet', None, _('suppress output')),
('v', 'verbose', None, _('enable additional output')),
Wagner Bruna
commands: clarify --config syntax
r10541 ('', 'config', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('set/override config option (use \'section.name=value\')'),
_('CONFIG')),
Benoit Boissinot
factor opts: move globalopts to a more logical place...
r3187 ('', 'debug', None, _('enable debugging output')),
('', 'debugger', None, _('start debugger')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('', 'encoding', encoding.encoding, _('set the charset encoding'),
_('ENCODE')),
Matt Mackall
move encoding bits from util to encoding...
r7948 ('', 'encodingmode', encoding.encodingmode,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('set the charset encoding mode'), _('MODE')),
Martin Geisler
commands: slightly better help for --traceback
r9698 ('', 'traceback', None, _('always print a traceback on exception')),
Benoit Boissinot
factor opts: move globalopts to a more logical place...
r3187 ('', 'time', None, _('time how long the command takes')),
('', 'profile', None, _('print command execution profile')),
('', 'version', None, _('output version information and exit')),
('h', 'help', None, _('display help and exit')),
]
Benoit Boissinot
factor opts: --dry-run option
r3189 dryrunopts = [('n', 'dry-run', None,
_('do not perform actions, just print output'))]
Benoit Boissinot
factor opts: remote repo access options
r3190 remoteopts = [
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('e', 'ssh', '',
_('specify ssh command to use'), _('CMD')),
('', 'remotecmd', '',
_('specify hg command to run on the remote side'), _('CMD')),
Benoit Boissinot
factor opts: remote repo access options
r3190 ]
Benoit Boissinot
factor opts: walk options
r3188 walkopts = [
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('I', 'include', [],
_('include names matching the given patterns'), _('PATTERN')),
('X', 'exclude', [],
_('exclude names matching the given patterns'), _('PATTERN')),
Benoit Boissinot
factor opts: walk options
r3188 ]
Mathieu Clabaut
Uniformisation of commit help for -m and -l....
r3857 commitopts = [
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('m', 'message', '',
_('use text as commit message'), _('TEXT')),
('l', 'logfile', '',
_('read commit message from file'), _('FILE')),
Mathieu Clabaut
Uniformisation of commit help for -m and -l....
r3857 ]
Benoit Boissinot
refactor options from cmdtable...
r5147 commitopts2 = [
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('d', 'date', '',
_('record datecode as commit date'), _('DATE')),
('u', 'user', '',
_('record the specified user as committer'), _('USER')),
Benoit Boissinot
refactor options from cmdtable...
r5147 ]
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 templateopts = [
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('', 'style', '',
_('display using template map file'), _('STYLE')),
('', 'template', '',
_('display with template'), _('TEMPLATE')),
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 ]
logopts = [
('p', 'patch', None, _('show patch')),
Jim Correia
log-like commands now use -G for --graph, -g for --git
r7763 ('g', 'git', None, _('use git extended diff format')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('l', 'limit', '',
_('limit number of changes displayed'), _('NUM')),
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 ('M', 'no-merges', None, _('do not show merges')),
Yuya Nishihara
log: add --stat for diffstat output...
r11061 ('', 'stat', None, _('output diffstat-style summary of changes')),
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 ] + templateopts
Jason Orendorff
mq: qdiff: support all diffopts
r6668 diffopts = [
('a', 'text', None, _('treat all files as text')),
('g', 'git', None, _('use git extended diff format')),
timeless@mozdev.org
commands: Try to improve help options text for basic commands...
r10375 ('', 'nodates', None, _('omit dates from diff headers'))
Jason Orendorff
mq: qdiff: support all diffopts
r6668 ]
diffopts2 = [
('p', 'show-function', None, _('show which function each change is in')),
Martin Geisler
diff: change --inverse to --reverse...
r9857 ('', 'reverse', None, _('produce a diff that undoes the changes')),
Jason Orendorff
mq: qdiff: support all diffopts
r6668 ('w', 'ignore-all-space', None,
_('ignore white space when comparing lines')),
('b', 'ignore-space-change', None,
_('ignore changes in the amount of white space')),
('B', 'ignore-blank-lines', None,
_('ignore changes whose lines are all blank')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('U', 'unified', '',
_('number of lines of context to show'), _('NUM')),
Brodie Rao
diff: add --stat for diffstat output...
r9640 ('', 'stat', None, _('output diffstat-style summary of changes')),
Jason Orendorff
mq: qdiff: support all diffopts
r6668 ]
Brendan Cully
import: add similarity option (issue295)
r7402 similarityopts = [
('s', 'similarity', '',
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
Brendan Cully
import: add similarity option (issue295)
r7402 ]
mpm@selenic.com
Beginning of new command parsing interface...
r209 table = {
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 "^add": (add, walkopts + dryrunopts, _('[OPTION]... [FILE]...')),
Vadim Gelfer
addremove: do not deprecate....
r2955 "addremove":
Brendan Cully
import: add similarity option (issue295)
r7402 (addremove, similarityopts + walkopts + dryrunopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... [FILE]...')),
Dirkjan Ochtman
add a blame alias for annotate...
r6182 "^annotate|blame":
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 (annotate,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 [('r', 'rev', '',
_('annotate the specified revision'), _('REV')),
Thomas Arendsen Hein
Make annotate --follow an alias for -f/--file to behave like in older versions...
r10579 ('', 'follow', None,
_('follow copies/renames and list the filename (DEPRECATED)')),
Dirkjan Ochtman
commands: annotate follows by default, separate -f/--file option
r10369 ('', 'no-follow', None, _("don't follow copies and renames")),
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 ('a', 'text', None, _('treat all files as text')),
Thomas Arendsen Hein
Make annotae/grep print short dates with -q/--quiet....
r6134 ('u', 'user', None, _('list the author (long with -v)')),
Dirkjan Ochtman
commands: annotate follows by default, separate -f/--file option
r10369 ('f', 'file', None, _('list the filename')),
Thomas Arendsen Hein
Make annotae/grep print short dates with -q/--quiet....
r6134 ('d', 'date', None, _('list the date (short with -q)')),
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 ('n', 'number', None, _('list the revision number (default)')),
('c', 'changeset', None, _('list the changeset')),
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857 ('l', 'line-number', None,
_('show line number at the first appearance'))
Benoit Boissinot
factor opts: walk options
r3188 ] + walkopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...')),
Thomas Arendsen Hein
Cleanup archive command: Don't overwrite gettext, quoting in cmd table entry.
r2160 "archive":
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112 (archive,
[('', 'no-decode', None, _('do not pass files through decoders')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('p', 'prefix', '',
_('directory prefix for files in archive'), _('PREFIX')),
('r', 'rev', '',
_('revision to distribute'), _('REV')),
('t', 'type', '',
_('type of distribution to create'), _('TYPE')),
Benoit Boissinot
factor opts: walk options
r3188 ] + walkopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... DEST')),
Thomas Arendsen Hein
Small cleanups to backout command:...
r2159 "backout":
Vadim Gelfer
add backout command....
r2158 (backout,
Thomas Arendsen Hein
Small cleanups to backout command:...
r2159 [('', 'merge', None,
_('merge with old dirstate parent after backout')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('', 'parent', '',
_('parent to choose when backing out merge'), _('REV')),
('r', 'rev', '',
_('revision to backout'), _('REV')),
Benoit Boissinot
refactor options from cmdtable...
r5147 ] + walkopts + commitopts + commitopts2,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... [-r] REV')),
Thomas Arendsen Hein
realign commands table
r5778 "bisect":
(bisect,
[('r', 'reset', False, _('reset bisect state')),
('g', 'good', False, _('mark changeset good')),
('b', 'bad', False, _('mark changeset bad')),
('s', 'skip', False, _('skip testing changeset')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('c', 'command', '',
_('use command to check changeset state'), _('CMD')),
Thomas Arendsen Hein
realign commands table
r5778 ('U', 'noupdate', False, _('do not update to target'))],
timeless@mozdev.org
commands: add missing options in command line help
r9952 _("[-gbsr] [-U] [-c CMD] [REV]")),
Thomas Arendsen Hein
Updated command tables in commands.py and hgext extensions....
r4730 "branch":
(branch,
[('f', 'force', None,
Sune Foldager
branch: added more support for named branches...
r7006 _('set branch name even if it shadows an existing branch')),
('C', 'clean', None, _('reset branch name to parent branch name'))],
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-fC] [NAME]')),
Thomas Arendsen Hein
Updated command tables in commands.py and hgext extensions....
r4730 "branches":
(branches,
[('a', 'active', False,
Matt Mackall
branches: add --closed flag for consistency with heads
r8991 _('show only branches that have unmerged heads')),
('c', 'closed', False,
Matt Mackall
heads: more clarity for --closed
r9189 _('show normal and closed branches'))],
timeless@mozdev.org
commands: add missing options in command line help
r9952 _('[-ac]')),
mpm@selenic.com
Add preliminary support for the bundle and unbundle commands
r1218 "bundle":
(bundle,
Vadim Gelfer
add -f/--force to pull, incoming, outgoing, to work on unrelated repo....
r1959 [('f', 'force', None,
timeless@mozdev.org
commands: Try to improve help options text for basic commands...
r10375 _('run even when the destination is unrelated')),
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 ('r', 'rev', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('a changeset intended to be added to the destination'),
_('REV')),
Sune Foldager
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
r10379 ('b', 'branch', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('a specific branch you would like to bundle'),
_('BRANCH')),
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 ('', 'base', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('a base changeset assumed to be available at the destination'),
_('REV')),
Benoit Allard
add compression type type parameter to bundle command
r6570 ('a', 'all', None, _('bundle all changesets in the repository')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('t', 'type', 'bzip2',
_('bundle compression type to use'), _('TYPE')),
Benoit Boissinot
add remoteopts to bundle command
r3191 ] + remoteopts,
timeless@mozdev.org
commands: add missing options in command line help
r9952 _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "cat":
(cat,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 [('o', 'output', '',
_('print output to file with formatted name'), _('FORMAT')),
('r', 'rev', '',
_('print the given revision'), _('REV')),
Thomas Arendsen Hein
cat --decode: Drop short option, use opts.get() instead of opts[]...
r6094 ('', 'decode', None, _('apply any matching decode filter')),
Benoit Boissinot
factor opts: walk options
r3188 ] + walkopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... FILE...')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "^clone":
(clone,
Dirkjan Ochtman
improve help text for clone -U
r6625 [('U', 'noupdate', None,
timeless@mozdev.org
commands: Try to improve help options text for basic commands...
r10375 _('the clone will include an empty working copy (only a repository)')),
Adrian Buehlmann
clone: add option -u/--updaterev
r9714 ('u', 'updaterev', '',
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('revision, tag or branch to check out'), _('REV')),
Muli Ben-Yehuda
strictly adher to 80 chars per line
r1602 ('r', 'rev', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('include the specified changeset'), _('REV')),
Sune Foldager
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
r10379 ('b', 'branch', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('clone only the specified branch'), _('BRANCH')),
Thomas Arendsen Hein
Updated help synopsises and reordered some options. Dropped [-n] from revert.
r1816 ('', 'pull', None, _('use pull protocol to copy metadata')),
Vadim Gelfer
clone: change name of --stream to --uncompressed....
r2620 ('', 'uncompressed', None,
_('use uncompressed transfer (fast over LAN)')),
Benoit Boissinot
factor opts: remote repo access options
r3190 ] + remoteopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... SOURCE [DEST]')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "^commit|ci":
(commit,
Thomas Arendsen Hein
Add debugaddremove alias to addremove, so it doesn't show up in 'hg help'....
r2184 [('A', 'addremove', None,
_('mark new/missing files as added/removed before committing')),
John Mulligan
branch closing: mark closed branches with a 'close' extra...
r7655 ('', 'close-branch', None,
_('mark a branch as closed, hiding it from the branch list')),
Benoit Boissinot
refactor options from cmdtable...
r5147 ] + walkopts + commitopts + commitopts2,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... [FILE]...')),
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 "copy|cp":
(copy,
Thomas Arendsen Hein
Updated help synopsises and reordered some options. Dropped [-n] from revert.
r1816 [('A', 'after', None, _('record a copy that has already occurred')),
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 ('f', 'force', None,
Thomas Arendsen Hein
Updated help synopsises and reordered some options. Dropped [-n] from revert.
r1816 _('forcibly copy over an existing managed file')),
Benoit Boissinot
factor opts: --dry-run option
r3189 ] + walkopts + dryrunopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... [SOURCE]... DEST')),
"debugancestor": (debugancestor, [], _('[INDEX] REV1 REV2')),
Peter Arrenbrecht
debugbuilddag: build a changelog dag from a concise description...
r11337 "debugbuilddag":
(debugbuilddag,
[('m', 'mergeable-file', None, _('add single file mergeable changes')),
('a', 'appended-file', None, _('add single file all revs append to')),
('o', 'overwritten-file', None, _('add single file all revs overwrite')),
('n', 'new-file', None, _('add new file at each rev')),
],
_('[OPTION]... TEXT')),
Matt Mackall
commands: fix missing empty synopses
r9604 "debugcheckstate": (debugcheckstate, [], ''),
Dirkjan Ochtman
add debugcommands command: an easy to parse command + option index
r7880 "debugcommands": (debugcommands, [], _('[COMMAND]')),
Alexis S. L. Carvalho
add --options to debugcomplete and change bash_completion to use it...
r2034 "debugcomplete":
(debugcomplete,
[('o', 'options', None, _('show the command options'))],
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-o] CMD')),
Peter Arrenbrecht
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text...
r11336 "debugdag":
(debugdag,
[('t', 'tags', None, _('use tags as labels')),
('b', 'branches', None, _('annotate with branch names')),
('', 'dots', None, _('use dots for runs')),
('s', 'spaces', None, _('separate elements by spaces')),
],
_('[OPTION]... [FILE [REV]...]')),
Thomas Arendsen Hein
Sort commands table again and add some missing 'hg' in synopsises.
r5781 "debugdate":
(debugdate,
[('e', 'extended', None, _('try extended date formats'))],
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-e] DATE [RANGE]')),
"debugdata": (debugdata, [], _('FILE REV')),
"debugfsinfo": (debugfsinfo, [], _('[PATH]')),
"debugindex": (debugindex, [], _('FILE')),
"debugindexdot": (debugindexdot, [], _('FILE')),
Matt Mackall
commands: fix missing empty synopses
r9604 "debuginstall": (debuginstall, [], ''),
Matt Mackall
pushkey: add debugpushkey command for testing
r11371 "debugpushkey": (debugpushkey, [], _('REPO NAMESPACE [KEY OLD NEW]')),
Benoit Boissinot
add 'debugrebuildstate' to rebuild the dirstate from a given revision...
r1755 "debugrebuildstate":
(debugrebuildstate,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 [('r', 'rev', '',
_('revision to rebuild to'), _('REV'))],
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-r REV] [REV]')),
Thomas Arendsen Hein
Updated command tables in commands.py and hgext extensions....
r4730 "debugrename":
(debugrename,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 [('r', 'rev', '',
_('revision to debug'), _('REV'))],
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-r REV] FILE')),
Matt Mackall
revset: add a debugrevspec command
r11276 "debugrevspec":
(debugrevspec, [], ('REVSPEC')),
Thomas Arendsen Hein
Sort commands table again and add some missing 'hg' in synopsises.
r5781 "debugsetparents":
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 (debugsetparents, [], _('REV1 [REV2]')),
Alexis S. L. Carvalho
debugstate: add --nodates...
r6296 "debugstate":
(debugstate,
[('', 'nodates', None, _('do not display the saved mtime'))],
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]...')),
Matt Mackall
subrepo: introduce basic state parsing
r8812 "debugsub":
(debugsub,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 [('r', 'rev', '',
_('revision to check'), _('REV'))],
Matt Mackall
subrepo: introduce basic state parsing
r8812 _('[-r REV] [REV]')),
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 "debugwalk": (debugwalk, walkopts, _('[OPTION]... [FILE]...')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "^diff":
(diff,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 [('r', 'rev', [],
_('revision'), _('REV')),
('c', 'change', '',
_('change made by revision'), _('REV'))
Jason Orendorff
mq: qdiff: support all diffopts
r6668 ] + diffopts + diffopts2 + walkopts,
timeless
commands: mention diff -c
r10520 _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "^export":
(export,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 [('o', 'output', '',
_('print output to file with formatted name'), _('FORMAT')),
Alexander Solovyov
commands.export: accept -r option as revision specification...
r10015 ('', 'switch-parent', None, _('diff against the second parent')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('r', 'rev', [],
_('revisions to export'), _('REV')),
Jason Orendorff
mq: qdiff: support all diffopts
r6668 ] + diffopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... [-o OUTFILESPEC] REV...')),
Steve Losh
Add a forget command for easily untracking files....
r8902 "^forget":
(forget,
[] + walkopts,
_('[OPTION]... FILE...')),
Thomas Arendsen Hein
Cleanups to commands.py
r1065 "grep":
(grep,
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 [('0', 'print0', None, _('end fields with NUL')),
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 ('', 'all', None, _('print all revisions that match')),
Brendan Cully
grep: add --follow support.
r2870 ('f', 'follow', None,
Matt Mackall
many, many trivial check-code fixups
r10282 _('follow changeset history,'
' or file history across copies and renames')),
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 ('i', 'ignore-case', None, _('ignore case when matching')),
Muli Ben-Yehuda
strictly adher to 80 chars per line
r1602 ('l', 'files-with-matches', None,
Martin Geisler
expand "rev" to "revision" in help texts
r8028 _('print only filenames and revisions that match')),
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 ('n', 'line-number', None, _('print matching line numbers')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('r', 'rev', [],
_('only search files changed within revision range'), _('REV')),
Thomas Arendsen Hein
Make annotae/grep print short dates with -q/--quiet....
r6134 ('u', 'user', None, _('list the author (long with -v)')),
('d', 'date', None, _('list the date (short with -q)')),
Benoit Boissinot
factor opts: walk options
r3188 ] + walkopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... PATTERN [FILE]...')),
Thomas Arendsen Hein
Update online help of hg heads for new --branches option.
r905 "heads":
(heads,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 [('r', 'rev', '',
_('show only heads which are descendants of REV'), _('REV')),
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 ('t', 'topo', False, _('show topological heads only')),
John Mulligan
branch closing: referencing open and closed branches/heads...
r7656 ('a', 'active', False,
Dirkjan Ochtman
commands: deprecate the heads -a option...
r10326 _('show active branchheads only [DEPRECATED]')),
John Mulligan
heads: show closed heads only when --closed is passed...
r8695 ('c', 'closed', False,
Matt Mackall
heads: more clarity for --closed
r9189 _('show normal and closed branch heads')),
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 ] + templateopts,
Ori Avtalion
Fix hg heads -r flag documentation...
r11180 _('[-ac] [-r REV] [REV]...')),
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 "help": (help_, [], _('[TOPIC]')),
Matt Mackall
identify: accept a revision argument
r4665 "identify|id":
(identify,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 [('r', 'rev', '',
_('identify the specified revision'), _('REV')),
Matt Mackall
identify: add support for output flags
r4666 ('n', 'num', None, _('show local revision number')),
('i', 'id', None, _('show global revision id')),
('b', 'branch', None, _('show branch')),
('t', 'tags', None, _('show tags'))],
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-nibt] [-r REV] [SOURCE]')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "import|patch":
(import_,
Muli Ben-Yehuda
strictly adher to 80 chars per line
r1602 [('p', 'strip', 1,
Martin Geisler
commands: removed bad linebreak in import help
r8038 _('directory strip option for patch. This has the same '
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 'meaning as the corresponding patch option'),
_('NUM')),
('b', 'base', '',
_('base path'), _('PATH')),
Muli Ben-Yehuda
strictly adher to 80 chars per line
r1602 ('f', 'force', None,
Brendan Cully
Add import --exact....
r4263 _('skip check for outstanding uncommitted changes')),
Matt Mackall
many, many trivial check-code fixups
r10282 ('', 'no-commit', None,
_("don't commit, just update the working directory")),
Brendan Cully
Add import --exact....
r4263 ('', 'exact', None,
Eric Hopper
Add --import-branch option to hg import to pull in branch information without --exact
r4592 _('apply patch to the nodes from which it was generated')),
('', 'import-branch', None,
Martin Geisler
commands: lower-case --import-branch help text
r8034 _('use any branch information in patch (implied by --exact)'))] +
Brendan Cully
import: add similarity option (issue295)
r7402 commitopts + commitopts2 + similarityopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... PATCH...')),
Thomas Arendsen Hein
realign commands table
r5778 "incoming|in":
(incoming,
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 [('f', 'force', None,
timeless@mozdev.org
commands: Try to improve help options text for basic commands...
r10375 _('run even if remote repository is unrelated')),
Vadim Gelfer
let commands that show changesets use templates....
r1907 ('n', 'newest-first', None, _('show newest record first')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('', 'bundle', '',
_('file to store the bundles into'), _('FILE')),
Benoit Boissinot
Make clear that for a changegroup '-r' pulls "up to" a revision...
r6304 ('r', 'rev', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('a remote changeset intended to be added'), _('REV')),
Sune Foldager
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
r10379 ('b', 'branch', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('a specific branch you would like to pull'), _('BRANCH')),
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 ] + logopts + remoteopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-p] [-n] [-M] [-f] [-r REV]...'
Thomas Arendsen Hein
Added missing space in continued string.
r2544 ' [--bundle FILENAME] [SOURCE]')),
Thomas Arendsen Hein
Add ui method to set --ssh/--remotecmd, use it in init/clone/pull/push/in/out....
r2598 "^init":
Thomas Arendsen Hein
Corrected synopsis for many commands....
r3885 (init,
remoteopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-e CMD] [--remotecmd CMD] [DEST]')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "locate":
(locate,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 [('r', 'rev', '',
_('search the repository as it is in REV'), _('REV')),
Muli Ben-Yehuda
strictly adher to 80 chars per line
r1602 ('0', 'print0', None,
_('end filenames with NUL, for use with xargs')),
('f', 'fullpath', None,
_('print complete paths from the filesystem root')),
Benoit Boissinot
factor opts: walk options
r3188 ] + walkopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... [PATTERN]...')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "^log|history":
(log,
Matt Mackall
Remove deprecated old-style branch support
r3876 [('f', 'follow', None,
Matt Mackall
many, many trivial check-code fixups
r10282 _('follow changeset history,'
' or file history across copies and renames')),
Brendan Cully
Add log option --follow-first to follow only the first parent of...
r2784 ('', 'follow-first', None,
_('only follow the first parent of merge changesets')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('d', 'date', '',
_('show revisions matching date spec'), _('DATE')),
Brendan Cully
Show copies in hg log....
r3197 ('C', 'copies', None, _('show copied files')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('k', 'keyword', [],
_('do case-insensitive search for a given text'), _('TEXT')),
('r', 'rev', [],
_('show the specified revision or range'), _('REV')),
Martin Geisler
expand "rev" to "revision" in help texts
r8028 ('', 'removed', None, _('include revisions where files were removed')),
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 ('m', 'only-merges', None, _('show only merges')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('u', 'user', [],
_('revisions committed by user'), _('USER')),
Steve Losh
commands: Add 'hg log --branch' and deprecate 'hg log --only-branch'...
r10957 ('', 'only-branch', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('show only changesets within the given named branch (DEPRECATED)'),
_('BRANCH')),
Steve Losh
commands: Add 'hg log --branch' and deprecate 'hg log --only-branch'...
r10957 ('b', 'branch', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('show changesets within the given named branch'), _('BRANCH')),
Matt Mackall
many, many trivial check-code fixups
r10282 ('P', 'prune', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('do not display revision or any of its ancestors'), _('REV')),
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 ] + logopts + walkopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... [FILE]')),
Thomas Arendsen Hein
realign commands table
r5778 "manifest":
(manifest,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 [('r', 'rev', '',
_('revision to display'), _('REV'))],
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-r REV]')),
Benoit Boissinot
various doc fixes...
r4014 "^merge":
Thomas Arendsen Hein
Don't allow --style and --template for hg update and hg merge....
r2044 (merge,
Daniel Holth
accept -r REV in more places...
r4450 [('f', 'force', None, _('force a merge with outstanding changes')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('r', 'rev', '',
_('revision to merge'), _('REV')),
Dirkjan Ochtman
merge: rename -S/--show option to -P/--preview
r8834 ('P', 'preview', None,
Dirkjan Ochtman
merge: add -S/--show option to review revisions without merging
r8387 _('review revisions to merge (no merge is performed)'))],
timeless@mozdev.org
commands: add missing options in command line help
r9952 _('[-P] [-f] [[-r] REV]')),
Thomas Arendsen Hein
realign commands table
r5778 "outgoing|out":
(outgoing,
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 [('f', 'force', None,
timeless@mozdev.org
commands: Try to improve help options text for basic commands...
r10375 _('run even when the destination is unrelated')),
Benoit Boissinot
Make clear that for a changegroup '-r' pulls "up to" a revision...
r6304 ('r', 'rev', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('a changeset intended to be included in the destination'),
_('REV')),
Vadim Gelfer
let commands that show changesets use templates....
r1907 ('n', 'newest-first', None, _('show newest record first')),
Sune Foldager
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
r10379 ('b', 'branch', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('a specific branch you would like to push'), _('BRANCH')),
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 ] + logopts + remoteopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
Matt Mackall
Remove parents from default help in favor of summary
r9606 "parents":
Benoit Boissinot
add a -b/--branch option to 'hg parents'
r1724 (parents,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 [('r', 'rev', '',
_('show parents of the specified revision'), _('REV')),
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 ] + templateopts,
Ori Avtalion
commands: standardize parents command meta data
r8544 _('[-r REV] [FILE]')),
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 "paths": (paths, [], _('[NAME]')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "^pull":
(pull,
Muli Ben-Yehuda
strictly adher to 80 chars per line
r1602 [('u', 'update', None,
Greg Ward
commands: fix help string for pull -u and unbundle -u....
r10210 _('update to new branch head if changesets were pulled')),
Vadim Gelfer
add -f/--force to pull, incoming, outgoing, to work on unrelated repo....
r1959 ('f', 'force', None,
_('run even when remote repository is unrelated')),
Thomas Arendsen Hein
Corrected synopsis for many commands....
r3885 ('r', 'rev', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('a remote changeset intended to be added'), _('REV')),
Sune Foldager
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
r10379 ('b', 'branch', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('a specific branch you would like to pull'), _('BRANCH')),
Benoit Boissinot
factor opts: remote repo access options
r3190 ] + remoteopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')),
mpm@selenic.com
Actually implement the -f switch for push
r818 "^push":
(push,
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 [('f', 'force', None, _('force push')),
Benoit Boissinot
Make clear that for a changegroup '-r' pulls "up to" a revision...
r6304 ('r', 'rev', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('a changeset intended to be included in the destination'),
_('REV')),
Sune Foldager
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
r10379 ('b', 'branch', [],
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('a specific branch you would like to push'), _('BRANCH')),
Sune Foldager
push: add --new-branch option to allow intial push of new branches...
r11211 ('', 'new-branch', False, _('allow pushing a new branch')),
Benoit Boissinot
factor opts: remote repo access options
r3190 ] + remoteopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')),
"recover": (recover, []),
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 "^remove|rm":
(remove,
Dirkjan Ochtman
improved semantics for remove (issue438)...
r6346 [('A', 'after', None, _('record delete for missing files')),
('f', 'force', None,
Dirkjan Ochtman
tiny tab cleanup
r6347 _('remove (and delete) file even if added or modified')),
Benoit Boissinot
factor opts: walk options
r3188 ] + walkopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... FILE...')),
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 "rename|mv":
(rename,
Thomas Arendsen Hein
Updated help synopsises and reordered some options. Dropped [-n] from revert.
r1816 [('A', 'after', None, _('record a rename that has already occurred')),
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 ('f', 'force', None,
Thomas Arendsen Hein
Updated help synopsises and reordered some options. Dropped [-n] from revert.
r1816 _('forcibly copy over an existing managed file')),
Benoit Boissinot
factor opts: --dry-run option
r3189 ] + walkopts + dryrunopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... SOURCE... DEST')),
Matt Mackall
resolve: new command...
r6518 "resolve":
(resolve,
timeless@mozdev.org
hg help resolve grossly mischaracterizes the --all switch
r9747 [('a', 'all', None, _('select all unresolved files')),
Matt Mackall
resolve: require -a switch to resolve all files...
r7527 ('l', 'list', None, _('list state of files needing merge')),
Matt Mackall
resolve: new command...
r6518 ('m', 'mark', None, _('mark files as resolved')),
timeless
commands: adding --no-status to resolve to match status
r9646 ('u', 'unmark', None, _('unmark files as resolved')),
('n', 'no-status', None, _('hide status prefix'))]
Simon Heimberg
resolve: accepts walkopts (-I and -X)
r7765 + walkopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... [FILE]...')),
Matt Mackall
imported patch rev-help
r5574 "revert":
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 (revert,
Vadim Gelfer
revert: add -a as alias for --all
r2983 [('a', 'all', None, _('revert all changes when no arguments given')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('d', 'date', '',
_('tipmost revision matching date'), _('DATE')),
('r', 'rev', '',
_('revert to the specified revision'), _('REV')),
Vadim Gelfer
rewrite revert command. fix issues 93, 123, 147....
r2029 ('', 'no-backup', None, _('do not save backup copies of files')),
Benoit Boissinot
factor opts: --dry-run option
r3189 ] + walkopts + dryrunopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... [-r REV] [NAME]...')),
Steve Borho
rollback: add dry-run argument, emit transaction description
r10882 "rollback": (rollback, dryrunopts),
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 "root": (root, []),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "^serve":
(serve,
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 [('A', 'accesslog', '',
_('name of access log file to write to'), _('FILE')),
Vadim Gelfer
add --daemon option to serve command. for issue 45....
r1740 ('d', 'daemon', None, _('run server in background')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('', 'daemon-pipefds', '',
_('used internally by daemon mode'), _('NUM')),
('E', 'errorlog', '',
_('name of error log file to write to'), _('FILE')),
Benoit Boissinot
serve: fix port config
r10635 # use string type, then we can check if something was passed
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('p', 'port', '',
_('port to listen on (default: 8000)'), _('PORT')),
Matt Mackall
many, many trivial check-code fixups
r10282 ('a', 'address', '',
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('address to listen on (default: all interfaces)'), _('ADDR')),
Matt Mackall
many, many trivial check-code fixups
r10282 ('', 'prefix', '',
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('prefix path to serve from (default: server root)'), _('PREFIX')),
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 ('n', 'name', '',
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 _('name to show in web pages (default: working directory)'),
_('NAME')),
('', 'web-conf', '',
_('name of the hgweb config file (serve more than one repository)'),
_('FILE')),
('', 'webdir-conf', '',
_('name of the hgweb config file (DEPRECATED)'), _('FILE')),
('', 'pid-file', '',
_('name of file to write process ID to'), _('FILE')),
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 ('', 'stdio', None, _('for remote clients')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('t', 'templates', '',
_('web templates to use'), _('TEMPLATE')),
('', 'style', '',
_('template style to use'), _('STYLE')),
Brendan Cully
Add SSL support to hg serve, activated via --certificate option
r4860 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('', 'certificate', '',
_('SSL certificate file'), _('FILE'))],
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]...')),
Thomas Arendsen Hein
Sort commands table again and add some missing 'hg' in synopsises.
r5781 "showconfig|debugconfig":
(showconfig,
[('u', 'untrusted', None, _('show untrusted configuration options'))],
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-u] [NAME]...')),
Matt Mackall
Introduce summary command
r9603 "^summary|sum":
Matt Mackall
summary: add --remote
r9620 (summary,
Matt Mackall
summary: remove reference to -p
r9625 [('', 'remote', None, _('check for push and pull'))], '[--remote]'),
Matt Mackall
Add explicit 'st' alias for status
r1507 "^status|st":
tksoh@users.sourceforge.net
hg status: added options to select files by status....
r840 (status,
Vadim Gelfer
status: add -c (clean) and -A (all files) options...
r2661 [('A', 'all', None, _('show status of all files')),
('m', 'modified', None, _('show only modified files')),
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 ('a', 'added', None, _('show only added files')),
('r', 'removed', None, _('show only removed files')),
Thomas Arendsen Hein
Distinguish removed and deleted files. Tests are not fixed yet....
r1619 ('d', 'deleted', None, _('show only deleted (but tracked) files')),
Vadim Gelfer
status: add -c (clean) and -A (all files) options...
r2661 ('c', 'clean', None, _('show only files without changes')),
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 ('u', 'unknown', None, _('show only unknown (not tracked) files')),
Thomas Arendsen Hein
Fix help text for hg status -i
r4156 ('i', 'ignored', None, _('show only ignored files')),
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 ('n', 'no-status', None, _('hide status prefix')),
Brendan Cully
Add an option '-C|--copies' to hg status to show the source of copied files....
r2639 ('C', 'copies', None, _('show source of copied files')),
Muli Ben-Yehuda
strictly adher to 80 chars per line
r1602 ('0', 'print0', None,
_('end filenames with NUL, for use with xargs')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('', 'rev', [],
_('show difference from revision'), _('REV')),
('', 'change', '',
_('list the changed files of a revision'), _('REV')),
Benoit Boissinot
factor opts: walk options
r3188 ] + walkopts,
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[OPTION]... [FILE]...')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "tag":
(tag,
Matt Mackall
tags: require -f to replace an existing tag...
r4267 [('f', 'force', None, _('replace existing tag')),
('l', 'local', None, _('make the tag local')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('r', 'rev', '',
_('revision to tag'), _('REV')),
Benoit Boissinot
refactor options from cmdtable...
r5147 ('', 'remove', None, _('remove a tag')),
# -l/--local is already there, commitopts cannot be used
Steve Losh
tag: add -e/--edit option for modifying the commit message
r11185 ('e', 'edit', None, _('edit commit message')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('m', 'message', '',
_('use <text> as commit message'), _('TEXT')),
Benoit Boissinot
refactor options from cmdtable...
r5147 ] + commitopts2,
timeless@mozdev.org
commands: add missing options in command line help
r9952 _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')),
Matt Mackall
commands: fix missing empty synopses
r9604 "tags": (tags, [], ''),
Thomas Arendsen Hein
Add option -b/--branch to hg tip (as done for hg parents).
r1762 "tip":
(tip,
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 [('p', 'patch', None, _('show patch')),
Jim Correia
log-like commands now use -G for --graph, -g for --git
r7763 ('g', 'git', None, _('use git extended diff format')),
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 ] + templateopts,
timeless@mozdev.org
commands: add missing options in command line help
r9952 _('[-p] [-g]')),
mpm@selenic.com
Add preliminary support for the bundle and unbundle commands
r1218 "unbundle":
(unbundle,
Matt Mackall
Error handling for unbundle, fix option line wrapping
r1601 [('u', 'update', None,
Greg Ward
commands: fix help string for pull -u and unbundle -u....
r10210 _('update to new branch head if changesets were unbundled'))],
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 _('[-u] FILE...')),
mpm@selenic.com
Shorten help...
r593 "^update|up|checkout|co":
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 (update,
Stuart W Marks
help: describe new cross-branch behavior in update help text, plus cleanups
r9718 [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
Matt Mackall
update: add --check option
r8855 ('c', 'check', None, _('check for uncommitted changes')),
FUJIWARA Katsunori
help: show value requirement and multiple occurrence of options...
r11321 ('d', 'date', '',
_('tipmost revision matching date'), _('DATE')),
('r', 'rev', '',
_('revision'), _('REV'))],
Stuart W Marks
help: describe new cross-branch behavior in update help text, plus cleanups
r9718 _('[-c] [-C] [-d DATE] [[-r] REV]')),
Matt Mackall
help: remove redundant 'hg <command>' from command synopses
r7364 "verify": (verify, []),
"version": (version_, []),
Thomas Arendsen Hein
Sort global options by topic: directories, ui, timing, other...
r1046 }
mpm@selenic.com
Beginning of new command parsing interface...
r209
Dirkjan Ochtman
add debugcommands command: an easy to parse command + option index
r7880 norepo = ("clone init version help debugcommands debugcomplete debugdata"
Matt Mackall
pushkey: add debugpushkey command for testing
r11371 " debugindex debugindexdot debugdate debuginstall debugfsinfo"
" debugpushkey")
Peter Arrenbrecht
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text...
r11336 optionalrepo = ("identify paths serve showconfig debugancestor debugdag")