##// END OF EJS Templates
manifest: make checkforbidden take a list
manifest: make checkforbidden take a list

File last commit:

r6764:8db64464 default
r6765:be142cb9 default
Show More
commands.py
3296 lines | 118.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 #
# This software may be used and distributed according to the terms
# of the GNU General Public License, incorporated herein by reference.
Joel Rosdahl
Expand import * to allow Pyflakes to find problems
r6211 from node import hex, nullid, nullrev, short
Patrick Mezard
commands: fix shadowed repo module
r6405 from repo import RepoError, NoCapability
Matt Mackall
Simplify i18n imports
r3891 from i18n import _
Bryan O'Sullivan
commands: move commit to cmdutil as wrapper for commit-like functions
r5034 import os, re, sys, urllib
Matt Mackall
status: find copies and renames beyond the working directory
r6276 import hg, util, revlog, bundlerepo, extensions, copies
Matt Mackall
Replace demandload with new demandimport
r3877 import difflib, patch, time, help, mdiff, tempfile
Joel Rosdahl
Remove unused imports
r6212 import version, socket
Matt Mackall
bisect: make bisect a built-in command
r5775 import archival, changegroup, cmdutil, hgweb.server, sshserver, hbisect
Matt Mackall
resolve: new command...
r6518 import merge as merge_
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
Schedule files to be version controlled and added to the repository.
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
undo an add before that, see hg revert.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Benoit Boissinot
make all commands be repo-wide by default...
r1568 If no names are given, add all files in the repository.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Patrick Mezard
commands: add exits(1) if a specified file cannot be added (issue 891)
r5688 rejected = None
exacts = {}
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)
m.bad = lambda x,y: True
Matt Mackall
walk: return a single value
r6586 for abs in repo.walk(m):
Matt Mackall
walk: remove rel and exact returns
r6584 if m.exact(abs):
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 if ui.verbose:
Matt Mackall
walk: remove rel and exact returns
r6584 ui.status(_('adding %s\n') % m.rel(abs))
Bryan O'Sullivan
Get add and locate to use new repo and dirstate walk code....
r724 names.append(abs)
Patrick Mezard
commands: add exits(1) if a specified file cannot be added (issue 891)
r5688 exacts[abs] = 1
Matt Mackall
dirstate: add __contains__ and make __getitem__ more useful...
r4906 elif abs not in repo.dirstate:
Matt Mackall
walk: remove rel and exact returns
r6584 ui.status(_('adding %s\n') % m.rel(abs))
Bryan O'Sullivan
Get add and locate to use new repo and dirstate walk code....
r724 names.append(abs)
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'):
Patrick Mezard
commands: add exits(1) if a specified file cannot be added (issue 891)
r5688 rejected = repo.add(names)
rejected = [p for p in rejected if p in exacts]
return rejected 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
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 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
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 Use the -s option to detect renamed files. With a parameter > 0,
Vadim Gelfer
addremove: add -s/--similarity option...
r2958 this compares every removed file with every added file and records
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 those similar enough as renames. This option takes a percentage
Vadim Gelfer
addremove: add -s/--similarity option...
r2958 between 0 (disabled) and 100 (files must be identical) as its
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 parameter. Detecting renamed files this way can be expensive.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Bryan O'Sullivan
addremove: print meaningful error message if --similar not numeric
r4966 try:
sim = float(opts.get('similarity') or 0)
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'))
return cmdutil.addremove(repo, pats, opts, similarity=sim/100.)
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):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """show changeset information per file line
List changes in files, showing the revision id responsible for each line
This command is useful to discover who did a change or when a change took
place.
Without the -a option, annotate will avoid processing files it
detects as binary. With -a, annotate will generate an annotation
anyway, probably with undesirable results.
"""
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:
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 raise util.Abort(_('at least one file name or pattern 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),
('follow', lambda x: x[0].path()),
]
Brendan Cully
Refactor annotate copy support.
r3172 if (not opts['user'] and not opts['changeset'] and not opts['date']
and not opts['follow']):
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
if (linenumber and (not opts['changeset']) and (not opts['number'])):
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])
Matt Mackall
use repo[changeid] to get a changectx
r6747 ctx = repo[opts['rev']]
mpm@selenic.com
Teach annotate about binary files
r1016
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579 m = cmdutil.match(repo, pats, opts)
Matt Mackall
context: add walk method
r6764 for abs in ctx.walk(m):
fctx = ctx[abs]
Matt Mackall
Convert hg annotate to context api
r2566 if not opts['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
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857 lines = fctx.annotate(follow=opts.get('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:
m = max(map(len, l))
pieces.append(["%*s" % (m, x) for x in l])
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):
'''create unversioned archive of a repository revision
By default, the revision used is the parent of the working
directory; use "-r" to specify a different revision.
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 To specify the type of archive to create, use "-t". Valid
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112 types are:
"files" (default): a directory full of files
"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
The exact name of the destination archive or directory is given
using a format string; see "hg help export" for details.
Each member added to an archive file has a directory prefix
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 prepended. Use "-p" to specify a format string for the prefix.
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112 The default is the basename of the archive, with suffixes removed.
'''
Matt Mackall
use repo[changeid] to get a changectx
r6747 ctx = repo[opts['rev']]
Brendan Cully
archive: abort on empty repository. Fixes #624.
r5061 if not ctx:
raise util.Abort(_('repository has no revisions'))
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'))
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579 matchfn = cmdutil.match(repo, [], opts)
Vadim Gelfer
archive: make "hg archive -t XXX -" to write to stdout
r2476 kind = opts.get('type') or 'files'
prefix = opts['prefix']
if dest == '-':
if kind == 'files':
raise util.Abort(_('cannot archive plain files to stdout'))
dest = sys.stdout
if not prefix: prefix = os.path.basename(repo.root) + '-%h'
Vadim Gelfer
refactor text diff/patch code....
r2874 prefix = cmdutil.make_filename(repo, prefix, node)
Vadim Gelfer
archive: make "hg archive -t XXX -" to write to stdout
r2476 archival.archive(repo, dest, node, kind, not opts['no_decode'],
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
If you back out 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
Gilles Moris
Reverse the way backout is doing the merge...
r6161 backout changeset with another head (current one by default).
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
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 changeset afterwards. This saves you from doing the merge by
hand. The result of this merge is not committed, as for a normal
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163 merge.
Matt Mackall
context: avoid using None for working parent
r6739 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 '''
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:
raise util.Abort(_('cannot back out change on a different branch'))
Vadim Gelfer
backout: allow backout of merge changeset with --parent option....
r2614 p1, p2 = repo.changelog.parents(node)
if p1 == nullid:
Vadim Gelfer
add backout command....
r2158 raise util.Abort(_('cannot back out a change with no parents'))
if p2 != nullid:
Vadim Gelfer
backout: allow backout of merge changeset with --parent option....
r2614 if not opts['parent']:
raise util.Abort(_('cannot back out a merge changeset without '
'--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:
if opts['parent']:
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']:
Matt Mackall
backout: report short hash in commit message
r4718 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)
Vadim Gelfer
print message after backout that tells that backout adds new head.
r2493 if opts['merge']:
Gilles Moris
Reverse the way backout is doing the merge...
r6161 ui.status(_('merging with changeset %s\n') % nice(repo.changelog.tip()))
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
Matt Mackall
bisect: make bisect a built-in command
r5775 def bisect(ui, repo, rev=None, extra=None,
reset=None, good=None, bad=None, skip=None, noupdate=None):
"""subdivision search of changesets
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 for testing. Once you have performed tests, mark the
working directory as bad or good and bisect will either update to
another candidate changeset or announce that it has found the bad
revision.
"""
# 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 > 1:
raise util.Abort("Incompatible arguments")
if reset:
p = repo.join("bisect.state")
if os.path.exists(p):
os.unlink(p)
return
# load state
state = {'good': [], 'bad': [], 'skip': []}
if os.path.exists(repo.join("bisect.state")):
for l in repo.opener("bisect.state"):
kind, node = l[:-1].split()
node = repo.lookup(node)
if kind not in state:
raise util.Abort(_("unknown bisect kind %s") % kind)
state[kind].append(node)
# update state
node = repo.lookup(rev or '.')
if good:
state['good'].append(node)
elif bad:
state['bad'].append(node)
elif skip:
state['skip'].append(node)
# save state
f = repo.opener("bisect.state", "w", atomictemp=True)
wlock = repo.wlock()
try:
for kind in state:
for node in state[kind]:
Joel Rosdahl
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
r6217 f.write("%s %s\n" % (kind, hex(node)))
Matt Mackall
bisect: make bisect a built-in command
r5775 f.rename()
finally:
del wlock
if not state['good'] or not state['bad']:
return
# actually bisect
Matt Mackall
bisect: handle search for bad to good transitions...
r5776 node, changesets, good = hbisect.bisect(repo.changelog, state)
Matt Mackall
bisect: make bisect a built-in command
r5775 if changesets == 0:
Matt Mackall
bisect: handle search for bad to good transitions...
r5776 ui.write(_("The first %s revision is:\n") % (good and "good" or "bad"))
Matt Mackall
bisect: make bisect a built-in command
r5775 displayer = cmdutil.show_changeset(ui, repo, {})
displayer.show(changenode=node)
elif node is not None:
# 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)
ui.write(_("Testing changeset %s:%s "
"(%s changesets remaining, ~%s 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,
set the working directory branch name (the branch does not exist in
the repository until the next commit).
Brendan Cully
branch: require --force to shadow existing branches
r4202
Unless --force is specified, branch will not let you set a
branch name that shadows an existing branch.
Thomas Arendsen Hein
Mention 'hg update' to switch branches in help for branch and branches.
r5999
Use the command 'hg update' to switch to an existing branch.
Matt Mackall
add branch and branches commands
r3502 """
Matt Mackall
Move branch read/write to dirstate where it belongs
r4179 if label:
Brendan Cully
branch: require --force to shadow existing branches
r4202 if not opts.get('force') and label 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'
' (use --force to override)'))
Matt Mackall
Move branch read/write to dirstate where it belongs
r4179 repo.dirstate.setbranch(util.fromlocal(label))
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 branch read/write to dirstate where it belongs
r4179 ui.write("%s\n" % util.tolocal(repo.dirstate.branch()))
Matt Mackall
add branch and branches commands
r3502
Eric Hopper
Change branches to sort 'active' branches first, and add an option to show only active branches.
r4675 def branches(ui, repo, active=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
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 inactive. If active is specified, only show active branches.
Eric Hopper
Change branches to sort 'active' branches first, and add an option to show only active branches.
r4675
Stefano Tortarolo
Active branches fix (issue1104)
r6631 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
Use the command 'hg update' to switch to an existing branch.
Matt Mackall
add branch and branches commands
r3502 """
Stefano Tortarolo
Active branches fix (issue1104)
r6631 hexfunc = ui.debugflag and hex or short
Matt Mackall
use repo[changeid] to get a changectx
r6747 activebranches = [util.tolocal(repo[n].branch())
Stefano Tortarolo
Active branches fix (issue1104)
r6631 for n in repo.heads()]
Matt Mackall
util: add sort helper
r6762 branches = util.sort([(tag in activebranches, repo.changelog.rev(node), tag)
for tag, node in repo.branchtags().items()])
Thomas Arendsen Hein
Fix python2.3 incompatibility introduced by a2b13cac0922.
r6682 branches.reverse()
Stefano Tortarolo
Active branches fix (issue1104)
r6631
for isactive, node, tag in branches:
if (not active) or isactive:
Eric Hopper
Change branches to sort 'active' branches first, and add an option to show only active branches.
r4675 if ui.quiet:
Stefano Tortarolo
Active branches fix (issue1104)
r6631 ui.write("%s\n" % tag)
Eric Hopper
Change branches to sort 'active' branches first, and add an option to show only active branches.
r4675 else:
Stefano Tortarolo
Active branches fix (issue1104)
r6631 rev = str(node).rjust(32 - util.locallen(tag))
isinactive = ((not isactive) and " (inactive)") or ''
data = tag, rev, hexfunc(repo.lookup(node)), isinactive
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
found in the other repository.
John Mulligan
Add --all option to bundle command
r6171 If no destination repository is specified the destination is
assumed to have all the nodes specified by one or more --base
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 parameters. To create a bundle containing all changesets, use
Benoit Allard
add compression type type parameter to bundle command
r6570 --all (or --base null). To change the compression method applied,
use the -t option (by default, bundles are compressed using bz2).
Thomas Arendsen Hein
Corrected help text for bundle.
r3511
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.
Applying bundles preserves all changeset contents including
permissions, copy/rename information, and revision history.
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
if revs:
revs = [repo.lookup(rev) for rev in revs]
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:
raise util.Abort(_("--base is incompatible with specifiying "
"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 = []
Matt Mackall
Consolidate brinfo handling
r3649 has = {nullid: None}
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:
Benoit Boissinot
bundle --base: use the right set for the base
r3318 visit = list(revs)
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:
o.insert(0, n)
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:
Matt Mackall
dispatch: move dispatching code to cmdutil
r4549 cmdutil.setremoteconfig(ui, opts)
Alexis S. L. Carvalho
Merge with crew-stable
r5248 dest, revs, checkout = hg.parseurl(
Matt Mackall
Add support for url#id syntax...
r4478 ui.expandpath(dest or 'default-push', dest or 'default'), revs)
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 other = hg.repository(ui, dest)
o = repo.findoutgoing(other, force=opts['force'])
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
Print the specified files as they were at the given revision.
Thomas Arendsen Hein
doc fix: hg tags defaults to current parent revision, too....
r3915 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
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
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 for the export command, with the following additions:
%s basename of file being printed
%d dirname of file being printed, or '.' if in repo root
%p root-relative path name of file being printed
"""
Matt Mackall
use repo[changeid] to get a changectx
r6747 ctx = repo[opts['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):
Vadim Gelfer
refactor text diff/patch code....
r2874 fp = cmdutil.make_file(repo, opts['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.
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
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 to the repository data, not to the checked out files). 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.
Bryan O'Sullivan
issue 1053: heavily qualify the "cp -al" advice for cloning
r6509 In some cases, you can clone repositories and checked out files
using full hardlinks with
Inaky Perez-Gonzalez
Expand clone help with hardlink information
r2762
$ cp -al REPO REPOCLONE
Bryan O'Sullivan
issue 1053: heavily qualify the "cp -al" advice for cloning
r6509 This is the fastest way to clone, but it is not always safe. The
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
breaks hardlinks (Emacs and most Linux Kernel tools do so). Also,
this is not compatible with certain extensions that place their
metadata under the .hg directory, such as mq.
Benoit Boissinot
resync commands.py docstrings with hg.1.txt
r1811
Vadim Gelfer
clone: replace long help string of inaky with doc comment.
r2764 If you use the -r option to clone up to a specific revision, no
subsequent revisions will be present in the cloned repository.
This option implies --pull, even on local repositories.
Dirkjan Ochtman
improve help text for clone -U
r6625 If the -U option is used, the new clone will contain only a repository
(.hg) and no working copy (the working copy parent is the null revision).
Benoit Boissinot
resync commands.py docstrings with hg.1.txt
r1811 See pull for valid source format details.
Thomas Arendsen Hein
Additional information about URLs in pull/push/clone/init:...
r2590
It is possible to specify an ssh:// URL as the destination, but no
Benoit Boissinot
doc: clone doesn't create a working directory in remote repos
r3583 .hg/hgrc and working directory will be created on the remote side.
Look at the help text for the pull command for important details
about ssh:// URLs.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
dispatch: move dispatching code to cmdutil
r4549 cmdutil.setremoteconfig(ui, opts)
Matt Mackall
Add support for url#id syntax...
r4478 hg.clone(ui, source, dest,
Vadim Gelfer
clone: move code into hg module. make doc better....
r2597 pull=opts['pull'],
Vadim Gelfer
clone: change name of --stream to --uncompressed....
r2620 stream=opts['uncompressed'],
Vadim Gelfer
clone: move code into hg module. make doc better....
r2597 rev=opts['rev'],
update=not opts['noupdate'])
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
Commit changes to the given files into the repository.
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
file names or -I/-X filters.
Osku Salerma
Use VISUAL in addition to EDITOR when choosing the editor to use.
r5660 If no commit message is specified, the configured editor is started to
enter a message.
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163
See 'hg help dates' for a list of formats valid for -d/--date.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
match: stop passing files through commitfunc
r6600 def commitfunc(ui, repo, message, match, opts):
return repo.commit(match.files(), message, opts['user'], opts['date'],
match, force_editor=opts.get('force_editor'))
Dirkjan Ochtman
warn about new heads on commit (issue842)
r6336
Alexis S. L. Carvalho
Avoid calling heads() twice on every hg commit....
r6369 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
if not node:
return
cl = repo.changelog
rev = cl.rev(node)
parents = cl.parentrevs(rev)
if rev - 1 in parents:
# one of the parents was the old tip
return
if (parents == (nullrev, nullrev) or
len(cl.heads(cl.node(parents[0]))) > 1 and
(parents[1] == nullrev or len(cl.heads(cl.node(parents[1]))) > 1)):
Dirkjan Ochtman
warn about new heads on commit (issue842)
r6336 ui.status(_('created new head\n'))
mpm@selenic.com
big heap of command clean-up work...
r245
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,
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 there can only be one source.
By default, this command copies the contents of files as they
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 stand in the working directory. If invoked with --after, the
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 operation is recorded, but no copying is performed.
Matt Mackall
Add doc notes about revert and hg status vs diff
r3829 This command takes effect in the next commit. To undo a copy
before that, see hg revert.
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:
del wlock
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)))
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
if opts['options']:
options = []
otables = [globalopts]
if cmd:
Matt Mackall
dispatch: move command dispatching into its own module...
r5178 aliases, entry = cmdutil.findcmd(ui, cmd, table)
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:
if o[0]:
options.append('-%s' % o[0])
options.append('--%s' % o[1])
ui.write("%s\n" % "\n".join(options))
return
Matt Mackall
util: add sort helper
r6762 ui.write("%s\n" % "\n".join(util.sort(cmdutil.findpossible(ui, cmd, table))))
Benoit Boissinot
new command debugcomplete...
r1887
Matt Mackall
add debugfsinfo to check fs capabilities
r5741 def debugfsinfo(ui, path = "."):
file('.debugfsinfo', 'w').write('')
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:
del wlock
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
With no args, print names and values of all config items.
With one arg of the form section.name, print just the value of
that config item.
With multiple args, print names and values of all config items
with matching section names."""
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:
ui.write('%s=%s\n' % (sectname, value))
elif v == sectname:
ui.write(value, '\n')
else:
ui.write('%s=%s\n' % (sectname, value))
Bryan O'Sullivan
Add commands.debugconfig....
r1028
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.
"""
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:
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 del wlock
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
util: add sort helper
r6762 for file_, ent in util.sort(repo.dirstate._map.items()):
Alexis S. L. Carvalho
debugstate: add --nodates...
r6296 if showdate:
if ent[3] == -1:
# Pad or slice to locale representation
locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(0)))
timestr = 'unset'
timestr = timestr[:locale_len] + ' '*(locale_len - len(timestr))
else:
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
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_)
mpm@selenic.com
Remove all remaining print statements...
r582 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" % (
mason@suse.com
Implement revlogng....
r2072 i, r.start(i), r.length(i), r.base(i), r.linkrev(node),
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_):
mpm@selenic.com
A bunch of parsing/help updates...
r596 """dump an index DAG as a .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):
'''test Mercurial installation'''
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
ui.status(_("Checking encoding (%s)...\n") % util._encoding)
try:
util.fromlocal("test")
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
t = templater.templater(templater.templatepath("map-cmdline.default"))
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
a = file(fa).read()
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"
Patrick Mezard
debuginstall: stop looking for patch utility, just test it
r5310 " to http://www.selenic.com/mercurial/bts\n"))
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"))
user = os.environ.get("HGUSER")
if user is None:
user = ui.config("ui", "username")
if user is None:
user = os.environ.get("EMAIL")
if not user:
ui.warn(" ")
ui.username()
ui.write(_(" (specify a username in your .hgrc file)\n"))
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.
Without the -a option, diff will avoid generating diffs of files
it detects as binary. With -a, diff will generate a diff anyway,
probably with undesirable results.
"""
Thomas Arendsen Hein
Removed unused ui parameter from revpair/revrange and fix its users.
r3707 node1, node2 = cmdutil.revpair(repo, opts['rev'])
mpm@selenic.com
big heap of command clean-up work...
r245
Matt Mackall
walk: remove remaining users of cmdutils.matchpats
r6582 m = cmdutil.match(repo, pats, opts)
Matt Mackall
match: remove files argument from patch.diff
r6602 patch.diff(repo, node1, node2, match=m, opts=patch.diffopts(ui, opts))
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.
The information shown in the changeset header is: author,
Matt Mackall
Add notes about diff/merge asymmetry to export, diff, and log
r3822 changeset hash, parent(s) and commit comment.
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
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 given using a format string. The formatting rules are as follows:
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
%% 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
Without the -a option, export will avoid generating diffs of files
it detects as binary. With -a, export will generate a diff anyway,
probably with undesirable results.
Benoit Boissinot
add a --switch-parent option to export against the other parent
r1571
With the --switch-parent option, the diff will be against the second
parent. It can be useful to review a merge.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
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'))
Thomas Arendsen Hein
Don't use node length for calculating revision number length....
r3900 patch.export(repo, revs, template=opts['output'],
Matt Mackall
Move ui.diffopts to patch.diffopts where it belongs
r2888 switch_parent=opts['switch_parent'],
opts=patch.diffopts(ui, opts))
mpm@selenic.com
Migrate rawcommit, import, export, history, and merge...
r246
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
working directory. It always prints the revision number in which
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 a match appears.
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.
"""
Bryan O'Sullivan
Add grep command....
r1057 reflags = 0
Thomas Arendsen Hein
Cleanups to commands.py
r1065 if opts['ignore_case']:
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)
Giorgos Keramidas
hg grep: handle re.compile errors & update tests/test-grep
r4877 return None
bos@serpentine.internal.keyresearch.com
grep: extend functionality, add man page entry, add unit test....
r1146 sep, eol = ':', '\n'
Thomas Arendsen Hein
Remove some options from 'hg grep':...
r1108 if opts['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
fcache = {}
def getfile(fn):
if fn not in fcache:
fcache[fn] = repo.file(fn)
return fcache[fn]
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
lend = body.find('\n', mend)
yield linenum, mstart - lstart, mend - lstart, body[lstart:lend]
begin = lend + 1
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])
Bryan O'Sullivan
Add grep command....
r1057 prev = {}
def display(fn, rev, states, prevstates):
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 = {}
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 r = prev.get(fn, -1)
if opts['all']:
iter = difflinestates(states, prevstates)
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 else:
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 iter = [('', l) for l in prevstates]
for change, l in iter:
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 cols = [fn, str(r)]
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 if opts['line_number']:
cols.append(str(l.linenum))
if opts['all']:
cols.append(change)
if opts['user']:
Matt Mackall
move walkchangerevs to cmdutils
r3650 cols.append(ui.shortuser(get(r)[1]))
Thomas Arendsen Hein
Add hg grep -d/--date to list the commit date of matched revisions....
r6133 if opts.get('date'):
Thomas Arendsen Hein
Make annotae/grep print short dates with -q/--quiet....
r6134 cols.append(datefunc(get(r)[2]))
bos@serpentine.internal.keyresearch.com
grep: extend functionality, add man page entry, add unit test....
r1146 if opts['files_with_matches']:
Matt Mackall
Fixups for hg grep...
r3523 c = (fn, r)
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:
cols.append(l.line)
ui.write(sep.join(cols), eol)
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 found = True
return found
Bryan O'Sullivan
Add grep command....
r1057
fstate = {}
Bryan O'Sullivan
grep: change default to printing first matching rev....
r1145 skip = {}
Matt Mackall
use repo[changeid] to get a changectx
r6747 get = util.cachefunc(lambda r: repo[r].changeset())
Matt Mackall
move walkchangerevs to cmdutils
r3650 changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 found = False
Brendan Cully
grep: add --follow support.
r2870 follow = opts.get('follow')
bos@serpentine.internal.keyresearch.com
grep: extend functionality, add man page entry, add unit test....
r1146 for st, rev, fns in changeiter:
Bryan O'Sullivan
Add grep command....
r1057 if st == 'window':
matches.clear()
elif st == 'add':
Matt Mackall
use repo[changeid] to get a changectx
r6747 ctx = repo[rev]
Bryan O'Sullivan
Add grep command....
r1057 matches[rev] = {}
for fn in fns:
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 if fn in skip:
continue
Bryan O'Sullivan
Add grep command....
r1057 try:
Alexis S. L. Carvalho
Speed up hg grep by avoiding useless manifest parsing...
r6146 grepbody(fn, rev, getfile(fn).read(ctx.filenode(fn)))
Patrick Mezard
Fix issue 685: trackback in grep -r after rename
r5105 fstate.setdefault(fn, [])
Brendan Cully
grep: add --follow support.
r2870 if follow:
Alexis S. L. Carvalho
Speed up hg grep by avoiding useless manifest parsing...
r6146 copied = getfile(fn).renamed(ctx.filenode(fn))
Brendan Cully
grep: add --follow support.
r2870 if copied:
Brendan Cully
Fix bug #345....
r2931 copies.setdefault(rev, {})[fn] = copied[0]
Alexis S. L. Carvalho
Speed up hg grep by avoiding useless manifest parsing...
r6146 except revlog.LookupError:
Bryan O'Sullivan
Add grep command....
r1057 pass
elif st == 'iter':
Matt Mackall
util: add sort helper
r6762 for fn, m in util.sort(matches[rev].items()):
Brendan Cully
Fix bug #345....
r2931 copy = copies.get(rev, {}).get(fn)
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 if fn in skip:
Brendan Cully
grep: add --follow support.
r2870 if copy:
skip[copy] = True
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 continue
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 if fn in prev or fstate[fn]:
r = display(fn, rev, m, fstate[fn])
found = found or r
if r and not opts['all']:
Bryan O'Sullivan
grep: change default to printing first matching rev....
r1145 skip[fn] = True
Brendan Cully
grep: add --follow support.
r2870 if copy:
skip[copy] = True
Bryan O'Sullivan
Add grep command....
r1057 fstate[fn] = m
Brendan Cully
grep: add --follow support.
r2870 if copy:
fstate[copy] = m
Bryan O'Sullivan
Add grep command....
r1057 prev[fn] = rev
Matt Mackall
util: add sort helper
r6762 for fn, state in util.sort(fstate.items()):
Benoit Boissinot
grep: incrementing is always False during 'iter'
r3950 if fn in skip:
continue
if fn not in copies.get(prev[fn], {}):
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 found = display(fn, rev, {}, state) or found
return (not found and 1) or 0
Bryan O'Sullivan
Add grep command....
r1057
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
With no arguments, show all repository head changesets.
If branch or revisions names are given this will show the heads of
the specified branches or the branches those revisions are tagged
with.
Repository "heads" are changesets that don't have child
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 changesets. They are where development generally takes place and
are the usual targets for update and merge operations.
Eric Hopper
Add option to heads to show only heads for current branch.
r4648
Branch heads are changesets that have a given branch tag, but have
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 no child changesets with that tag. They are usually where
Eric Hopper
Add option to heads to show only heads for current branch.
r4648 development on the given branch takes place.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Benoit Boissinot
add a -r/--rev option to heads to show only heads descendant from rev
r1550 if opts['rev']:
Eric Hopper
Add option to heads to show only heads for current branch.
r4648 start = repo.lookup(opts['rev'])
else:
start = None
if not branchrevs:
# Assume we're looking repo-wide heads if no revs were specified.
heads = repo.heads(start)
Benoit Boissinot
add a -r/--rev option to heads to show only heads descendant from rev
r1550 else:
Eric Hopper
Add option to heads to show only heads for current branch.
r4648 heads = []
Brendan Cully
Small fixes for 8e503fa54d2d (hg heads branch)
r4649 visitedset = util.set()
Eric Hopper
Add option to heads to show only heads for current branch.
r4648 for branchrev in branchrevs:
Matt Mackall
use repo[changeid] to get a changectx
r6747 branch = repo[branchrev].branch()
Eric Hopper
Add option to heads to show only heads for current branch.
r4648 if branch in visitedset:
continue
visitedset.add(branch)
bheads = repo.branchheads(branch, start)
if not bheads:
if branch != branchrev:
ui.warn(_("no changes on branch %s containing %s are "
"reachable from %s\n")
% (branch, branchrev, opts['rev']))
else:
ui.warn(_("no changes on branch %s are reachable from %s\n")
% (branch, opts['rev']))
heads.extend(bheads)
if not heads:
return 1
Matt Mackall
templates: move changeset templating bits to cmdutils
r3643 displayer = cmdutil.show_changeset(ui, repo, opts)
Benoit Boissinot
add a -r/--rev option to heads to show only heads descendant from rev
r1550 for n in heads:
Matt Mackall
Consolidate brinfo handling
r3649 displayer.show(changenode=n)
mpm@selenic.com
Beginning of multi-head support...
r221
Matt Mackall
alphabetize help_ in commands
r3655 def help_(ui, name=None, with_version=False):
"""show help for a command, extension, or list of commands
With no arguments, print a list of commands and short help.
Given a command name, print help for that command.
Given an extension name, print help for that extension, and the
commands it provides."""
option_lists = []
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:
aliases, i = cmdutil.findcmd(ui, name, table)
except cmdutil.AmbiguousCommand, inst:
select = lambda c: c.lstrip('^').startswith(inst.args[0])
helplist(_('list of commands:\n\n'), select)
return
Matt Mackall
alphabetize help_ in commands
r3655 # synopsis
Thomas Arendsen Hein
Move aliases section in help below synopsis (issue362)...
r5783 ui.write("%s\n" % i[2])
# 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
doc = i[0].__doc__
if not doc:
doc = _("(No help text available)")
if ui.quiet:
doc = doc.splitlines(0)[0]
Thomas Arendsen Hein
Move aliases section in help below synopsis (issue362)...
r5783 ui.write("\n%s\n" % doc.rstrip())
Matt Mackall
alphabetize help_ in commands
r3655
if not ui.quiet:
# options
if i[1]:
Alexis S. L. Carvalho
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output...
r4315 option_lists.append((_("options:\n"), i[1]))
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 = {}
for c, e in table.items():
f = c.split("|", 1)[0]
if select and not select(f):
continue
if name == "shortlist" and not f.startswith("^"):
continue
f = f.lstrip("^")
if not ui.debugflag and f.startswith("debug"):
continue
doc = e[0].__doc__
if not doc:
doc = _("(No help text available)")
h[f] = doc.splitlines(0)[0].rstrip()
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
util: add sort helper
r6762 fns = util.sort(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:
ui.write(' %-*s %s\n' % (m, f, h[f]))
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):
v = None
Johannes Stezenbach
help: helptable is an ordered collection...
r6654 for i, d in help.helptable:
Matt Mackall
Add basic support for help topics and a dates topic
r3795 l = i.split('|')
if name in l:
v = i
header = l[-1]
Johannes Stezenbach
help: helptable is an ordered collection...
r6654 doc = d
Matt Mackall
Add basic support for help topics and a dates topic
r3795 if not v:
Matt Mackall
dispatch: move dispatching code to cmdutil
r4549 raise cmdutil.UnknownCommand(name)
Matt Mackall
Add basic support for help topics and a dates topic
r3795
# description
if not doc:
doc = _("(No help text available)")
Matt Mackall
Allow topics to be callables
r3796 if callable(doc):
doc = doc()
Matt Mackall
Add basic support for help topics and a dates topic
r3795
ui.write("%s\n" % header)
ui.write("%s\n" % doc.rstrip())
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)
Matt Mackall
alphabetize help_ in commands
r3655 except KeyError:
Matt Mackall
dispatch: move dispatching code to cmdutil
r4549 raise cmdutil.UnknownCommand(name)
Matt Mackall
alphabetize help_ in commands
r3655
doc = (mod.__doc__ or _('No help text available')).splitlines(0)
ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0]))
for d in doc[1:]:
ui.write(d, '\n')
ui.status('\n')
Benoit Boissinot
fix hg help <ext> for extension that do not define any command...
r4009
try:
ct = mod.cmdtable
except AttributeError:
Alexis S. L. Carvalho
help: avoid traceback if an extension has only debug commands
r4950 ct = {}
Benoit Boissinot
fix hg help <ext> for extension that do not define any command...
r4009 modcmds = dict.fromkeys([c.split('|', 1)[0] for c in ct])
Alexis S. L. Carvalho
help: avoid traceback if an extension has only debug commands
r4950 helplist(_('list of commands:\n\n'), modcmds.has_key)
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
for f in (helpcmd, helptopic, helpext):
try:
f(name)
i = None
break
Matt Mackall
dispatch: move dispatching code to cmdutil
r4549 except cmdutil.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)
Matt Mackall
alphabetize help_ in commands
r3655
# list all option lists
opt_output = []
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))
Matt Mackall
alphabetize help_ in commands
r3655 for shortopt, longopt, default, desc in options:
if "DEPRECATED" in desc and not ui.verbose: continue
opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt,
longopt and " --%s" % longopt),
"%s%s" % (desc,
default
and _(" (default: %s)") % default
or "")))
Johannes Stezenbach
help: list special help topics with -v
r6653 if ui.verbose:
ui.write(_("\nspecial help topics:\n"))
topics = []
Johannes Stezenbach
help: helptable is an ordered collection...
r6654 for i, d in help.helptable:
Johannes Stezenbach
help: list special help topics with -v
r6653 l = i.split('|')
topics.append((", ".join(l[:-1]), l[-1]))
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:
Alexis S. L. Carvalho
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output...
r4315 opts_len = max([len(line[0]) for line in opt_output if line[1]] or [0])
Matt Mackall
alphabetize help_ in commands
r3655 for first, second in opt_output:
if second:
ui.write(" %-*s %s\n" % (opts_len, first, second))
else:
ui.write("%s\n" % first)
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
Matt Mackall
identify: take a path to a remote repo...
r4671 With no revision, print a summary of the current state of the repo.
With a path, do a lookup in another repository.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
This summary identifies the repository state using one or two parent
hash identifiers, followed by a "+" if there are uncommitted changes
Matt Mackall
identify: accept a revision argument
r4665 in the working directory, a list of tags for this revision and a branch
name for non-default branches.
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
Matt Mackall
identify: take a path to a remote repo...
r4671 if source:
Alexis S. L. Carvalho
Merge with crew-stable
r5248 source, revs, checkout = hg.parseurl(ui.expandpath(source), [])
Matt Mackall
identify: take a path to a remote repo...
r4671 srepo = hg.repository(ui, source)
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")
Matt Mackall
identify: take a path to a remote repo...
r4671 output = [hexfunc(srepo.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:
changed = ctx.files() + ctx.deleted()
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()))
Matt Mackall
identify: take a path to a remote repo...
r4671 if not source and default and not ui.quiet:
Matt Mackall
identify: add support for output flags
r4666 b = util.tolocal(ctx.branch())
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:
output.append(util.tolocal(ctx.branch()))
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
Import a list of patches and commit them individually.
If there are outstanding changes in the working directory, import
will abort unless given the -f flag.
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
Vadim Gelfer
import: parse email messages
r2504 as attachments work (body part must be type text/plain or
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 text/x-patch to be used). From and Subject headers of email
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
Brendan Cully
Add import --exact....
r4263 If the imported patch was generated by hg export, user and description
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 from patch override values from message headers and body. Values
Vadim Gelfer
import: parse email messages
r2504 given on command line with -m and -u override these.
Vadim Gelfer
import: allow to import stdin with file name "-"
r2400
Brendan Cully
Add import --exact....
r4263 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.
Vadim Gelfer
import: allow to import stdin with file name "-"
r2400 To read a patch from standard input, use patch name "-".
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163 See 'hg help dates' for a list of formats valid for -d/--date.
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
Add import --exact....
r4263 if opts.get('exact') or not opts['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
try:
wlock = repo.wlock()
lock = repo.lock()
for p in patches:
pf = os.path.join(d, p)
if pf == '-':
ui.status(_("applying patch from stdin\n"))
data = patch.extract(ui, 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)
rupert.thurner@gmail.com
add import from url capability
r5205 if os.path.exists(pf):
data = patch.extract(ui, file(pf, 'rb'))
else:
data = patch.extract(ui, urllib.urlopen(pf))
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 tmpname, message, user, date, branch, nodeid, p1, p2 = data
if tmpname is None:
raise util.Abort(_('no diffs found'))
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)
Matt Mackall
use repo[changeid] to get a changectx
r6747 wp = repo.parents()
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 if opts.get('exact'):
if not nodeid or not p1:
raise util.Abort(_('not a mercurial patch'))
Brendan Cully
Make import opportunistically use merge information
r4264 p1 = repo.lookup(p1)
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 p2 = repo.lookup(p2 or hex(nullid))
if p1 != wp[0].node():
Matt Mackall
Make repo locks recursive, eliminate all passing of lock/wlock
r4917 hg.clean(repo, p1)
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 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)
Joel Rosdahl
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
r6217 except RepoError:
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 pass
if opts.get('exact') or opts.get('import_branch'):
repo.dirstate.setbranch(branch or 'default')
files = {}
try:
fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root,
files=files)
finally:
Matt Mackall
Make repo locks recursive, eliminate all passing of lock/wlock
r4917 files = patch.updatedir(ui, repo, files)
Joel Rosdahl
Add --no-commit option to import command
r5936 if not opts.get('no_commit'):
Jesse Glick
Permitting the import command to accept a --user option....
r5953 n = repo.commit(files, message, opts.get('user') or user,
opts.get('date') or date)
Joel Rosdahl
Add --no-commit option to import command
r5936 if opts.get('exact'):
if hex(n) != nodeid:
repo.rollback()
raise util.Abort(_('patch is damaged'
' or loses information'))
Alexis S. L. Carvalho
merge with crew-stable
r6001 # Force a dirstate write so that the next transaction
# backups an up-do-date file.
repo.dirstate.write()
Brendan Cully
patch: return list of modified files even when an exception is raised...
r3465 finally:
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 os.unlink(tmpname)
finally:
Alexis S. L. Carvalho
del transaction before lock before wlock...
r5053 del 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
pull location. These are the changesets that would be pulled if a pull
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 was requested.
Benoit Boissinot
incoming: add support for remote repo using bundlerepo
r1944 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.
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)
Alexis S. L. Carvalho
Merge with crew-stable
r5248 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts['rev'])
Matt Mackall
dispatch: move dispatching code to cmdutil
r4549 cmdutil.setremoteconfig(ui, opts)
Benoit Boissinot
add remotecmd/ssh option support to incoming/outgoing
r1965
mpm@selenic.com
Add hg incoming command for local repositories
r927 other = hg.repository(ui, source)
Manuel Holtgrewe
Do not display passwords with pull/push/incoming/outgoing...
r5525 ui.status(_('comparing with %s\n') % util.hidepassword(source))
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]
Thomas Arendsen Hein
Make "hg incoming -r revision_number" work for remote repos (issue566)...
r4451 incoming = repo.findincoming(other, heads=revs, force=opts["force"])
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)
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]
Thomas Arendsen Hein
Delete bundle file of hg incoming in case of errors, preserve existing files....
r1974 if opts['newest_first']:
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:
Thomas Arendsen Hein
Add option -l/--limit to hg incoming and hg outgoing.
r6191 if count >= limit:
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]
if opts['no_merges'] and len(parents) == 2:
continue
Thomas Arendsen Hein
Add option -l/--limit to hg incoming and hg outgoing.
r6191 count += 1
Thomas Arendsen Hein
Delete bundle file of hg incoming in case of errors, preserve existing files....
r1974 displayer.show(changenode=n)
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
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 directory does not exist, it is created.
If no directory is given, the current directory is used.
Thomas Arendsen Hein
Additional information about URLs in pull/push/clone/init:...
r2590
It is possible to specify an ssh:// URL as the destination.
Look at the help text for the pull command for important details
about ssh:// URLs.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
dispatch: move dispatching code to cmdutil
r4549 cmdutil.setremoteconfig(ui, opts)
Bryan O'Sullivan
Modify init command to take an optional directory to set up....
r907 hg.repository(ui, 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
Print all files under Mercurial control whose names match the
given patterns.
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 This command searches the entire repository by default. To search
paul sorenson
Command in doc comment is now on a single line, fixed...
r4692 just the current directory and its subdirectories, use
"--include .".
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
If no patterns are given to match, this command prints all file
names.
If you want to feed the output of this command into the "xargs"
command, use the "-0" option to both this command and "xargs".
This will avoid the problem of "xargs" treating single filenames
that contain white space as multiple filenames.
"""
Thomas Arendsen Hein
Cleanups to commands.py
r1065 end = opts['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
walk: remove more old badmatch logic
r6583 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:
Thomas Arendsen Hein
Cleanups to commands.py
r1065 continue
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 if opts['fullpath']:
Bryan O'Sullivan
Get add and locate to use new repo and dirstate walk code....
r724 ui.write(os.path.join(repo.root, abs), end)
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
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 files. Use -f/--follow with a file name to follow history across
Brendan Cully
Make log --follow without a file list follow a single head....
r2782 renames and copies. --follow without a file name 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
used as the starting revision.
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163 See 'hg help dates' for a list of formats valid for -d/--date.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 By default this command outputs: changeset id and hash, tags,
Thomas Arendsen Hein
Updated help text for 'hg log'.
r1557 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 is shown.
Matt Mackall
Add notes about diff/merge asymmetry to export, diff, and log
r3822
NOTE: log -p may generate unexpected diff output for merge
changesets, as it will compare the merge changeset against its
first parent only. Also, the files: list will only reflect files
that are different from BOTH parents.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Vadim Gelfer
add -l,--limit to log command.
r1756
Matt Mackall
use repo[changeid] to get a changectx
r6747 get = util.cachefunc(lambda r: repo[r].changeset())
Matt Mackall
move walkchangerevs to cmdutils
r3650 changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
Matt Mackall
Fix excessive complaining from hg log -b
r3518
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
Brendan Cully
Show copies in hg log....
r3197 if opts['copies'] and opts['rev']:
Thomas Arendsen Hein
Removed unused ui parameter from revpair/revrange and fix its users.
r3707 endrev = max(cmdutil.revrange(repo, opts['rev'])) + 1
Brendan Cully
Show copies in hg log....
r3197 else:
Matt Mackall
add __len__ and __iter__ methods to repo and revlog
r6750 endrev = len(repo)
Brendan Cully
Show copies in hg log....
r3197 rcache = {}
ncache = {}
Maxim Dounin
Fix copies reporting in log and convert....
r5811 def getrenamed(fn, rev):
Brendan Cully
Show copies in hg log....
r3197 '''looks up all renames for a file (up to endrev) the first
time the file is given. It indexes on the changerev and only
parses the manifest if linkrev != changerev.
Returns rename info for fn at changerev rev.'''
if fn not in rcache:
rcache[fn] = {}
ncache[fn] = {}
fl = repo.file(fn)
Matt Mackall
add __len__ and __iter__ methods to repo and revlog
r6750 for i in fl:
Brendan Cully
Show copies in hg log....
r3197 node = fl.node(i)
lr = fl.linkrev(node)
renamed = fl.renamed(node)
rcache[fn][lr] = renamed
if renamed:
ncache[fn][node] = renamed
if lr >= endrev:
break
if rev in rcache[fn]:
return rcache[fn][rev]
Maxim Dounin
Fix copies reporting in log and convert....
r5811
# If linkrev != rev (i.e. rev not found in rcache) fallback to
# filectx logic.
try:
Matt Mackall
use repo[changeid] to get a changectx
r6747 return repo[rev][fn].renamed()
Maxim Dounin
Fix copies reporting in log and convert....
r5811 except revlog.LookupError:
pass
Brendan Cully
Show copies in hg log....
r3197 return None
Matt Mackall
Add --date support to log...
r3813 df = False
if opts["date"]:
df = util.matchdate(opts["date"])
Dustin Sallings
Option to log to only show changesets within a specified branch.
r6067 only_branches = opts['only_branch']
Matt Mackall
Fix log regression where log -p file showed diffs for other files
r3837 displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn)
bos@serpentine.internal.keyresearch.com
grep: extend functionality, add man page entry, add unit test....
r1146 for st, rev, fns in changeiter:
Matt Mackall
Refactor log ui buffering and patch display
r3645 if st == 'add':
Benoit Boissinot
add --no-merges (-M) for log, outgoing, incoming
r1435 changenode = repo.changelog.node(rev)
Thomas Arendsen Hein
Define and use nullrev (revision of nullid) instead of -1.
r3578 parents = [p for p in repo.changelog.parentrevs(rev)
if p != nullrev]
Benoit Boissinot
add --no-merges (-M) for log, outgoing, incoming
r1435 if opts['no_merges'] and len(parents) == 2:
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 continue
Benoit Boissinot
add --only-merges (-m) log
r1436 if opts['only_merges'] and len(parents) != 2:
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 continue
Benoit Boissinot
add --no-merges (-M) for log, outgoing, incoming
r1435
Dustin Sallings
Option to log to only show changesets within a specified branch.
r6067 if only_branches:
revbranch = get(rev)[5]['branch']
if revbranch not in only_branches:
continue
Matt Mackall
Add --date support to log...
r3813 if df:
changes = get(rev)
if not df(changes[2][0]):
continue
Matt Mackall
hg log: add -k for keyword searching
r1373 if opts['keyword']:
Matt Mackall
move walkchangerevs to cmdutils
r3650 changes = get(rev)
Matt Mackall
hg log: add -k for keyword searching
r1373 miss = 0
TK Soh
log: make keyword search truly case-insensitive
r1404 for k in [kw.lower() for kw in opts['keyword']]:
Matt Mackall
hg log: add -k for keyword searching
r1373 if not (k in changes[1].lower() or
k in changes[4].lower() or
TK Soh
log: expand keyword search to full list of files
r4322 k in " ".join(changes[3]).lower()):
Matt Mackall
hg log: add -k for keyword searching
r1373 miss = 1
break
if miss:
continue
Brendan Cully
Show copies in hg log....
r3197 copies = []
if opts.get('copies') and rev:
Matt Mackall
move walkchangerevs to cmdutils
r3650 for fn in get(rev)[3]:
Maxim Dounin
Fix copies reporting in log and convert....
r5811 rename = getrenamed(fn, rev)
Brendan Cully
Show copies in hg log....
r3197 if rename:
copies.append((fn, rename[0]))
Matt Mackall
Consolidate brinfo handling
r3649 displayer.show(rev, changenode, copies=copies)
Bryan O'Sullivan
Add grep command....
r1057 elif st == 'iter':
Vadim Gelfer
add -l,--limit to log command.
r1756 if count == limit: break
Matt Mackall
Refactor log ui buffering and patch display
r3645 if displayer.flush(rev):
Thomas Arendsen Hein
hg log --limit shouldn't count unprinted revisions (found by TK Soh)
r1765 count += 1
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.
Thomas Arendsen Hein
doc fix: hg tags defaults to current parent revision, too....
r3915 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
The manifest is the list of files being version controlled. If no revision
Matt Mackall
make manifest friendlier...
r3736 is given then the first parent of the working directory is used.
Thomas Arendsen Hein
Removed tabs and trailing whitespace in python files
r5760 With -v flag, print file permissions, symlink and executable bits. With
Patrick Mezard
Display symlink or executable bit with manifest -v...
r5405 --debug flag, print file revision hashes.
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
Daniel Holth
accept -r REV in more places...
r4450 def merge(ui, repo, node=None, force=None, rev=None):
Benoit Boissinot
various doc fixes...
r4014 """merge working directory with another revision
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019
Merge the contents of the current working directory and the
requested revision. Files that changed between either parent are
marked as changed for the next commit and a commit must be
performed before any further updates are allowed.
Vadim Gelfer
merge with other head by default, not tip....
r2915
If no revision is specified, the working directory's parent is a
Dirkjan Ochtman
merge: only in-branch merges can be implicit
r6723 head revision, and the current branch contains exactly one other head,
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 the other head is merged with by default. Otherwise, an explicit
Vadim Gelfer
merge with other head by default, not tip....
r2915 revision to merge with must be provided.
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019 """
Matt Mackall
Factor doupdate into _lookup + hg.update
r2806
Daniel Holth
accept -r REV in more places...
r4450 if rev and node:
raise util.Abort(_("please specify just one revision"))
if not node:
node = rev
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: only in-branch merges can be implicit
r6723 bheads = repo.branchheads()
if len(bheads) > 2:
raise util.Abort(_("branch '%s' has %d heads - "
"please merge with an explicit rev") %
(branch, len(bheads)))
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:
raise util.Abort(_("branch '%s' has one head - "
"please merge with an explicit rev") %
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]
Matt Mackall
Introduce update helper functions: update, merge, clean, and revert
r2808 return hg.merge(repo, node, force=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):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """show changesets not found in destination
Thomas Arendsen Hein
More detailed documentation about ssh:// URLs; fixes issue170.
r1979 Show changesets not found in the specified destination repository or
the default push location. These are the changesets that would be pushed
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 if a push was requested.
Benoit Boissinot
resync commands.py docstrings with hg.1.txt
r1811
Thomas Arendsen Hein
More detailed documentation about ssh:// URLs; fixes issue170.
r1979 See pull for valid destination format details.
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)
Alexis S. L. Carvalho
Merge with crew-stable
r5248 dest, revs, checkout = hg.parseurl(
Matt Mackall
Add support for url#id syntax...
r4478 ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev'])
Matt Mackall
dispatch: move dispatching code to cmdutil
r4549 cmdutil.setremoteconfig(ui, opts)
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
mpm@selenic.com
Add hg outgoing command
r920 other = hg.repository(ui, dest)
Manuel Holtgrewe
Do not display passwords with pull/push/incoming/outgoing...
r5525 ui.status(_('comparing with %s\n') % util.hidepassword(dest))
Vadim Gelfer
add -f/--force to pull, incoming, outgoing, to work on unrelated repo....
r1959 o = repo.findoutgoing(other, force=opts['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]
Michal Kvasnica
allow 'hg out' / 'hg in' to show newest commit first
r1439 if opts['newest_first']:
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:
Thomas Arendsen Hein
Add option -l/--limit to hg incoming and hg outgoing.
r6191 if count >= limit:
break
Benoit Boissinot
add --no-merges (-M) for log, outgoing, incoming
r1435 parents = [p for p in repo.changelog.parents(n) if p != nullid]
if opts['no_merges'] and len(parents) == 2:
continue
Thomas Arendsen Hein
Add option -l/--limit to hg incoming and hg outgoing.
r6191 count += 1
Vadim Gelfer
let commands that show changesets use templates....
r1907 displayer.show(changenode=n)
mpm@selenic.com
Add hg outgoing command
r920
Matt Mackall
remove legacy hg parents REV syntax
r3658 def parents(ui, repo, file_=None, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """show the parents of the working dir or revision
Brendan Cully
Make parents with a file but not a revision use working directory revision.
r4586 Print the working directory's parent revisions. If a
revision is given via --rev, the parent of that revision
will be printed. If a file argument is given, revision in
which the file was last changed (before the working directory
revision or the argument to --rev if given) is printed.
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:
Alexis S. L. Carvalho
hg parents: don't pass an OS-specific path to repo.filectx...
r4894 raise util.Abort(_('can only specify an explicit file name'))
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_))
except revlog.LookupError:
pass
if not filenodes:
raise util.Abort(_("'%s' not found in manifest!") % file_)
fl = repo.file(file_)
p = [repo.lookup(fl.linkrev(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:
Matt Mackall
Consolidate brinfo handling
r3649 displayer.show(changenode=n)
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):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """show definition of symbolic path names
Show definition of symbolic path name NAME. If no name is given, show
definition of available names.
Path names are defined in the [paths] section of /etc/mercurial/hgrc
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too.
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:
Brendan Cully
Hide URL passwords in hg paths output.
r6234 ui.write("%s\n" % util.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"):
Brendan Cully
Hide URL passwords in hg paths output.
r6234 ui.write("%s = %s\n" % (name, util.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:
Alexis S. L. Carvalho
pull -u: if "url#rev" was given, update to rev
r5224 if modheads <= 1 or checkout:
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
Pull changes from a remote repository to a local one.
This finds all changes from the repository at the specified path
or URL and adds them to the local repository. By default, this
does not update the copy of the project in the working directory.
Valid URLs are of the form:
Thomas Arendsen Hein
Some clarifications for pull/push protocols:...
r3563 local/filesystem/path (or file://local/filesystem/path)
"Aurelien Jacobs "
disambiguate help about url syntax
r2589 http://[user@]host[:port]/[path]
https://[user@]host[:port]/[path]
ssh://[user@]host[:port]/[path]
Thomas Arendsen Hein
Some clarifications for pull/push protocols:...
r3563 static-http://host[:port]/[path]
Paths in the local filesystem can either point to Mercurial
repositories or to bundle files (as created by 'hg bundle' or
'hg incoming --bundle'). The static-http:// protocol, albeit slow,
allows access to a Mercurial repository where you simply use a web
server to publish the .hg directory as static content.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Matt Mackall
Add support for url#id syntax...
r4478 An optional identifier after # indicates a particular branch, tag,
or changeset to pull.
Thomas Arendsen Hein
More detailed documentation about ssh:// URLs; fixes issue170.
r1979 Some notes about using SSH with Mercurial:
- SSH requires an accessible shell account on the destination machine
and a copy of hg in the remote path or specified with as remotecmd.
"Aurelien Jacobs "
disambiguate help about url syntax
r2589 - path is relative to the remote user's home directory by default.
Thomas Arendsen Hein
Additional information about URLs in pull/push/clone/init:...
r2590 Use an extra slash at the start of a path to specify an absolute path:
ssh://example.com//tmp/repository
Thomas Arendsen Hein
More detailed documentation about ssh:// URLs; fixes issue170.
r1979 - Mercurial doesn't use its own compression via SSH; the right thing
Thomas Arendsen Hein
Corrected SSH configuration example in pull help.
r3471 to do is to configure it in your ~/.ssh/config, e.g.:
Thomas Arendsen Hein
More detailed documentation about ssh:// URLs; fixes issue170.
r1979 Host *.mylocalnetwork.example.com
Thomas Arendsen Hein
Corrected SSH configuration example in pull help.
r3471 Compression no
Thomas Arendsen Hein
More detailed documentation about ssh:// URLs; fixes issue170.
r1979 Host *
Thomas Arendsen Hein
Corrected SSH configuration example in pull help.
r3471 Compression yes
Thomas Arendsen Hein
More detailed documentation about ssh:// URLs; fixes issue170.
r1979 Alternatively specify "ssh -C" as your ssh command in your hgrc or
with the --ssh command line option.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Alexis S. L. Carvalho
Merge with crew-stable
r5248 source, revs, checkout = hg.parseurl(ui.expandpath(source), opts['rev'])
Matt Mackall
dispatch: move dispatching code to cmdutil
r4549 cmdutil.setremoteconfig(ui, opts)
mpm@selenic.com
Add -e and --remotecmd for clone and pull too
r963
mpm@selenic.com
Migrate rawcommit, import, export, history, and merge...
r246 other = hg.repository(ui, source)
Manuel Holtgrewe
Do not display passwords with pull/push/incoming/outgoing...
r5525 ui.status(_('pulling from %s\n') % util.hidepassword(source))
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]
Patrick Mezard
commands: fix shadowed repo module
r6405 except NoCapability:
Bryan O'Sullivan
Push capability checking into protocol-level code.
r5259 error = _("Other repository doesn't support revision lookup, "
"so a rev cannot be specified.")
Eric Hopper
Stop erroring out pull -r and clone -r if repository isn't local.
r3448 raise util.Abort(error)
Matt Mackall
Add support for url#id syntax...
r4478
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019 modheads = repo.pull(other, heads=revs, force=opts['force'])
Alexis S. L. Carvalho
pull -u: if "url#rev" was given, update to rev
r5224 return postincoming(ui, repo, modheads, opts['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
Push changes from the local repository to the given destination.
This is the symmetrical operation for pull. It helps to move
changes from the current repository to a different one. If the
destination is local this is identical to a pull in that directory
from the current one.
By default, push will refuse to run if it detects the result would
increase the number of remote heads. This generally indicates the
Dirkjan Ochtman
improve help text for push (explanation of -r)
r6620 the client has forgotten to pull and merge before pushing.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Valid URLs are of the form:
Thomas Arendsen Hein
Some clarifications for pull/push protocols:...
r3563 local/filesystem/path (or file://local/filesystem/path)
"Aurelien Jacobs "
disambiguate help about url syntax
r2589 ssh://[user@]host[:port]/[path]
Thomas Arendsen Hein
Some clarifications for pull/push protocols:...
r3563 http://[user@]host[:port]/[path]
https://[user@]host[:port]/[path]
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Matt Mackall
Add support for url#id syntax...
r4478 An optional identifier after # indicates a particular branch, tag,
Dirkjan Ochtman
improve help text for push (explanation of -r)
r6620 or changeset to push. If -r is used, the named changeset and all its
ancestors will be pushed to the remote repository.
Matt Mackall
Add support for url#id syntax...
r4478
Thomas Arendsen Hein
More detailed documentation about ssh:// URLs; fixes issue170.
r1979 Look at the help text for the pull command for important details
about ssh:// URLs.
Thomas Arendsen Hein
Additional information about URLs in pull/push/clone/init:...
r2590
Thomas Arendsen Hein
Some clarifications for pull/push protocols:...
r3563 Pushing to http:// and https:// URLs is only possible, if this
feature is explicitly enabled on the remote Mercurial server.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Alexis S. L. Carvalho
Merge with crew-stable
r5248 dest, revs, checkout = hg.parseurl(
Matt Mackall
Add support for url#id syntax...
r4478 ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev'])
Matt Mackall
dispatch: move dispatching code to cmdutil
r4549 cmdutil.setremoteconfig(ui, opts)
mpm@selenic.com
Add --ssh and --remotecmd to push...
r961
Matt Mackall
Switch push over to the new scheme...
r640 other = hg.repository(ui, dest)
Manuel Holtgrewe
Do not display passwords with pull/push/incoming/outgoing...
r5525 ui.status('pushing to %s\n' % util.hidepassword(dest))
Matt Mackall
Add support for url#id syntax...
r4478 if revs:
revs = [repo.lookup(rev) for rev in revs]
Benoit Boissinot
add an optional argument to push only the specified revisions (push -r)
r1781 r = repo.push(other, opts['force'], revs=revs)
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019 return r == 0
mpm@selenic.com
stopgap hg push support...
r319
Matt Mackall
refactor rawcommit
r3653 def rawcommit(ui, repo, *pats, **opts):
Benoit Boissinot
fix the synopsis of some commands, mark rawcommit as deprecated in short help
r1812 """raw commit interface (DEPRECATED)
Benoit Boissinot
resync commands.py docstrings with hg.1.txt
r1811
(DEPRECATED)
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 Lowlevel commit, for use in helper scripts.
This command is not intended to be used by normal users, as it is
primarily useful for importing from other SCMs.
Matt Mackall
deprecate the rawcommit command
r1657
This command is now deprecated and will be removed in a future
release, please use debugsetparents and commit instead.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
deprecate the rawcommit command
r1657
ui.warn(_("(the rawcommit command is deprecated)\n"))
Matt Mackall
dispatch: move dispatching code to cmdutil
r4549 message = cmdutil.logmessage(opts)
Matt Mackall
refactor rawcommit
r3653
Matt Mackall
walk: remove remaining users of cmdutils.matchpats
r6582 files = cmdutil.match(repo, pats, opts).files()
Matt Mackall
refactor rawcommit
r3653 if opts['files']:
files += open(opts['files']).read().splitlines()
parents = [repo.lookup(p) for p in opts['parent']]
mpm@selenic.com
[PATCH] Clean up destination directory if a clone fails....
r500
Bryan O'Sullivan
Commit date validation: more stringent checks, more useful error messages.
r1202 try:
Matt Mackall
move write_bundle to changegroup.py
r3659 repo.rawcommit(files, message, opts['user'], opts['date'], *parents)
Bryan O'Sullivan
Commit date validation: more stringent checks, more useful error messages.
r1202 except ValueError, inst:
raise util.Abort(str(inst))
mpm@selenic.com
[PATCH] Clean up destination directory if a clone fails....
r500
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.
This command tries to fix the repository status after an interrupted
operation. It should only be necessary when Mercurial suggests it.
"""
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.
Dirkjan Ochtman
improved semantics for remove (issue438)...
r6346 This only removes files from the current branch, not from the entire
project history. -A can be used to remove only files that have already
been deleted, -f can be used to force deletion, and -Af can be used
to remove files from the next revision without deleting them.
Thomas Arendsen Hein
removed trailing spaces
r6352
Dirkjan Ochtman
improved semantics for remove (issue438)...
r6346 The following table details the behavior of remove for different file
states (columns) and option combinations (rows). The file states are
Added, Clean, Modified and Missing (as reported by hg status). The
actions are Warn, Remove (from branch) and Delete (from disk).
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.
To undo a remove before that, see hg revert.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
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]
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))
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
util: add sort helper
r6762 for f in util.sort(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
Vadim Gelfer
remove: rewrite to be ~400x faster, bit more friendly...
r2309 repo.forget(forget)
Dirkjan Ochtman
improved semantics for remove (issue438)...
r6346 repo.remove(remove, unlink=not after)
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
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 Mark dest as copies of sources; mark sources for deletion. If
dest is a directory, copies are put in that directory. If dest is
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 a file, there can only be one source.
By default, this command copies the contents of files as they
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 stand in the working directory. If invoked with --after, the
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 operation is recorded, but no copying is performed.
Matt Mackall
Add doc notes about revert and hg status vs diff
r3829 This command takes effect in the next commit. To undo a rename
before that, see hg revert.
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:
del wlock
Bryan O'Sullivan
Add rename/mv command....
r1253
Matt Mackall
resolve: new command...
r6518 def resolve(ui, repo, *pats, **opts):
"""resolve file merges from a branch merge or update
This command will attempt to resolve unresolved merges from the
last update or merge command. This will use the local file
revision preserved at the last update or merge to cleanly retry
the file merge attempt. With no file or options specified, this
command will attempt to resolve all unresolved files.
Adrian Buehlmann
resolve: add file codes to doc string
r6642
The codes used to show the status of files are:
U = unresolved
R = resolved
Matt Mackall
resolve: new command...
r6518 """
if len([x for x in opts if opts[x]]) > 1:
raise util.Abort(_("too many options specified"))
ms = merge_.mergestate(repo)
Matt Mackall
resolve: use cmdutil.match
r6594 m = cmdutil.match(repo, pats, opts)
Matt Mackall
resolve: new command...
r6518
for f in ms:
Matt Mackall
resolve: use cmdutil.match
r6594 if m(f):
Matt Mackall
resolve: new command...
r6518 if opts.get("list"):
ui.write("%s %s\n" % (ms[f].upper(), f))
elif opts.get("mark"):
ms.mark(f, "r")
elif opts.get("unmark"):
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]
ms.resolve(f, wctx, mctx)
Benoit Boissinot
make revert use standard matcher
r1472 def revert(ui, repo, *pats, **opts):
Matt Mackall
imported patch rev-help
r5574 """restore individual files or dirs to an earlier state
(use update -r to check out earlier revisions, revert does not
change the working dir parents)
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
working directory has two parents, you must explicitly specify the
revision to revert to.
Benoit Boissinot
resync commands.py docstrings with hg.1.txt
r1811
TK Soh
minor docstring fix for revert
r3016 Using the -r option, revert the given files or directories to their
contents as of a specific revision. This can be helpful to "roll
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163 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
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 If a file has been deleted, it is restored. If the executable
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 mode of a file was changed, it is reset.
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.
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"])
Vadim Gelfer
revert: require --all to revert all files.
r2982 if not pats and not opts['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()
Brendan Cully
Move defaultrev into changectx...
r3132 if not opts['rev'] and p2 != nullid:
raise util.Abort(_('uncommitted merge - please provide a '
'specific revision'))
Matt Mackall
use repo[changeid] to get a changectx
r6747 ctx = repo[opts['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.
Alexis S. L. Carvalho
revert: don't let repo.status walk the whole working dir...
r6106 files = []
Matt Mackall
walk: pass match object to cmdutil.walk...
r6579
m = cmdutil.match(repo, pats, opts)
Matt Mackall
walk: remove more old badmatch logic
r6583 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
walk: remove more old badmatch logic
r6583 return False
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 path_ = path + '/'
for f in names:
if f.startswith(path_):
Matt Mackall
walk: remove more old badmatch logic
r6583 return False
repo.ui.warn("%s: %s\n" % (m.rel(path), msg))
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 return False
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]
Alexis S. L. Carvalho
revert: don't assume ignored files will be returned in the unknown list...
r6031 modified, added, removed, deleted = map(dict.fromkeys, 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':
removed[src] = None
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
util: add sort helper
r6762 for abs, (rel, exact) in util.sort(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)
if dobackup and not opts['no_backup'] and util.lexists(target):
bakname = "%s.orig" % rel
ui.note(_('saving current version of %s as %s\n') %
(rel, bakname))
if not opts.get('dry_run'):
util.copyfile(target, bakname)
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:
if abs not in table: continue
# 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:
if exact: ui.warn(_('no changes needed to %s\n') % rel)
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:
del wlock
mpm@selenic.com
[PATCH] hg revert...
r588
Vadim Gelfer
deprecate undo command, replace with rollback command.
r2227 def rollback(ui, repo):
Matt Mackall
imported patch rollback-help
r5575 """roll back the last transaction
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
any dirstate changes since that time.
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,
and their effects can be rolled back:
commit
import
pull
push (with this repository as destination)
unbundle
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.
"""
Thomas Arendsen Hein
Renamed localrepo.undo() to rollback() and talk about "rollback information".
r2362 repo.rollback()
Vadim Gelfer
deprecate undo command, replace with rollback command.
r2227
mpm@selenic.com
[PATCH] add "root" command...
r468 def root(ui, repo):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """print the root (top) of the current working dir
Print the root directory of the current repository.
"""
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):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """export the repository via HTTP
Start a local HTTP repository browser and pull server.
By default, the server logs accesses to stdout and errors to
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 stderr. Use the "-A" and "-E" options to log to files.
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:
Joel Rosdahl
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
r6217 raise RepoError(_("There is no Mercurial repository here"
" (.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
Alexis S. L. Carvalho
hg serve: call setconfig on the parentui...
r4078 parentui = ui.parentui or ui
Michele Cella
adding "prefix" option to "hg serve" (command line and [web] section)...
r5835 optlist = ("name templates style address port prefix ipv6"
Brendan Cully
Add SSL support to hg serve, activated via --certificate option
r4860 " accesslog errorlog webdir_conf certificate")
mpm@selenic.com
hgweb: change startup argument processing...
r987 for o in optlist.split():
if opts[o]:
Alexis S. L. Carvalho
hg serve: call setconfig on the parentui...
r4078 parentui.setconfig("web", o, str(opts[o]))
Eric Hopper
Fix hgwebdir after 9858477ed74cce9dc8f4069f9453a1bda0e13ba1 broke it.
r5083 if (repo is not None) and (repo.ui != parentui):
Alexis S. L. Carvalho
serve: respect settings from .hg/hgrc...
r4835 repo.ui.setconfig("web", o, str(opts[o]))
mpm@selenic.com
hgweb: change startup argument processing...
r987
Thomas Arendsen Hein
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
r2127 if repo is None and not ui.config("web", "webdir_conf"):
Joel Rosdahl
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
r6217 raise RepoError(_("There is no Mercurial repository here"
" (.hg not found)"))
Thomas Arendsen Hein
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
r2127
Bryan O'Sullivan
Refactor commands.serve to allow other commands to run as services....
r4380 class service:
def init(self):
Marcos Chaves
Handle CTRL+C in serve under Windows.
r4672 util.set_signal_handler()
Stephen Deasey
hgweb: clarify which address and port can/cannot be bound at startup (bug 769)...
r6262 self.httpd = hgweb.server.create_server(parentui, repo)
Bryan O'Sullivan
Refactor commands.serve to allow other commands to run as services....
r4380
if not ui.verbose: return
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
ui.status(_('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
Thomas Arendsen Hein
Clarify help for hg status and make it consistent.
r5998 source of a copy/move operation, are not listed unless -c (clean),
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 -i (ignored), -C (copies) or -A is given. Unless options described
Thomas Arendsen Hein
Clarify help for hg status and make it consistent.
r5998 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
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.
If two revisions are given, the difference between them is shown.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 The codes used to show the status of files are:
mpm@selenic.com
Change C to M in status
r746 M = modified
mpm@selenic.com
big heap of command clean-up work...
r245 A = added
R = removed
Vadim Gelfer
status: add -c (clean) and -A (all files) options...
r2661 C = clean
Thomas Arendsen Hein
Distinguish removed and deleted files. Tests are not fixed yet....
r1619 ! = deleted, but still tracked
Thomas Arendsen Hein
Rewritten change type selection for hg status.
r842 ? = not tracked
Thomas Arendsen Hein
Clarify help for hg status and make it consistent.
r5998 I = ignored
Brendan Cully
Add an option '-C|--copies' to hg status to show the source of copied files....
r2639 = the previous added file was copied from here
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
mpm@selenic.com
Optimize diff and status in subdirectories...
r312
Thomas Arendsen Hein
Removed unused ui parameter from revpair/revrange and fix its users.
r3707 node1, node2 = cmdutil.revpair(repo, opts.get('rev'))
Benoit Boissinot
correct the relative path when walking from a subdir...
r1625 cwd = (pats and repo.getcwd()) or ''
Matt Mackall
status: refactor status command...
r6605 end = opts['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()
show = [k for k in states if opts[k]]
if opts['all']:
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)
if (opts['all'] or opts['copies']) and not opts['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
Matt Mackall
copies: teach copies about dirstate.copies...
r6646 for k, v in copies.copies(repo, ctx1, ctx2, ctxn)[0].items():
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)
Matt Mackall
status: refactor status command...
r6605 if opts['no_status']:
format = "%%s%s" % end
for f in files:
ui.write(format % repo.pathto(f, cwd))
if f in copy:
ui.write(' %s%s' % (repo.pathto(copy[f], cwd), end))
mpm@selenic.com
commands: migrate status and branch...
r213
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.
Thomas Arendsen Hein
doc fix: hg tags defaults to current parent revision, too....
r3915 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
See 'hg help dates' for a list of formats valid for -d/--date.
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_ = "."
John Coomes
tag: allow multiple tags to be added or removed...
r6321 names = (name1,) + names
if len(names) != len(dict.fromkeys(names)):
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)
Matt Mackall
tags: add --remove
r4213 if opts['rev'] and opts['remove']:
raise util.Abort(_("--rev and --remove are incompatible"))
Benoit Boissinot
fix 'hg tag <tagname> <revision>...
r1596 if opts['rev']:
rev_ = opts['rev']
Matt Mackall
tags: add --remove
r4213 message = opts['message']
if opts['remove']:
John Coomes
tag: allow multiple tags to be added or removed...
r6321 expectedtype = opts['local'] and 'local' or 'global'
for n in names:
if not repo.tagtype(n):
raise util.Abort(_('tag \'%s\' does not exist') % n)
if repo.tagtype(n) != expectedtype:
raise util.Abort(_('tag \'%s\' is not a %s tag') %
(n, expectedtype))
Matt Mackall
tags: add --remove
r4213 rev_ = nullid
if not message:
John Coomes
tag: allow multiple tags to be added or removed...
r6321 message = _('Removed tag %s') % ', '.join(names)
elif not opts['force']:
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:
John Coomes
tag: allow multiple tags to be added or removed...
r6321 message = (_('Added tag %s for changeset %s') %
(', '.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)
John Coomes
tag: allow multiple tags to be added or removed...
r6321 repo.tag(names, r, message, opts['local'], opts['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
List the repository tags.
Osku Salerma
Add --verbose support to tags command.
r5658 This lists both regular and local tags. When the -v/--verbose switch
is used, a third column "local" is printed for local tags.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Thomas Arendsen Hein
Handle errors in .hgtags or hgrc [tags] section more gracefully....
r477
mpm@selenic.com
rework all code using tags...
r343 l = repo.tagslist()
l.reverse()
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 = ""
Thomas Arendsen Hein
Handle errors in .hgtags or hgrc [tags] section more gracefully....
r477 for t, n in l:
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)
Brendan Cully
Add revlog.LookupError exception, and use it instead of RevlogError....
r3930 except revlog.LookupError:
r = " ?:%s" % hn
Thomas Arendsen Hein
Make 'hg tags -q' only list tag names without revision numbers and hashes,...
r2035 else:
Thomas Arendsen Hein
Don't truncate tag and branch names after 30 chars (introduced 73860ffbe798)...
r4143 spaces = " " * (30 - util.locallen(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
Patrick Mezard
Make tip help more helpful
r6364 The tip revision (usually just called the tip) is the most
recently added changeset in the repository, the most recently
changed head.
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.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
add __len__ and __iter__ methods to repo and revlog
r6750 cmdutil.show_changeset(ui, repo, opts).show(len(repo) - 1)
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.
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
lock = None
try:
lock = repo.lock()
for fname in fnames:
if os.path.exists(fname):
f = open(fname, "rb")
else:
f = urllib.urlopen(fname)
gen = changegroup.readbundle(f, fname)
modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
finally:
del lock
Giorgos Keramidas
unbundle: accept multiple file arguments...
r4699
Alexis S. L. Carvalho
pull -u: if "url#rev" was given, update to rev
r5224 return postincoming(ui, repo, modheads, opts['update'], None)
mpm@selenic.com
Add preliminary support for the bundle and unbundle commands
r1218
Daniel Holth
accept -r REV in more places...
r4450 def update(ui, repo, node=None, rev=None, clean=False, date=None):
Benoit Boissinot
various doc fixes...
r4014 """update working directory
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Adrian Buehlmann
update: improved help text...
r6673 Update the repository's working directory to the specified revision,
or the tip of the current branch if none is specified.
Matt Mackall
update: better logic and messages for updates...
r6375
If the requested revision is a descendant of the working
directory, any outstanding changes in the working directory will
be merged into the result. If it is not directly descended but is
on the same named branch, update aborts with a suggestion to use
merge or update -C instead.
If the requested revision is on a different named branch and the
working directory is clean, update quietly switches branches.
See 'hg help dates' for a list of formats valid for --date.
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
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
Remove update -m, deprecated for 0.9.1
r3521 if clean:
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
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")
% version.get_version())
ui.status(_(
Dirkjan Ochtman
update copyright notice in version output
r5994 "\nCopyright (C) 2005-2008 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', '',
_('repository root directory or symbolic path name')),
('', 'cwd', '', _('change working directory')),
('y', 'noninteractive', None,
_('do not prompt, assume \'yes\' for any required answers')),
('q', 'quiet', None, _('suppress output')),
('v', 'verbose', None, _('enable additional output')),
('', 'config', [], _('set/override config option')),
('', 'debug', None, _('enable debugging output')),
('', 'debugger', None, _('start debugger')),
Matt Mackall
Add global options for setting encoding and encodingmode
r3774 ('', 'encoding', util._encoding, _('set the charset encoding')),
('', 'encodingmode', util._encodingmode, _('set the charset encoding mode')),
Benoit Boissinot
factor opts: move globalopts to a more logical place...
r3187 ('', 'lsprof', None, _('print improved command execution profile')),
('', 'traceback', None, _('print traceback on exception')),
('', '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 = [
('e', 'ssh', '', _('specify ssh command to use')),
('', 'remotecmd', '', _('specify hg command to run on the remote side')),
]
Benoit Boissinot
factor opts: walk options
r3188 walkopts = [
('I', 'include', [], _('include names matching the given patterns')),
('X', 'exclude', [], _('exclude names matching the given patterns')),
]
Mathieu Clabaut
Uniformisation of commit help for -m and -l....
r3857 commitopts = [
('m', 'message', '', _('use <text> as commit message')),
('l', 'logfile', '', _('read commit message from <file>')),
]
Benoit Boissinot
refactor options from cmdtable...
r5147 commitopts2 = [
('d', 'date', '', _('record datecode as commit date')),
('u', 'user', '', _('record user as committer')),
]
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 templateopts = [
('', 'style', '', _('display using template map file')),
('', 'template', '', _('display with template')),
]
logopts = [
('p', 'patch', None, _('show patch')),
('l', 'limit', '', _('limit number of changes displayed')),
('M', 'no-merges', None, _('do not show merges')),
] + 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')),
('', 'nodates', None, _("don't include dates in diff headers"))
]
diffopts2 = [
('p', 'show-function', None, _('show which function each change is in')),
('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')),
('U', 'unified', '', _('number of lines of context to show'))
]
mpm@selenic.com
Beginning of new command parsing interface...
r209 table = {
Thomas Arendsen Hein
Fixed indentation, spacing and a typo (debugdata->debugdate) in commands.table.
r3824 "^add": (add, walkopts + dryrunopts, _('hg add [OPTION]... [FILE]...')),
Vadim Gelfer
addremove: do not deprecate....
r2955 "addremove":
Thomas Arendsen Hein
Realigned command table again.
r841 (addremove,
Benoit Boissinot
factor opts: walk options
r3188 [('s', 'similarity', '',
Benoit Boissinot
factor opts: --dry-run option
r3189 _('guess renamed files by similarity (0<=s<=100)')),
] + walkopts + dryrunopts,
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 _('hg addremove [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,
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 [('r', 'rev', '', _('annotate the specified revision')),
Brendan Cully
Refactor annotate copy support.
r3172 ('f', 'follow', None, _('follow file 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)')),
('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,
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857 _('hg annotate [-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')),
('p', 'prefix', '', _('directory prefix for files in archive')),
('r', 'rev', '', _('revision to distribute')),
('t', 'type', '', _('type of distribution to create')),
Benoit Boissinot
factor opts: walk options
r3188 ] + walkopts,
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112 _('hg archive [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')),
Vadim Gelfer
backout: allow backout of merge changeset with --parent option....
r2614 ('', 'parent', '', _('parent to choose when backing out merge')),
Daniel Holth
accept -r REV in more places...
r4450 ('r', 'rev', '', _('revision to backout')),
Benoit Boissinot
refactor options from cmdtable...
r5147 ] + walkopts + commitopts + commitopts2,
Daniel Holth
accept -r REV in more places...
r4450 _('hg backout [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')),
('U', 'noupdate', False, _('do not update to target'))],
_("hg bisect [-gbsr] [REV]")),
Thomas Arendsen Hein
Updated command tables in commands.py and hgext extensions....
r4730 "branch":
(branch,
[('f', 'force', None,
_('set branch name even if it shadows an existing branch'))],
Thomas Arendsen Hein
realign commands table
r5778 _('hg branch [-f] [NAME]')),
Thomas Arendsen Hein
Updated command tables in commands.py and hgext extensions....
r4730 "branches":
(branches,
[('a', 'active', False,
_('show only branches that have unmerged heads'))],
_('hg branches [-a]')),
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,
Benoit Boissinot
add remoteopts to bundle command
r3191 _('run even when remote repository is unrelated')),
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 ('r', 'rev', [],
Benoit Boissinot
Make clear that for a changegroup '-r' pulls "up to" a revision...
r6304 _('a changeset up to which you would like to bundle')),
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 ('', 'base', [],
_('a base changeset to specify instead of a destination')),
Benoit Allard
add compression type type parameter to bundle command
r6570 ('a', 'all', None, _('bundle all changesets in the repository')),
('t', 'type', 'bzip2', _('bundle compression type to use')),
Benoit Boissinot
add remoteopts to bundle command
r3191 ] + remoteopts,
John Mulligan
Add --all option to bundle command
r6171 _('hg bundle [-f] [-a] [-r REV]... [--base REV]... FILE [DEST]')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "cat":
(cat,
Thomas Arendsen Hein
Updated help synopsises and reordered some options. Dropped [-n] from revert.
r1816 [('o', 'output', '', _('print output to file with formatted name')),
('r', 'rev', '', _('print the given revision')),
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,
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 _('hg cat [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,
_('the clone will only contain a repository (no working copy)')),
Muli Ben-Yehuda
strictly adher to 80 chars per line
r1602 ('r', 'rev', [],
Vadim Gelfer
clone: replace long help string of inaky with doc comment.
r2764 _('a changeset you would like to have after cloning')),
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,
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 _('hg clone [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')),
Benoit Boissinot
refactor options from cmdtable...
r5147 ] + walkopts + commitopts + commitopts2,
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 _('hg commit [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,
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 _('hg copy [OPTION]... [SOURCE]... DEST')),
Bryan O'Sullivan
debugancestor: make the index argument optional, defaulting to 00changelog.i
r6178 "debugancestor": (debugancestor, [],
_('hg debugancestor [INDEX] REV1 REV2')),
Thomas Arendsen Hein
Sort commands table again and add some missing 'hg' in synopsises.
r5781 "debugcheckstate": (debugcheckstate, [], _('hg debugcheckstate')),
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'))],
Thomas Arendsen Hein
Sort commands table again and add some missing 'hg' in synopsises.
r5781 _('hg debugcomplete [-o] CMD')),
"debugdate":
(debugdate,
[('e', 'extended', None, _('try extended date formats'))],
_('hg debugdate [-e] DATE [RANGE]')),
"debugdata": (debugdata, [], _('hg debugdata FILE REV')),
"debugfsinfo": (debugfsinfo, [], _('hg debugfsinfo [PATH]')),
"debugindex": (debugindex, [], _('hg debugindex FILE')),
"debugindexdot": (debugindexdot, [], _('hg debugindexdot FILE')),
"debuginstall": (debuginstall, [], _('hg debuginstall')),
"debugrawcommit|rawcommit":
(rawcommit,
[('p', 'parent', [], _('parent')),
('F', 'files', '', _('file list'))
] + commitopts + commitopts2,
_('hg debugrawcommit [OPTION]... [FILE]...')),
Benoit Boissinot
add 'debugrebuildstate' to rebuild the dirstate from a given revision...
r1755 "debugrebuildstate":
(debugrebuildstate,
Thomas Arendsen Hein
Updated help synopsises and reordered some options. Dropped [-n] from revert.
r1816 [('r', 'rev', '', _('revision to rebuild to'))],
Thomas Arendsen Hein
Sort commands table again and add some missing 'hg' in synopsises.
r5781 _('hg debugrebuildstate [-r REV] [REV]')),
Thomas Arendsen Hein
Updated command tables in commands.py and hgext extensions....
r4730 "debugrename":
(debugrename,
[('r', 'rev', '', _('revision to debug'))],
Thomas Arendsen Hein
Sort commands table again and add some missing 'hg' in synopsises.
r5781 _('hg debugrename [-r REV] FILE')),
"debugsetparents":
(debugsetparents,
[],
_('hg debugsetparents REV1 [REV2]')),
Alexis S. L. Carvalho
debugstate: add --nodates...
r6296 "debugstate":
(debugstate,
[('', 'nodates', None, _('do not display the saved mtime'))],
_('hg debugstate [OPTS]')),
Thomas Arendsen Hein
Sort commands table again and add some missing 'hg' in synopsises.
r5781 "debugwalk": (debugwalk, walkopts, _('hg debugwalk [OPTION]... [FILE]...')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "^diff":
(diff,
Jason Orendorff
mq: qdiff: support all diffopts
r6668 [('r', 'rev', [], _('revision'))
] + diffopts + diffopts2 + walkopts,
Thomas Arendsen Hein
Corrected synopsis for many commands....
r3885 _('hg diff [OPTION]... [-r REV1 [-r REV2]] [FILE]...')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "^export":
(export,
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 [('o', 'output', '', _('print output to file with formatted name')),
Jason Orendorff
mq: qdiff: support all diffopts
r6668 ('', 'switch-parent', None, _('diff against the second parent'))
] + diffopts,
Thomas Arendsen Hein
Corrected synopsis for many commands....
r3885 _('hg export [OPTION]... [-o OUTFILESPEC] REV...')),
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,
_('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,
_('print only filenames and revs that match')),
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 ('n', 'line-number', None, _('print matching line numbers')),
('r', 'rev', [], _('search in given revision range')),
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,
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 _('hg grep [OPTION]... PATTERN [FILE]...')),
Thomas Arendsen Hein
Update online help of hg heads for new --branches option.
r905 "heads":
(heads,
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 [('r', 'rev', '', _('show only heads which are descendants of rev')),
] + templateopts,
Eric Hopper
Add option to heads to show only heads for current branch.
r4648 _('hg heads [-r REV] [REV]...')),
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 "help": (help_, [], _('hg help [COMMAND]')),
Matt Mackall
identify: accept a revision argument
r4665 "identify|id":
(identify,
Matt Mackall
identify: add support for output flags
r4666 [('r', 'rev', '', _('identify the specified rev')),
('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
identify: take a path to a remote repo...
r4671 _('hg identify [-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,
Thomas Arendsen Hein
Use string literal concatenation for optlist and import -p option
r2125 _('directory strip option for patch. This has the same\n'
'meaning as the corresponding patch option')),
Matt Mackall
Remove deprecated old-style branch support
r3876 ('b', 'base', '', _('base 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')),
Joel Rosdahl
Add --no-commit option to import command
r5936 ('', '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,
Jesse Glick
Permitting the import command to accept a --user option....
r5953 _('Use any branch information in patch (implied by --exact)'))] +
commitopts + commitopts2,
_('hg import [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,
Vadim Gelfer
add -f/--force to pull, incoming, outgoing, to work on unrelated repo....
r1959 _('run even when remote repository is unrelated')),
Vadim Gelfer
let commands that show changesets use templates....
r1907 ('n', 'newest-first', None, _('show newest record first')),
Benoit Boissinot
incoming: add support for remote repo using bundlerepo
r1944 ('', 'bundle', '', _('file to store the bundles into')),
Benoit Boissinot
Make clear that for a changegroup '-r' pulls "up to" a revision...
r6304 ('r', 'rev', [],
_('a specific revision up to which you would like to pull')),
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 ] + logopts + remoteopts,
Thomas Arendsen Hein
Corrected synopsis for many commands....
r3885 _('hg incoming [-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,
_('hg init [-e CMD] [--remotecmd CMD] [DEST]')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "locate":
(locate,
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 [('r', 'rev', '', _('search the repository as it stood at 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,
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 _('hg locate [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,
Brendan Cully
Make log --follow without a file list follow a single head....
r2782 _('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')),
Matt Mackall
Add --date support to log...
r3813 ('d', 'date', '', _('show revs matching date spec')),
Brendan Cully
Show copies in hg log....
r3197 ('C', 'copies', None, _('show copied files')),
TK Soh
help: log --keyword is case-insensitive
r4324 ('k', 'keyword', [], _('do case-insensitive search for a keyword')),
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 ('r', 'rev', [], _('show the specified revision or range')),
Matt Mackall
add log --removed
r3657 ('', 'removed', None, _('include revs where files were removed')),
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 ('m', 'only-merges', None, _('show only merges')),
Dustin Sallings
Option to log to only show changesets within a specified branch.
r6067 ('b', 'only-branch', [],
_('show only changesets within the given named branch')),
Brendan Cully
Test for log --prune.
r2901 ('P', 'prune', [], _('do not display revision or any of its ancestors')),
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 ] + logopts + walkopts,
Thomas Arendsen Hein
Updated help synopsises and reordered some options. Dropped [-n] from revert.
r1816 _('hg log [OPTION]... [FILE]')),
Thomas Arendsen Hein
realign commands table
r5778 "manifest":
(manifest,
[('r', 'rev', '', _('revision to display'))],
_('hg manifest [-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')),
('r', 'rev', '', _('revision to merge')),
],
_('hg merge [-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,
Vadim Gelfer
add -f/--force to pull, incoming, outgoing, to work on unrelated repo....
r1959 _('run even when remote repository is unrelated')),
Benoit Boissinot
Make clear that for a changegroup '-r' pulls "up to" a revision...
r6304 ('r', 'rev', [],
_('a specific revision up to which you would like to push')),
Vadim Gelfer
let commands that show changesets use templates....
r1907 ('n', 'newest-first', None, _('show newest record first')),
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 ] + logopts + remoteopts,
Thomas Arendsen Hein
Corrected synopsis for many commands....
r3885 _('hg outgoing [-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
Benoit Boissinot
add a -b/--branch option to 'hg parents'
r1724 "^parents":
(parents,
Matt Mackall
Remove deprecated old-style branch support
r3876 [('r', 'rev', '', _('show parents from the specified rev')),
Thomas Arendsen Hein
Introduce templateopts and logopts to reduce duplicate option definitions.
r6192 ] + templateopts,
Matt Mackall
Remove [-b] options from help syntax lines
r3504 _('hg parents [-r REV] [FILE]')),
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 "paths": (paths, [], _('hg 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,
Thomas Arendsen Hein
Documentation clarification for --update option to pull and unbundle
r3198 _('update to new tip 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', [],
_('a specific revision up to which you would like to pull')),
Benoit Boissinot
factor opts: remote repo access options
r3190 ] + remoteopts,
Thomas Arendsen Hein
Corrected synopsis for many commands....
r3885 _('hg pull [-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', [],
_('a specific revision up to which you would like to push')),
Benoit Boissinot
factor opts: remote repo access options
r3190 ] + remoteopts,
Thomas Arendsen Hein
Corrected synopsis for many commands....
r3885 _('hg push [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')),
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 "recover": (recover, [], _('hg recover')),
"^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,
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 _('hg remove [OPTION]... FILE...')),
"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,
Thomas Arendsen Hein
Reordered options for remove, fixed synopsis for rename.
r1869 _('hg rename [OPTION]... SOURCE... DEST')),
Matt Mackall
resolve: new command...
r6518 "resolve":
(resolve,
[('l', 'list', None, _('list state of files needing merge')),
('m', 'mark', None, _('mark files as resolved')),
('u', 'unmark', None, _('unmark files as resolved'))],
('hg resolve [OPTION] [FILES...]')),
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')),
Matt Mackall
Add --date support to update and revert...
r3814 ('d', 'date', '', _('tipmost revision matching date')),
Vadim Gelfer
revert: require --all to revert all files.
r2982 ('r', 'rev', '', _('revision to revert to')),
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,
Thomas Arendsen Hein
Corrected synopsis for many commands....
r3885 _('hg revert [OPTION]... [-r REV] [NAME]...')),
Vadim Gelfer
deprecate undo command, replace with rollback command.
r2227 "rollback": (rollback, [], _('hg rollback')),
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 "root": (root, [], _('hg root')),
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 "^serve":
(serve,
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 [('A', 'accesslog', '', _('name of access log file to write to')),
Vadim Gelfer
add --daemon option to serve command. for issue 45....
r1740 ('d', 'daemon', None, _('run server in background')),
Thomas Arendsen Hein
Added help string for --daemon-pipefds
r1742 ('', 'daemon-pipefds', '', _('used internally by daemon mode')),
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 ('E', 'errorlog', '', _('name of error log file to write to')),
Stephen Deasey
hgweb: clarify which address and port can/cannot be bound at startup (bug 769)...
r6262 ('p', 'port', 0, _('port to listen on (default: 8000)')),
('a', 'address', '', _('address to listen on (default: all interfaces)')),
Michele Cella
adding "prefix" option to "hg serve" (command line and [web] section)...
r5835 ('', 'prefix', '', _('prefix path to serve from (default: server root)')),
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 ('n', 'name', '',
Muli Ben-Yehuda
strictly adher to 80 chars per line
r1602 _('name to show in web pages (default: working dir)')),
Alexander Schremmer <alex AT alexanderweb DOT de>
Cleaned trailing whitespace in hgweb.py, removed command line shortcut for webdir-conf.
r2124 ('', 'webdir-conf', '', _('name of the webdir config file'
' (serve more than one repo)')),
Vadim Gelfer
add --daemon option to serve command. for issue 45....
r1740 ('', 'pid-file', '', _('name of file to write process ID to')),
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 ('', 'stdio', None, _('for remote clients')),
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 ('t', 'templates', '', _('web templates to use')),
('', 'style', '', _('template style to use')),
Brendan Cully
Add SSL support to hg serve, activated via --certificate option
r4860 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
('', 'certificate', '', _('SSL certificate file'))],
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 _('hg serve [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'))],
_('hg showconfig [-u] [NAME]...')),
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')),
Brendan Cully
Add --rev option to status
r3467 ('', 'rev', [], _('show difference from revision')),
Benoit Boissinot
factor opts: walk options
r3188 ] + walkopts,
Thomas Arendsen Hein
Cleanup of indentation, spacing, newlines, strings and line length
r1615 _('hg status [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')),
Matt Mackall
tags: add --remove
r4213 ('r', 'rev', '', _('revision to tag')),
Benoit Boissinot
refactor options from cmdtable...
r5147 ('', 'remove', None, _('remove a tag')),
# -l/--local is already there, commitopts cannot be used
('m', 'message', '', _('use <text> as commit message')),
] + commitopts2,
John Coomes
tag: allow multiple tags to be added or removed...
r6321 _('hg tag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')),
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 "tags": (tags, [], _('hg 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')),
] + templateopts,
Matt Mackall
Remove [-b] options from help syntax lines
r3504 _('hg tip [-p]')),
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,
Thomas Arendsen Hein
Documentation clarification for --update option to pull and unbundle
r3198 _('update to new tip if changesets were unbundled'))],
Giorgos Keramidas
unbundle: accept multiple file arguments...
r4699 _('hg unbundle [-u] FILE...')),
mpm@selenic.com
Shorten help...
r593 "^update|up|checkout|co":
Thomas Arendsen Hein
Multiple cleanups of things detected by pylint....
r697 (update,
Adrian Buehlmann
update: add "(nobackup)" to help text of option --clean
r6674 [('C', 'clean', None, _('overwrite locally modified files (no backup)')),
Daniel Holth
accept -r REV in more places...
r4450 ('d', 'date', '', _('tipmost revision matching date')),
('r', 'rev', '', _('revision'))],
_('hg update [-C] [-d DATE] [[-r] REV]')),
Benoit Boissinot
i18n part2: use '_' for all strings who are part of the user interface
r1402 "verify": (verify, [], _('hg verify')),
Matt Mackall
move show_version to version_
r3651 "version": (version_, [], _('hg version')),
Thomas Arendsen Hein
Sort global options by topic: directories, ui, timing, other...
r1046 }
mpm@selenic.com
Beginning of new command parsing interface...
r209
Thomas Arendsen Hein
Make hg debugancestor accept -R by making it an optionalrepo command.
r6189 norepo = ("clone init version help debugcomplete debugdata"
Matt Mackall
add debugfsinfo to check fs capabilities
r5741 " debugindex debugindexdot debugdate debuginstall debugfsinfo")
Thomas Arendsen Hein
Make hg debugancestor accept -R by making it an optionalrepo command.
r6189 optionalrepo = ("identify paths serve showconfig debugancestor")