2005-06-05 02:16:32 +04:00
|
|
|
# commands.py - command processing for mercurial
|
|
|
|
#
|
2007-06-19 10:51:34 +04:00
|
|
|
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
|
2005-06-05 02:16:32 +04:00
|
|
|
#
|
|
|
|
# This software may be used and distributed according to the terms
|
|
|
|
# of the GNU General Public License, incorporated herein by reference.
|
|
|
|
|
2005-08-28 01:55:07 +04:00
|
|
|
from node import *
|
2006-12-15 05:25:19 +03:00
|
|
|
from i18n import _
|
2007-08-01 03:28:05 +04:00
|
|
|
import os, re, sys, urllib
|
2007-08-16 01:55:13 +04:00
|
|
|
import hg, util, revlog, bundlerepo, extensions
|
2006-12-13 22:27:09 +03:00
|
|
|
import difflib, patch, time, help, mdiff, tempfile
|
2007-06-12 06:09:24 +04:00
|
|
|
import errno, version, socket
|
2008-01-01 03:20:34 +03:00
|
|
|
import archival, changegroup, cmdutil, hgweb.server, sshserver, hbisect
|
2005-06-01 12:25:42 +04:00
|
|
|
|
2005-06-05 07:09:00 +04:00
|
|
|
# Commands start here, listed alphabetically
|
2005-06-01 12:25:42 +04:00
|
|
|
|
2005-07-18 18:54:21 +04:00
|
|
|
def add(ui, repo, *pats, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""add the specified files on the next commit
|
|
|
|
|
|
|
|
Schedule files to be version controlled and added to the repository.
|
|
|
|
|
2006-12-08 23:55:45 +03:00
|
|
|
The files will be added to the repository at the next commit. To
|
|
|
|
undo an add before that, see hg revert.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2005-12-01 19:51:45 +03:00
|
|
|
If no names are given, add all files in the repository.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
|
|
|
|
2007-12-24 14:14:43 +03:00
|
|
|
rejected = None
|
|
|
|
exacts = {}
|
2005-07-18 18:54:21 +04:00
|
|
|
names = []
|
2007-12-24 14:14:43 +03:00
|
|
|
for src, abs, rel, exact in cmdutil.walk(repo, pats, opts,
|
|
|
|
badmatch=util.always):
|
2005-08-19 01:58:32 +04:00
|
|
|
if exact:
|
2006-01-12 09:57:58 +03:00
|
|
|
if ui.verbose:
|
|
|
|
ui.status(_('adding %s\n') % rel)
|
2005-07-18 18:54:21 +04:00
|
|
|
names.append(abs)
|
2007-12-24 14:14:43 +03:00
|
|
|
exacts[abs] = 1
|
2007-07-22 01:02:09 +04:00
|
|
|
elif abs not in repo.dirstate:
|
2005-10-19 05:38:39 +04:00
|
|
|
ui.status(_('adding %s\n') % rel)
|
2005-07-18 18:54:21 +04:00
|
|
|
names.append(abs)
|
2006-06-27 10:31:03 +04:00
|
|
|
if not opts.get('dry_run'):
|
2007-12-24 14:14:43 +03:00
|
|
|
rejected = repo.add(names)
|
|
|
|
rejected = [p for p in rejected if p in exacts]
|
|
|
|
return rejected and 1 or 0
|
2005-06-01 12:25:42 +04:00
|
|
|
|
2005-07-23 07:45:48 +04:00
|
|
|
def addremove(ui, repo, *pats, **opts):
|
2006-09-27 23:43:45 +04:00
|
|
|
"""add all new files, delete all missing files
|
2005-10-25 02:52:28 +04:00
|
|
|
|
|
|
|
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.
|
2006-08-19 09:13:58 +04:00
|
|
|
|
|
|
|
Use the -s option to detect renamed files. With a parameter > 0,
|
|
|
|
this compares every removed file with every added file and records
|
|
|
|
those similar enough as renames. This option takes a percentage
|
|
|
|
between 0 (disabled) and 100 (files must be identical) as its
|
|
|
|
parameter. Detecting renamed files this way can be expensive.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2007-07-22 06:07:18 +04:00
|
|
|
try:
|
|
|
|
sim = float(opts.get('similarity') or 0)
|
|
|
|
except ValueError:
|
|
|
|
raise util.Abort(_('similarity must be a number'))
|
2006-08-19 09:13:58 +04:00
|
|
|
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.)
|
2005-06-01 12:25:42 +04:00
|
|
|
|
2005-07-20 15:23:12 +04:00
|
|
|
def annotate(ui, repo, *pats, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""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.
|
|
|
|
"""
|
2007-07-08 21:59:02 +04:00
|
|
|
getdate = util.cachefunc(lambda x: util.datestr(x[0].date()))
|
2005-11-10 00:39:24 +03:00
|
|
|
|
2005-07-21 21:22:54 +04:00
|
|
|
if not pats:
|
2005-10-19 05:38:39 +04:00
|
|
|
raise util.Abort(_('at least one file name or pattern required'))
|
2005-07-21 21:22:54 +04:00
|
|
|
|
2007-07-08 21:59:02 +04:00
|
|
|
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()),
|
|
|
|
]
|
|
|
|
|
2006-09-27 20:10:21 +04:00
|
|
|
if (not opts['user'] and not opts['changeset'] and not opts['date']
|
|
|
|
and not opts['follow']):
|
2005-07-16 10:56:39 +04:00
|
|
|
opts['number'] = 1
|
2005-06-01 12:25:42 +04:00
|
|
|
|
2007-07-08 21:59:02 +04:00
|
|
|
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])
|
|
|
|
|
2006-09-16 02:23:52 +04:00
|
|
|
ctx = repo.changectx(opts['rev'])
|
2005-08-24 07:21:52 +04:00
|
|
|
|
2006-08-14 03:11:22 +04:00
|
|
|
for src, abs, rel, exact in cmdutil.walk(repo, pats, opts,
|
|
|
|
node=ctx.node()):
|
2006-06-29 02:42:17 +04:00
|
|
|
fctx = ctx.filectx(abs)
|
|
|
|
if not opts['text'] and util.binary(fctx.data()):
|
2006-01-17 18:10:22 +03:00
|
|
|
ui.write(_("%s: binary file\n") % ((pats and rel) or abs))
|
2005-08-24 07:21:52 +04:00
|
|
|
continue
|
|
|
|
|
2007-07-08 21:59:02 +04:00
|
|
|
lines = fctx.annotate(follow=opts.get('follow'),
|
|
|
|
linenumber=linenumber)
|
2005-06-01 12:25:42 +04:00
|
|
|
pieces = []
|
|
|
|
|
2007-07-08 21:59:02 +04:00
|
|
|
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])
|
2005-06-01 12:25:42 +04:00
|
|
|
|
2005-07-23 23:11:49 +04:00
|
|
|
if pieces:
|
|
|
|
for p, l in zip(zip(*pieces), lines):
|
|
|
|
ui.write("%s: %s" % (" ".join(p), l[1]))
|
2005-06-01 12:25:42 +04:00
|
|
|
|
2006-04-22 02:27:57 +04:00
|
|
|
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.
|
|
|
|
|
|
|
|
To specify the type of archive to create, use "-t". Valid
|
|
|
|
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
|
|
|
|
prepended. Use "-p" to specify a format string for the prefix.
|
|
|
|
The default is the basename of the archive, with suffixes removed.
|
|
|
|
'''
|
|
|
|
|
2007-07-10 21:06:24 +04:00
|
|
|
ctx = repo.changectx(opts['rev'])
|
|
|
|
if not ctx:
|
|
|
|
raise util.Abort(_('repository has no revisions'))
|
|
|
|
node = ctx.node()
|
2006-08-13 03:13:27 +04:00
|
|
|
dest = cmdutil.make_filename(repo, dest, node)
|
2006-04-22 02:27:57 +04:00
|
|
|
if os.path.realpath(dest) == repo.root:
|
|
|
|
raise util.Abort(_('repository root cannot be destination'))
|
2006-08-14 03:11:22 +04:00
|
|
|
dummy, matchfn, dummy = cmdutil.matchpats(repo, [], opts)
|
2006-06-22 02:15:06 +04:00
|
|
|
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'
|
2006-08-13 03:13:27 +04:00
|
|
|
prefix = cmdutil.make_filename(repo, prefix, node)
|
2006-06-22 02:15:06 +04:00
|
|
|
archival.archive(repo, dest, node, kind, not opts['no_decode'],
|
|
|
|
matchfn, prefix)
|
2006-04-22 02:27:57 +04:00
|
|
|
|
2007-05-17 21:55:24 +04:00
|
|
|
def backout(ui, repo, node=None, rev=None, **opts):
|
2006-04-30 07:56:46 +04:00
|
|
|
'''reverse effect of earlier changeset
|
|
|
|
|
2006-05-11 02:24:26 +04:00
|
|
|
Commit the backed out changes as a new changeset. The new
|
|
|
|
changeset is a child of the backed out changeset.
|
2006-04-30 07:56:46 +04:00
|
|
|
|
|
|
|
If you back out a changeset other than the tip, a new head is
|
2006-05-11 02:24:26 +04:00
|
|
|
created. This head is the parent of the working directory. If
|
|
|
|
you back out an old changeset, your working directory will appear
|
|
|
|
old after the backout. You should merge the backout changeset
|
|
|
|
with another head.
|
|
|
|
|
|
|
|
The --merge option remembers the parent of the working directory
|
|
|
|
before starting the backout, then merges the new head with that
|
|
|
|
changeset afterwards. This saves you from doing the merge by
|
|
|
|
hand. The result of this merge is not committed, as for a normal
|
|
|
|
merge.'''
|
2007-05-17 21:55:24 +04:00
|
|
|
if rev and node:
|
|
|
|
raise util.Abort(_("please specify just one revision"))
|
|
|
|
|
|
|
|
if not rev:
|
|
|
|
rev = node
|
2006-04-30 07:56:46 +04:00
|
|
|
|
2007-06-26 17:28:17 +04:00
|
|
|
if not rev:
|
|
|
|
raise util.Abort(_("please specify a revision to backout"))
|
|
|
|
|
2007-06-12 06:09:24 +04:00
|
|
|
cmdutil.bail_if_changed(repo)
|
2006-04-30 07:56:46 +04:00
|
|
|
node = repo.lookup(rev)
|
2007-12-01 22:09:27 +03:00
|
|
|
|
2007-12-28 08:55:39 +03:00
|
|
|
op1, op2 = repo.dirstate.parents()
|
2007-12-01 22:09:27 +03:00
|
|
|
a = repo.changelog.ancestor(op1, node)
|
|
|
|
if a != node:
|
|
|
|
raise util.Abort(_('cannot back out change on a different branch'))
|
|
|
|
|
2006-07-15 10:19:15 +04:00
|
|
|
p1, p2 = repo.changelog.parents(node)
|
|
|
|
if p1 == nullid:
|
2006-04-30 07:56:46 +04:00
|
|
|
raise util.Abort(_('cannot back out a change with no parents'))
|
|
|
|
if p2 != nullid:
|
2006-07-15 10:19:15 +04:00
|
|
|
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):
|
2006-11-18 22:20:38 +03:00
|
|
|
raise util.Abort(_('%s is not a parent of %s') %
|
2006-11-19 18:09:04 +03:00
|
|
|
(short(p), short(node)))
|
2006-07-15 10:19:15 +04:00
|
|
|
parent = p
|
|
|
|
else:
|
|
|
|
if opts['parent']:
|
|
|
|
raise util.Abort(_('cannot use --parent on non-merge changeset'))
|
|
|
|
parent = p1
|
2007-12-01 22:09:27 +03:00
|
|
|
|
2006-08-08 07:54:33 +04:00
|
|
|
hg.clean(repo, node, show_stats=False)
|
2006-04-30 07:56:46 +04:00
|
|
|
revert_opts = opts.copy()
|
2006-12-07 02:58:09 +03:00
|
|
|
revert_opts['date'] = None
|
2006-08-21 20:44:52 +04:00
|
|
|
revert_opts['all'] = True
|
2006-04-30 07:56:46 +04:00
|
|
|
revert_opts['rev'] = hex(parent)
|
|
|
|
revert(ui, repo, **revert_opts)
|
|
|
|
commit_opts = opts.copy()
|
|
|
|
commit_opts['addremove'] = False
|
2006-04-30 20:40:30 +04:00
|
|
|
if not commit_opts['message'] and not commit_opts['logfile']:
|
2007-06-25 21:44:48 +04:00
|
|
|
commit_opts['message'] = _("Backed out changeset %s") % (short(node))
|
2006-05-12 01:41:52 +04:00
|
|
|
commit_opts['force_editor'] = True
|
2006-04-30 07:56:46 +04:00
|
|
|
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)))
|
2006-06-24 04:33:10 +04:00
|
|
|
if op1 != node:
|
|
|
|
if opts['merge']:
|
|
|
|
ui.status(_('merging with changeset %s\n') % nice(op1))
|
2006-12-13 03:16:23 +03:00
|
|
|
hg.merge(repo, hex(op1))
|
2006-06-24 04:33:10 +04:00
|
|
|
else:
|
|
|
|
ui.status(_('the backout changeset is a new head - '
|
|
|
|
'do not forget to merge\n'))
|
2006-08-02 05:17:06 +04:00
|
|
|
ui.status(_('(use "backout --merge" '
|
|
|
|
'if you want to auto-merge)\n'))
|
2006-04-30 07:56:46 +04:00
|
|
|
|
2008-01-01 03:20:34 +03:00
|
|
|
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]:
|
|
|
|
f.write("%s %s\n" % (kind, hg.hex(node)))
|
|
|
|
f.rename()
|
|
|
|
finally:
|
|
|
|
del wlock
|
|
|
|
|
|
|
|
if not state['good'] or not state['bad']:
|
|
|
|
return
|
|
|
|
|
|
|
|
# actually bisect
|
2008-01-01 03:20:34 +03:00
|
|
|
node, changesets, good = hbisect.bisect(repo.changelog, state)
|
2008-01-01 03:20:34 +03:00
|
|
|
if changesets == 0:
|
2008-01-01 03:20:34 +03:00
|
|
|
ui.write(_("The first %s revision is:\n") % (good and "good" or "bad"))
|
2008-01-01 03:20:34 +03:00
|
|
|
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")
|
|
|
|
% (rev, hg.short(node), changesets, tests))
|
|
|
|
if not noupdate:
|
|
|
|
cmdutil.bail_if_changed(repo)
|
|
|
|
return hg.clean(repo, node)
|
|
|
|
|
2007-03-13 00:44:14 +03:00
|
|
|
def branch(ui, repo, label=None, **opts):
|
2006-10-25 01:49:36 +04:00
|
|
|
"""set or show the current branch name
|
|
|
|
|
2007-06-18 21:44:43 +04:00
|
|
|
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).
|
2007-03-13 00:44:14 +03:00
|
|
|
|
|
|
|
Unless --force is specified, branch will not let you set a
|
|
|
|
branch name that shadows an existing branch.
|
2006-10-25 01:49:36 +04:00
|
|
|
"""
|
|
|
|
|
2007-03-14 02:50:02 +03:00
|
|
|
if label:
|
2007-03-13 00:44:14 +03:00
|
|
|
if not opts.get('force') and label in repo.branchtags():
|
|
|
|
if label not in [p.branch() for p in repo.workingctx().parents()]:
|
|
|
|
raise util.Abort(_('a branch of the same name already exists'
|
|
|
|
' (use --force to override)'))
|
2007-03-14 02:50:02 +03:00
|
|
|
repo.dirstate.setbranch(util.fromlocal(label))
|
2007-06-18 21:44:43 +04:00
|
|
|
ui.status(_('marked working directory as branch %s\n') % label)
|
2006-10-25 01:49:36 +04:00
|
|
|
else:
|
2007-03-14 02:50:02 +03:00
|
|
|
ui.write("%s\n" % util.tolocal(repo.dirstate.branch()))
|
2006-10-25 01:49:36 +04:00
|
|
|
|
2007-06-21 21:40:09 +04:00
|
|
|
def branches(ui, repo, active=False):
|
2006-10-25 01:49:36 +04:00
|
|
|
"""list repository named branches
|
|
|
|
|
2007-06-21 21:40:09 +04:00
|
|
|
List the repository's named branches, indicating which ones are
|
|
|
|
inactive. If active is specified, only show active branches.
|
|
|
|
|
|
|
|
A branch is considered active if it contains unmerged heads.
|
2006-10-25 01:49:36 +04:00
|
|
|
"""
|
|
|
|
b = repo.branchtags()
|
2007-06-21 21:40:09 +04:00
|
|
|
heads = dict.fromkeys(repo.heads(), 1)
|
|
|
|
l = [((n in heads), repo.changelog.rev(n), n, t) for t, n in b.items()]
|
2006-10-25 01:49:36 +04:00
|
|
|
l.sort()
|
2007-06-21 21:40:09 +04:00
|
|
|
l.reverse()
|
|
|
|
for ishead, r, n, t in l:
|
|
|
|
if active and not ishead:
|
|
|
|
# If we're only displaying active branches, abort the loop on
|
|
|
|
# encountering the first inactive head
|
|
|
|
break
|
2006-10-25 01:49:36 +04:00
|
|
|
else:
|
2007-06-21 21:40:09 +04:00
|
|
|
hexfunc = ui.debugflag and hex or short
|
|
|
|
if ui.quiet:
|
|
|
|
ui.write("%s\n" % t)
|
|
|
|
else:
|
|
|
|
spaces = " " * (30 - util.locallen(t))
|
|
|
|
# The code only gets here if inactive branches are being
|
|
|
|
# displayed or the branch is active.
|
|
|
|
isinactive = ((not ishead) and " (inactive)") or ''
|
|
|
|
ui.write("%s%s %s:%s%s\n" % (t, spaces, r, hexfunc(n), isinactive))
|
2006-10-25 01:49:36 +04:00
|
|
|
|
2006-06-24 05:09:44 +04:00
|
|
|
def bundle(ui, repo, fname, dest=None, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""create a changegroup file
|
|
|
|
|
2006-10-25 19:20:39 +04:00
|
|
|
Generate a compressed changegroup file collecting changesets not
|
|
|
|
found in the other repository.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2006-10-25 19:20:39 +04:00
|
|
|
If no destination repository is specified the destination is assumed
|
|
|
|
to have all the nodes specified by one or more --base parameters.
|
2008-01-12 05:31:13 +03:00
|
|
|
To create a bundle containing all changesets, use --base null.
|
2006-07-20 21:25:11 +04:00
|
|
|
|
2006-10-25 19:20:39 +04:00
|
|
|
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.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2006-10-25 19:20:39 +04:00
|
|
|
Applying bundles preserves all changeset contents including
|
|
|
|
permissions, copy/rename information, and revision history.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2006-07-20 21:25:11 +04:00
|
|
|
revs = opts.get('rev') or None
|
|
|
|
if revs:
|
|
|
|
revs = [repo.lookup(rev) for rev in revs]
|
|
|
|
base = opts.get('base')
|
|
|
|
if base:
|
|
|
|
if dest:
|
|
|
|
raise util.Abort(_("--base is incompatible with specifiying "
|
|
|
|
"a destination"))
|
2006-10-09 17:44:20 +04:00
|
|
|
base = [repo.lookup(rev) for rev in base]
|
|
|
|
# create the right base
|
|
|
|
# XXX: nodesbetween / changegroup* should be "fixed" instead
|
2006-07-20 21:25:11 +04:00
|
|
|
o = []
|
2006-11-16 00:51:58 +03:00
|
|
|
has = {nullid: None}
|
2006-07-20 21:25:11 +04:00
|
|
|
for n in base:
|
2006-11-13 22:26:57 +03:00
|
|
|
has.update(repo.changelog.reachable(n))
|
2006-07-20 21:25:11 +04:00
|
|
|
if revs:
|
2006-10-09 17:44:20 +04:00
|
|
|
visit = list(revs)
|
2006-07-20 21:25:11 +04:00
|
|
|
else:
|
2006-10-09 17:44:20 +04:00
|
|
|
visit = repo.changelog.heads()
|
2006-11-13 22:26:57 +03:00
|
|
|
seen = {}
|
2006-10-09 17:44:20 +04:00
|
|
|
while visit:
|
|
|
|
n = visit.pop(0)
|
2006-11-13 22:26:57 +03:00
|
|
|
parents = [p for p in repo.changelog.parents(n) if p not in has]
|
2006-10-09 17:44:20 +04:00
|
|
|
if len(parents) == 0:
|
|
|
|
o.insert(0, n)
|
|
|
|
else:
|
2006-10-25 20:22:04 +04:00
|
|
|
for p in parents:
|
|
|
|
if p not in seen:
|
2006-11-13 22:26:57 +03:00
|
|
|
seen[p] = 1
|
2006-10-25 20:22:04 +04:00
|
|
|
visit.append(p)
|
2006-07-20 21:25:11 +04:00
|
|
|
else:
|
2007-06-12 06:09:24 +04:00
|
|
|
cmdutil.setremoteconfig(ui, opts)
|
2007-08-27 09:21:58 +04:00
|
|
|
dest, revs, checkout = hg.parseurl(
|
2007-06-02 03:40:14 +04:00
|
|
|
ui.expandpath(dest or 'default-push', dest or 'default'), revs)
|
2006-07-20 21:25:11 +04:00
|
|
|
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')
|
2006-11-23 00:08:00 +03:00
|
|
|
changegroup.writebundle(cg, fname, "HG10BZ")
|
2005-09-08 12:27:25 +04:00
|
|
|
|
2005-09-15 08:57:41 +04:00
|
|
|
def cat(ui, repo, file1, *pats, **opts):
|
2006-12-17 00:33:39 +03:00
|
|
|
"""output the current or given revision of files
|
2005-10-25 02:52:28 +04:00
|
|
|
|
|
|
|
Print the specified files as they were at the given revision.
|
2006-12-17 00:58:10 +03:00
|
|
|
If no revision is given, the parent of the working directory is used,
|
|
|
|
or tip if no revision is checked out.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
|
|
|
Output may be to a file, in which case the name of the file is
|
|
|
|
given using a format string. The formatting rules are the same as
|
|
|
|
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
|
|
|
|
"""
|
2006-09-16 02:23:52 +04:00
|
|
|
ctx = repo.changectx(opts['rev'])
|
2007-06-24 18:47:54 +04:00
|
|
|
err = 1
|
2006-08-14 03:11:22 +04:00
|
|
|
for src, abs, rel, exact in cmdutil.walk(repo, (file1,) + pats, opts,
|
|
|
|
ctx.node()):
|
2006-08-13 03:13:27 +04:00
|
|
|
fp = cmdutil.make_file(repo, opts['output'], ctx.node(), pathname=abs)
|
2006-06-29 02:11:42 +04:00
|
|
|
fp.write(ctx.filectx(abs).data())
|
2007-06-24 18:47:54 +04:00
|
|
|
err = 0
|
|
|
|
return err
|
2005-06-05 01:45:31 +04:00
|
|
|
|
2005-07-14 18:30:49 +04:00
|
|
|
def clone(ui, source, dest=None, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""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
|
2006-08-01 20:50:30 +04:00
|
|
|
and destination are on the same filesystem (note this applies only
|
|
|
|
to the repository data, not to the checked out files). Some
|
|
|
|
filesystems, such as AFS, implement hardlinking incorrectly, but
|
|
|
|
do not report errors. In these cases, use the --pull option to
|
|
|
|
avoid hardlinking.
|
|
|
|
|
|
|
|
You can safely clone repositories and checked out files using full
|
|
|
|
hardlinks with
|
|
|
|
|
|
|
|
$ cp -al REPO REPOCLONE
|
|
|
|
|
|
|
|
which is the fastest way to clone. However, 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).
|
2006-02-28 02:46:06 +03:00
|
|
|
|
2006-08-02 06:58:34 +04:00
|
|
|
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.
|
2006-02-28 02:46:06 +03:00
|
|
|
|
|
|
|
See pull for valid source format details.
|
2006-07-12 00:36:52 +04:00
|
|
|
|
|
|
|
It is possible to specify an ssh:// URL as the destination, but no
|
2006-10-29 17:09:01 +03:00
|
|
|
.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.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2007-06-12 06:09:24 +04:00
|
|
|
cmdutil.setremoteconfig(ui, opts)
|
2007-06-02 03:40:14 +04:00
|
|
|
hg.clone(ui, source, dest,
|
2006-07-12 03:18:53 +04:00
|
|
|
pull=opts['pull'],
|
2006-07-16 03:06:05 +04:00
|
|
|
stream=opts['uncompressed'],
|
2006-07-12 03:18:53 +04:00
|
|
|
rev=opts['rev'],
|
|
|
|
update=not opts['noupdate'])
|
2005-06-29 22:42:35 +04:00
|
|
|
|
2005-07-30 03:02:27 +04:00
|
|
|
def commit(ui, repo, *pats, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""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"
|
2006-03-24 16:53:23 +03:00
|
|
|
will be committed.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2007-12-05 14:40:01 +03:00
|
|
|
If no commit message is specified, the configured editor is started to
|
|
|
|
enter a message.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2007-08-01 03:28:05 +04:00
|
|
|
def commitfunc(ui, repo, files, message, match, opts):
|
|
|
|
return repo.commit(files, message, opts['user'], opts['date'], match,
|
|
|
|
force_editor=opts.get('force_editor'))
|
|
|
|
cmdutil.commit(ui, repo, commitfunc, pats, opts)
|
big heap of command clean-up work
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
big heap of command clean-up work
Migrate add, forget, remove, commit, diff, addremove, tip, log,
recover, and serve.
Fix up filterfiles, relfilter, and relpath to be a bit more bulletproof
Alphabetize functions and the command table
Make everything in commands.py relative-path aware
manifest hash: f0856031a7be4e49289677b467f29bcf24ebce4a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCof6gywK+sNU5EO8RAoW1AJsHu8vchPSjls7wVbvsq/UKlGhqtgCgtnnl
xSBxyf/TEVWjHIk3uTa8WSE=
=YPMl
-----END PGP SIGNATURE-----
2005-06-04 23:18:56 +04:00
|
|
|
|
2005-09-15 03:34:22 +04:00
|
|
|
def copy(ui, repo, *pats, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""mark files as copied for the next commit
|
|
|
|
|
|
|
|
Mark dest as having copies of source files. If dest is a
|
|
|
|
directory, copies are put in that directory. If dest is a file,
|
|
|
|
there can only be one source.
|
|
|
|
|
|
|
|
By default, this command copies the contents of files as they
|
|
|
|
stand in the working directory. If invoked with --after, the
|
|
|
|
operation is recorded, but no copying is performed.
|
|
|
|
|
2006-12-08 23:55:45 +03:00
|
|
|
This command takes effect in the next commit. To undo a copy
|
|
|
|
before that, see hg revert.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2007-07-22 01:02:09 +04:00
|
|
|
wlock = repo.wlock(False)
|
2007-07-22 01:02:10 +04:00
|
|
|
try:
|
2007-12-07 11:29:55 +03:00
|
|
|
return cmdutil.copy(ui, repo, pats, opts)
|
2007-07-22 01:02:10 +04:00
|
|
|
finally:
|
|
|
|
del wlock
|
2005-06-16 03:57:07 +04:00
|
|
|
|
2005-09-16 21:42:20 +04:00
|
|
|
def debugancestor(ui, index, rev1, rev2):
|
|
|
|
"""find the ancestor revision of two revisions in a given index"""
|
2007-03-23 03:52:38 +03:00
|
|
|
r = revlog.revlog(util.opener(os.getcwd(), audit=False), index)
|
2005-09-16 21:42:20 +04:00
|
|
|
a = r.ancestor(r.lookup(rev1), r.lookup(rev2))
|
|
|
|
ui.write("%d:%s\n" % (r.rev(a), hex(a)))
|
|
|
|
|
2006-04-02 00:50:12 +04:00
|
|
|
def debugcomplete(ui, cmd='', **opts):
|
2006-03-12 13:32:03 +03:00
|
|
|
"""returns the completion list associated with the given command"""
|
2006-04-02 00:50:12 +04:00
|
|
|
|
|
|
|
if opts['options']:
|
|
|
|
options = []
|
|
|
|
otables = [globalopts]
|
|
|
|
if cmd:
|
2007-08-16 01:55:13 +04:00
|
|
|
aliases, entry = cmdutil.findcmd(ui, cmd, table)
|
2006-04-02 00:50:12 +04:00
|
|
|
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
|
|
|
|
|
2007-08-16 01:55:13 +04:00
|
|
|
clist = cmdutil.findpossible(ui, cmd, table).keys()
|
2006-03-12 13:32:03 +03:00
|
|
|
clist.sort()
|
2006-04-02 00:50:12 +04:00
|
|
|
ui.write("%s\n" % "\n".join(clist))
|
2006-03-12 13:32:03 +03:00
|
|
|
|
2007-12-28 08:55:40 +03:00
|
|
|
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'))
|
|
|
|
ui.write('case-sensitive: %s\n' % (util.checkfolding('.debugfsinfo')
|
|
|
|
and 'yes' or 'no'))
|
|
|
|
os.unlink('.debugfsinfo')
|
|
|
|
|
2006-12-26 05:13:57 +03:00
|
|
|
def debugrebuildstate(ui, repo, rev=""):
|
2006-02-20 21:04:56 +03:00
|
|
|
"""rebuild the dirstate as it would look like for the given revision"""
|
2006-12-26 05:13:57 +03:00
|
|
|
if rev == "":
|
2006-02-20 21:04:56 +03:00
|
|
|
rev = repo.changelog.tip()
|
2006-12-26 05:13:57 +03:00
|
|
|
ctx = repo.changectx(rev)
|
|
|
|
files = ctx.manifest()
|
2006-02-21 02:45:02 +03:00
|
|
|
wlock = repo.wlock()
|
2007-07-22 01:02:10 +04:00
|
|
|
try:
|
|
|
|
repo.dirstate.rebuild(rev, files)
|
|
|
|
finally:
|
|
|
|
del wlock
|
2006-02-20 21:04:56 +03:00
|
|
|
|
2005-07-03 23:47:45 +04:00
|
|
|
def debugcheckstate(ui, repo):
|
|
|
|
"""validate the correctness of the current dirstate"""
|
2005-06-25 10:51:39 +04:00
|
|
|
parent1, parent2 = repo.dirstate.parents()
|
2006-12-26 05:13:57 +03:00
|
|
|
m1 = repo.changectx(parent1).manifest()
|
|
|
|
m2 = repo.changectx(parent2).manifest()
|
2005-06-25 10:51:39 +04:00
|
|
|
errors = 0
|
2007-07-22 01:02:09 +04:00
|
|
|
for f in repo.dirstate:
|
|
|
|
state = repo.dirstate[f]
|
2005-06-25 10:51:39 +04:00
|
|
|
if state in "nr" and f not in m1:
|
2005-10-19 05:38:39 +04:00
|
|
|
ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
|
2005-06-25 10:51:39 +04:00
|
|
|
errors += 1
|
|
|
|
if state in "a" and f in m1:
|
2005-10-19 05:38:39 +04:00
|
|
|
ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
|
2005-06-25 10:51:39 +04:00
|
|
|
errors += 1
|
|
|
|
if state in "m" and f not in m1 and f not in m2:
|
2005-10-19 05:38:39 +04:00
|
|
|
ui.warn(_("%s in state %s, but not in either manifest\n") %
|
2005-07-03 06:57:59 +04:00
|
|
|
(f, state))
|
2005-06-25 10:51:39 +04:00
|
|
|
errors += 1
|
|
|
|
for f in m1:
|
2007-07-22 01:02:09 +04:00
|
|
|
state = repo.dirstate[f]
|
2005-06-25 10:51:39 +04:00
|
|
|
if state not in "nrm":
|
2005-10-19 05:38:39 +04:00
|
|
|
ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
|
2005-06-25 10:51:39 +04:00
|
|
|
errors += 1
|
|
|
|
if errors:
|
2005-12-28 09:27:05 +03:00
|
|
|
error = _(".hg/dirstate inconsistent with current parent's manifest")
|
|
|
|
raise util.Abort(error)
|
2005-06-25 10:51:39 +04:00
|
|
|
|
2006-10-26 21:25:45 +04:00
|
|
|
def showconfig(ui, repo, *values, **opts):
|
2006-06-08 22:28:27 +04:00
|
|
|
"""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."""
|
|
|
|
|
2006-10-26 21:25:45 +04:00
|
|
|
untrusted = bool(opts.get('untrusted'))
|
2006-06-08 22:28:27 +04:00
|
|
|
if values:
|
|
|
|
if len([v for v in values if '.' in v]) > 1:
|
|
|
|
raise util.Abort(_('only one config item permitted'))
|
2006-10-26 21:25:45 +04:00
|
|
|
for section, name, value in ui.walkconfig(untrusted=untrusted):
|
2006-06-08 22:28:27 +04:00
|
|
|
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))
|
2005-08-24 08:30:12 +04:00
|
|
|
|
2005-10-18 11:43:33 +04:00
|
|
|
def debugsetparents(ui, repo, rev1, rev2=None):
|
2005-10-28 00:29:28 +04:00
|
|
|
"""manually set the parents of the current working directory
|
2005-10-18 11:43:33 +04:00
|
|
|
|
|
|
|
This is useful for writing repository conversion tools, but should
|
|
|
|
be used with care.
|
|
|
|
"""
|
|
|
|
|
|
|
|
if not rev2:
|
|
|
|
rev2 = hex(nullid)
|
|
|
|
|
2007-03-20 01:07:40 +03:00
|
|
|
wlock = repo.wlock()
|
|
|
|
try:
|
|
|
|
repo.dirstate.setparents(repo.lookup(rev1), repo.lookup(rev2))
|
|
|
|
finally:
|
2007-07-22 01:02:10 +04:00
|
|
|
del wlock
|
2005-10-18 11:43:33 +04:00
|
|
|
|
2005-07-03 23:47:45 +04:00
|
|
|
def debugstate(ui, repo):
|
|
|
|
"""show the contents of the current dirstate"""
|
2007-08-10 07:03:34 +04:00
|
|
|
k = repo.dirstate._map.items()
|
2007-07-22 01:02:09 +04:00
|
|
|
k.sort()
|
2007-08-10 07:03:34 +04:00
|
|
|
for file_, ent in k:
|
|
|
|
if ent[3] == -1:
|
2007-01-30 02:26:19 +03:00
|
|
|
# Pad or slice to locale representation
|
2008-01-12 00:30:56 +03:00
|
|
|
locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(0)))
|
2007-01-30 02:26:19 +03:00
|
|
|
timestr = 'unset'
|
|
|
|
timestr = timestr[:locale_len] + ' '*(locale_len - len(timestr))
|
|
|
|
else:
|
2008-01-12 00:30:56 +03:00
|
|
|
timestr = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(ent[3]))
|
2007-08-10 07:03:34 +04:00
|
|
|
if ent[1] & 020000:
|
|
|
|
mode = 'lnk'
|
|
|
|
else:
|
|
|
|
mode = '%3o' % (ent[1] & 0777)
|
|
|
|
ui.write("%c %s %10d %s %s\n" % (ent[0], mode, ent[2], timestr, file_))
|
2006-09-26 15:58:58 +04:00
|
|
|
for f in repo.dirstate.copies():
|
|
|
|
ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
|
2005-06-25 10:51:39 +04:00
|
|
|
|
2005-08-25 05:40:17 +04:00
|
|
|
def debugdata(ui, file_, rev):
|
2007-03-23 03:52:38 +03:00
|
|
|
"""dump the contents of a data file revision"""
|
|
|
|
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_[:-2] + ".i")
|
2005-09-22 20:42:15 +04:00
|
|
|
try:
|
|
|
|
ui.write(r.revision(r.lookup(rev)))
|
|
|
|
except KeyError:
|
2006-09-08 11:36:18 +04:00
|
|
|
raise util.Abort(_('invalid revision identifier %s') % rev)
|
2005-08-25 05:40:17 +04:00
|
|
|
|
2006-12-07 00:11:44 +03:00
|
|
|
def debugdate(ui, date, range=None, **opts):
|
2006-12-06 22:13:25 +03:00
|
|
|
"""parse and display a date"""
|
2006-12-07 00:11:44 +03:00
|
|
|
if opts["extended"]:
|
|
|
|
d = util.parsedate(date, util.extendeddateformats)
|
|
|
|
else:
|
|
|
|
d = util.parsedate(date)
|
2006-12-06 22:13:25 +03:00
|
|
|
ui.write("internal: %s %s\n" % d)
|
|
|
|
ui.write("standard: %s\n" % util.datestr(d))
|
2006-12-07 00:11:44 +03:00
|
|
|
if range:
|
|
|
|
m = util.matchdate(range)
|
|
|
|
ui.write("match: %s\n" % m(d[0]))
|
2006-12-06 22:13:25 +03:00
|
|
|
|
2005-07-14 13:42:28 +04:00
|
|
|
def debugindex(ui, file_):
|
2005-07-03 23:47:45 +04:00
|
|
|
"""dump the contents of an index file"""
|
2007-03-23 03:52:38 +03:00
|
|
|
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
|
2005-07-03 06:57:59 +04:00
|
|
|
ui.write(" rev offset length base linkrev" +
|
2005-08-22 03:51:50 +04:00
|
|
|
" nodeid p1 p2\n")
|
2006-10-19 16:03:41 +04:00
|
|
|
for i in xrange(r.count()):
|
2006-04-05 00:38:43 +04:00
|
|
|
node = r.node(i)
|
2007-09-22 02:13:38 +04:00
|
|
|
try:
|
|
|
|
pp = r.parents(node)
|
|
|
|
except:
|
|
|
|
pp = [nullid, nullid]
|
2005-08-22 03:51:50 +04:00
|
|
|
ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
|
2006-04-05 00:38:43 +04:00
|
|
|
i, r.start(i), r.length(i), r.base(i), r.linkrev(node),
|
|
|
|
short(node), short(pp[0]), short(pp[1])))
|
2005-06-05 01:45:31 +04:00
|
|
|
|
2005-07-14 13:42:28 +04:00
|
|
|
def debugindexdot(ui, file_):
|
2005-07-03 23:47:45 +04:00
|
|
|
"""dump an index DAG as a .dot file"""
|
2007-03-23 03:52:38 +03:00
|
|
|
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
|
2005-07-03 06:57:59 +04:00
|
|
|
ui.write("digraph G {\n")
|
2006-10-19 16:03:41 +04:00
|
|
|
for i in xrange(r.count()):
|
2006-05-15 19:53:32 +04:00
|
|
|
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))
|
2005-07-03 06:57:59 +04:00
|
|
|
ui.write("}\n")
|
2005-06-05 01:45:31 +04:00
|
|
|
|
2006-12-10 09:05:47 +03:00
|
|
|
def debuginstall(ui):
|
|
|
|
'''test Mercurial installation'''
|
|
|
|
|
2006-12-10 09:44:52 +03:00
|
|
|
def writetemp(contents):
|
2007-07-07 22:52:31 +04:00
|
|
|
(fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
|
2006-12-10 09:44:52 +03:00
|
|
|
f = os.fdopen(fd, "wb")
|
|
|
|
f.write(contents)
|
|
|
|
f.close()
|
|
|
|
return name
|
|
|
|
|
2006-12-10 09:05:47 +03:00
|
|
|
problems = 0
|
|
|
|
|
|
|
|
# encoding
|
|
|
|
ui.status(_("Checking encoding (%s)...\n") % util._encoding)
|
|
|
|
try:
|
|
|
|
util.fromlocal("test")
|
|
|
|
except util.Abort, inst:
|
|
|
|
ui.write(" %s\n" % inst)
|
2006-12-10 10:05:00 +03:00
|
|
|
ui.write(_(" (check that your locale is properly set)\n"))
|
2006-12-10 09:05:47 +03:00
|
|
|
problems += 1
|
|
|
|
|
|
|
|
# compiled modules
|
|
|
|
ui.status(_("Checking extensions...\n"))
|
|
|
|
try:
|
|
|
|
import bdiff, mpatch, base85
|
|
|
|
except Exception, inst:
|
|
|
|
ui.write(" %s\n" % inst)
|
2006-12-10 10:05:00 +03:00
|
|
|
ui.write(_(" One or more extensions could not be found"))
|
|
|
|
ui.write(_(" (check that you compiled the extensions)\n"))
|
2006-12-10 09:05:47 +03:00
|
|
|
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)
|
2006-12-10 10:05:00 +03:00
|
|
|
ui.write(_(" (templates seem to have been installed incorrectly)\n"))
|
2006-12-10 09:05:47 +03:00
|
|
|
problems += 1
|
|
|
|
|
|
|
|
# patch
|
|
|
|
ui.status(_("Checking patch...\n"))
|
2007-09-15 18:07:05 +04:00
|
|
|
patchproblems = 0
|
|
|
|
a = "1\n2\n3\n4\n"
|
|
|
|
b = "1\n2\n3\ninsert\n4\n"
|
|
|
|
fa = writetemp(a)
|
2007-11-01 22:17:59 +03:00
|
|
|
d = mdiff.unidiff(a, None, b, None, os.path.basename(fa),
|
|
|
|
os.path.basename(fa))
|
2007-09-15 18:07:05 +04:00
|
|
|
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
|
2006-12-10 09:44:52 +03:00
|
|
|
else:
|
2007-09-15 18:07:05 +04:00
|
|
|
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"))
|
2007-06-06 22:22:52 +04:00
|
|
|
else:
|
2007-12-29 21:49:48 +03:00
|
|
|
ui.write(_(" Internal patcher failure, please report this error"
|
2007-09-15 18:07:05 +04:00
|
|
|
" to http://www.selenic.com/mercurial/bts\n"))
|
|
|
|
problems += patchproblems
|
|
|
|
|
|
|
|
os.unlink(fa)
|
|
|
|
os.unlink(fd)
|
2006-12-10 09:05:47 +03:00
|
|
|
|
|
|
|
# merge helper
|
|
|
|
ui.status(_("Checking merge helper...\n"))
|
|
|
|
cmd = (os.environ.get("HGMERGE") or ui.config("ui", "merge")
|
|
|
|
or "hgmerge")
|
2007-05-28 01:26:54 +04:00
|
|
|
cmdpath = util.find_exe(cmd) or util.find_exe(cmd.split()[0])
|
2006-12-10 09:05:47 +03:00
|
|
|
if not cmdpath:
|
|
|
|
if cmd == 'hgmerge':
|
|
|
|
ui.write(_(" No merge helper set and can't find default"
|
|
|
|
" hgmerge script in PATH\n"))
|
2006-12-10 10:05:00 +03:00
|
|
|
ui.write(_(" (specify a merge helper in your .hgrc file)\n"))
|
2006-12-10 09:05:47 +03:00
|
|
|
else:
|
|
|
|
ui.write(_(" Can't find merge helper '%s' in PATH\n") % cmd)
|
2006-12-10 10:05:00 +03:00
|
|
|
ui.write(_(" (specify a merge helper in your .hgrc file)\n"))
|
2006-12-10 09:05:47 +03:00
|
|
|
problems += 1
|
2006-12-10 09:44:52 +03:00
|
|
|
else:
|
|
|
|
# actually attempt a patch here
|
|
|
|
fa = writetemp("1\n2\n3\n4\n")
|
|
|
|
fl = writetemp("1\n2\n3\ninsert\n4\n")
|
|
|
|
fr = writetemp("begin\n1\n2\n3\n4\n")
|
2007-07-04 11:20:56 +04:00
|
|
|
r = util.system('%s "%s" "%s" "%s"' % (cmd, fl, fa, fr))
|
2006-12-10 09:44:52 +03:00
|
|
|
if r:
|
2007-07-04 11:20:56 +04:00
|
|
|
ui.write(_(" Got unexpected merge error %d!\n") % r)
|
2006-12-10 09:44:52 +03:00
|
|
|
problems += 1
|
|
|
|
m = file(fl).read()
|
|
|
|
if m != "begin\n1\n2\n3\ninsert\n4\n":
|
2007-07-04 11:20:56 +04:00
|
|
|
ui.write(_(" Got unexpected merge results!\n"))
|
2006-12-10 10:05:00 +03:00
|
|
|
ui.write(_(" (your merge helper may have the"
|
|
|
|
" wrong argument order)\n"))
|
2007-07-04 11:20:56 +04:00
|
|
|
ui.write(_(" Result: %r\n") % m)
|
|
|
|
problems += 1
|
2006-12-10 09:44:52 +03:00
|
|
|
os.unlink(fa)
|
|
|
|
os.unlink(fl)
|
|
|
|
os.unlink(fr)
|
2006-12-10 09:05:47 +03:00
|
|
|
|
|
|
|
# editor
|
|
|
|
ui.status(_("Checking commit editor...\n"))
|
2007-12-05 14:40:01 +03:00
|
|
|
editor = ui.geteditor()
|
2007-05-28 01:26:54 +04:00
|
|
|
cmdpath = util.find_exe(editor) or util.find_exe(editor.split()[0])
|
2006-12-10 09:05:47 +03:00
|
|
|
if not cmdpath:
|
2006-12-10 14:46:47 +03:00
|
|
|
if editor == 'vi':
|
2006-12-10 09:05:47 +03:00
|
|
|
ui.write(_(" No commit editor set and can't find vi in PATH\n"))
|
2006-12-10 10:05:00 +03:00
|
|
|
ui.write(_(" (specify a commit editor in your .hgrc file)\n"))
|
2006-12-10 09:05:47 +03:00
|
|
|
else:
|
|
|
|
ui.write(_(" Can't find editor '%s' in PATH\n") % editor)
|
2006-12-10 10:05:00 +03:00
|
|
|
ui.write(_(" (specify a commit editor in your .hgrc file)\n"))
|
2006-12-10 09:05:47 +03:00
|
|
|
problems += 1
|
|
|
|
|
2006-12-10 10:05:00 +03:00
|
|
|
# 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"))
|
|
|
|
|
2006-12-10 09:05:47 +03:00
|
|
|
if not problems:
|
|
|
|
ui.status(_("No problems detected\n"))
|
|
|
|
else:
|
|
|
|
ui.write(_("%s problems detected,"
|
|
|
|
" please check your install!\n") % problems)
|
|
|
|
|
|
|
|
return problems
|
|
|
|
|
2006-11-16 00:51:58 +03:00
|
|
|
def debugrename(ui, repo, file1, *pats, **opts):
|
2005-09-01 23:13:56 +04:00
|
|
|
"""dump rename information"""
|
2006-11-16 00:51:58 +03:00
|
|
|
|
|
|
|
ctx = repo.changectx(opts.get('rev', 'tip'))
|
|
|
|
for src, abs, rel, exact in cmdutil.walk(repo, (file1,) + pats, opts,
|
|
|
|
ctx.node()):
|
2007-12-29 17:11:48 +03:00
|
|
|
fctx = ctx.filectx(abs)
|
|
|
|
m = fctx.filelog().renamed(fctx.filenode())
|
2006-11-16 00:51:58 +03:00
|
|
|
if m:
|
|
|
|
ui.write(_("%s renamed from %s:%s\n") % (rel, m[0], hex(m[1])))
|
|
|
|
else:
|
|
|
|
ui.write(_("%s not renamed\n") % rel)
|
2005-08-28 07:58:53 +04:00
|
|
|
|
Clean up walk and changes code to use normalised names properly.
New function: commands.pathto returns the relative path from one path
to another. For example, given foo/bar and baz/quux, it will return
../../baz/quux. This new function is used by the walk and status code
to print relative paths correctly.
New command: debugwalk exercises the walk code without doing anything
more.
hg.dirstate.walk now yields normalised names. For example, if you're
in the baz directory and you ask it to walk ../foo/bar/.., it will yield
names starting with foo/.
As a result of this change, all of the other walk and changes methods
in this module also return normalised names.
The util.matcher function now normalises globs and path names, so that
it will match normalised names properly.
Finally, util.matcher uses the non-glob prefix of a glob to tell walk
which directories to scan. Perviously, a glob like foo/* would scan
everything, but only return matches for foo/*. Now, foo/* only scans
under foo (using the globprefix function), which is much faster.
2005-08-01 05:42:46 +04:00
|
|
|
def debugwalk(ui, repo, *pats, **opts):
|
2005-08-26 12:01:55 +04:00
|
|
|
"""show how files match on given patterns"""
|
2006-08-14 03:11:22 +04:00
|
|
|
items = list(cmdutil.walk(repo, pats, opts))
|
2005-08-26 17:19:18 +04:00
|
|
|
if not items:
|
|
|
|
return
|
2005-09-21 10:07:38 +04:00
|
|
|
fmt = '%%s %%-%ds %%-%ds %%s' % (
|
2005-08-19 01:58:32 +04:00
|
|
|
max([len(abs) for (src, abs, rel, exact) in items]),
|
|
|
|
max([len(rel) for (src, abs, rel, exact) in items]))
|
|
|
|
for src, abs, rel, exact in items:
|
2005-09-21 10:07:38 +04:00
|
|
|
line = fmt % (src, abs, rel, exact and 'exact' or '')
|
|
|
|
ui.write("%s\n" % line.rstrip())
|
Clean up walk and changes code to use normalised names properly.
New function: commands.pathto returns the relative path from one path
to another. For example, given foo/bar and baz/quux, it will return
../../baz/quux. This new function is used by the walk and status code
to print relative paths correctly.
New command: debugwalk exercises the walk code without doing anything
more.
hg.dirstate.walk now yields normalised names. For example, if you're
in the baz directory and you ask it to walk ../foo/bar/.., it will yield
names starting with foo/.
As a result of this change, all of the other walk and changes methods
in this module also return normalised names.
The util.matcher function now normalises globs and path names, so that
it will match normalised names properly.
Finally, util.matcher uses the non-glob prefix of a glob to tell walk
which directories to scan. Perviously, a glob like foo/* would scan
everything, but only return matches for foo/*. Now, foo/* only scans
under foo (using the globprefix function), which is much faster.
2005-08-01 05:42:46 +04:00
|
|
|
|
2005-07-20 15:16:20 +04:00
|
|
|
def diff(ui, repo, *pats, **opts):
|
2005-12-01 19:51:45 +03:00
|
|
|
"""diff repository (or selected files)
|
2005-10-25 02:52:28 +04:00
|
|
|
|
|
|
|
Show differences between revisions for the specified files.
|
|
|
|
|
|
|
|
Differences between files are shown using the unified diff format.
|
|
|
|
|
2006-12-08 22:04:10 +03:00
|
|
|
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.
|
|
|
|
|
2005-10-25 02:52:28 +04:00
|
|
|
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.
|
|
|
|
"""
|
2006-11-23 01:02:28 +03:00
|
|
|
node1, node2 = cmdutil.revpair(repo, opts['rev'])
|
big heap of command clean-up work
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
big heap of command clean-up work
Migrate add, forget, remove, commit, diff, addremove, tip, log,
recover, and serve.
Fix up filterfiles, relfilter, and relpath to be a bit more bulletproof
Alphabetize functions and the command table
Make everything in commands.py relative-path aware
manifest hash: f0856031a7be4e49289677b467f29bcf24ebce4a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCof6gywK+sNU5EO8RAoW1AJsHu8vchPSjls7wVbvsq/UKlGhqtgCgtnnl
xSBxyf/TEVWjHIk3uTa8WSE=
=YPMl
-----END PGP SIGNATURE-----
2005-06-04 23:18:56 +04:00
|
|
|
|
2006-08-14 03:11:22 +04:00
|
|
|
fns, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
|
2005-08-24 05:58:26 +04:00
|
|
|
|
2006-08-13 03:13:27 +04:00
|
|
|
patch.diff(repo, node1, node2, fns, match=matchfn,
|
2006-08-15 20:34:08 +04:00
|
|
|
opts=patch.diffopts(ui, opts))
|
2005-07-03 06:29:54 +04:00
|
|
|
|
|
|
|
def export(ui, repo, *changesets, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""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,
|
2006-12-08 22:04:10 +03:00
|
|
|
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.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
|
|
|
Output may be to a file, in which case the name of the file is
|
|
|
|
given using a format string. The formatting rules are as follows:
|
|
|
|
|
|
|
|
%% literal "%" character
|
|
|
|
%H changeset hash (40 bytes of hexadecimal)
|
|
|
|
%N number of patches being generated
|
|
|
|
%R changeset revision number
|
|
|
|
%b basename of the exporting repository
|
|
|
|
%h short-form changeset hash (12 bytes of hexadecimal)
|
|
|
|
%n zero-padded sequence number, starting at 1
|
|
|
|
%r zero-padded changeset revision number
|
|
|
|
|
|
|
|
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.
|
2005-12-15 06:01:57 +03:00
|
|
|
|
|
|
|
With the --switch-parent option, the diff will be against the second
|
|
|
|
parent. It can be useful to review a merge.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2005-07-04 23:06:01 +04:00
|
|
|
if not changesets:
|
2005-10-19 05:38:39 +04:00
|
|
|
raise util.Abort(_("export requires at least one changeset"))
|
2006-11-23 01:02:28 +03:00
|
|
|
revs = cmdutil.revrange(repo, changesets)
|
2006-08-13 03:13:27 +04:00
|
|
|
if len(revs) > 1:
|
|
|
|
ui.note(_('exporting patches:\n'))
|
|
|
|
else:
|
|
|
|
ui.note(_('exporting patch:\n'))
|
2006-12-15 21:30:20 +03:00
|
|
|
patch.export(repo, revs, template=opts['output'],
|
2006-08-15 20:34:08 +04:00
|
|
|
switch_parent=opts['switch_parent'],
|
|
|
|
opts=patch.diffopts(ui, opts))
|
2005-06-05 00:14:14 +04:00
|
|
|
|
2005-08-28 01:36:25 +04:00
|
|
|
def grep(ui, repo, pattern, *pats, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""search for a pattern in specified files and revisions
|
|
|
|
|
|
|
|
Search revisions of files for a regular expression.
|
|
|
|
|
|
|
|
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
|
|
|
|
a match appears.
|
|
|
|
|
|
|
|
By default, grep only prints output for the first revision of a
|
|
|
|
file in which it finds a match. To get it to print every revision
|
|
|
|
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.
|
|
|
|
"""
|
2005-08-25 13:00:03 +04:00
|
|
|
reflags = 0
|
2005-08-26 17:19:18 +04:00
|
|
|
if opts['ignore_case']:
|
|
|
|
reflags |= re.I
|
2007-07-09 18:41:14 +04:00
|
|
|
try:
|
|
|
|
regexp = re.compile(pattern, reflags)
|
|
|
|
except Exception, inst:
|
|
|
|
ui.warn(_("grep: invalid match pattern: %s!\n") % inst)
|
|
|
|
return None
|
2005-08-29 21:05:49 +04:00
|
|
|
sep, eol = ':', '\n'
|
2005-08-28 01:36:25 +04:00
|
|
|
if opts['print0']:
|
2005-08-29 21:05:49 +04:00
|
|
|
sep = eol = '\0'
|
2005-08-25 13:00:03 +04:00
|
|
|
|
|
|
|
fcache = {}
|
|
|
|
def getfile(fn):
|
|
|
|
if fn not in fcache:
|
|
|
|
fcache[fn] = repo.file(fn)
|
|
|
|
return fcache[fn]
|
|
|
|
|
|
|
|
def matchlines(body):
|
2005-08-26 04:13:48 +04:00
|
|
|
begin = 0
|
|
|
|
linenum = 0
|
|
|
|
while True:
|
|
|
|
match = regexp.search(body, begin)
|
2005-08-26 17:19:18 +04:00
|
|
|
if not match:
|
|
|
|
break
|
2005-08-26 04:13:48 +04:00
|
|
|
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
|
2005-08-25 13:00:03 +04:00
|
|
|
|
2005-11-19 09:48:47 +03:00
|
|
|
class linestate(object):
|
2005-08-25 13:00:03 +04:00
|
|
|
def __init__(self, line, linenum, colstart, colend):
|
|
|
|
self.line = line
|
|
|
|
self.linenum = linenum
|
|
|
|
self.colstart = colstart
|
|
|
|
self.colend = colend
|
2006-08-13 00:51:14 +04:00
|
|
|
|
2005-08-26 17:19:18 +04:00
|
|
|
def __eq__(self, other):
|
|
|
|
return self.line == other.line
|
2005-08-25 13:00:03 +04:00
|
|
|
|
|
|
|
matches = {}
|
2006-08-13 02:01:46 +04:00
|
|
|
copies = {}
|
2005-08-25 13:00:03 +04:00
|
|
|
def grepbody(fn, rev, body):
|
2006-08-13 00:51:14 +04:00
|
|
|
matches[rev].setdefault(fn, [])
|
2005-08-25 13:00:03 +04:00
|
|
|
m = matches[rev][fn]
|
|
|
|
for lnum, cstart, cend, line in matchlines(body):
|
|
|
|
s = linestate(line, lnum, cstart, cend)
|
2006-08-13 00:51:14 +04:00
|
|
|
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':
|
2006-10-19 16:03:41 +04:00
|
|
|
for i in xrange(blo, bhi):
|
2006-08-13 00:51:14 +04:00
|
|
|
yield ('+', b[i])
|
|
|
|
elif tag == 'delete':
|
2006-10-19 16:03:41 +04:00
|
|
|
for i in xrange(alo, ahi):
|
2006-08-13 00:51:14 +04:00
|
|
|
yield ('-', a[i])
|
|
|
|
elif tag == 'replace':
|
2006-10-19 16:03:41 +04:00
|
|
|
for i in xrange(alo, ahi):
|
2006-08-13 00:51:14 +04:00
|
|
|
yield ('-', a[i])
|
2006-10-19 16:03:41 +04:00
|
|
|
for i in xrange(blo, bhi):
|
2006-08-13 00:51:14 +04:00
|
|
|
yield ('+', b[i])
|
2005-08-25 13:00:03 +04:00
|
|
|
|
|
|
|
prev = {}
|
|
|
|
def display(fn, rev, states, prevstates):
|
2006-12-23 00:51:39 +03:00
|
|
|
found = False
|
2005-08-29 21:05:49 +04:00
|
|
|
filerevmatches = {}
|
2006-12-23 00:51:39 +03:00
|
|
|
r = prev.get(fn, -1)
|
|
|
|
if opts['all']:
|
|
|
|
iter = difflinestates(states, prevstates)
|
2006-08-13 00:51:14 +04:00
|
|
|
else:
|
2006-12-23 00:51:39 +03:00
|
|
|
iter = [('', l) for l in prevstates]
|
|
|
|
for change, l in iter:
|
2006-08-13 00:51:14 +04:00
|
|
|
cols = [fn, str(r)]
|
2006-01-12 09:57:58 +03:00
|
|
|
if opts['line_number']:
|
|
|
|
cols.append(str(l.linenum))
|
|
|
|
if opts['all']:
|
|
|
|
cols.append(change)
|
|
|
|
if opts['user']:
|
2006-11-16 00:51:58 +03:00
|
|
|
cols.append(ui.shortuser(get(r)[1]))
|
2005-08-29 21:05:49 +04:00
|
|
|
if opts['files_with_matches']:
|
2006-10-26 23:04:58 +04:00
|
|
|
c = (fn, r)
|
2006-01-12 09:57:58 +03:00
|
|
|
if c in filerevmatches:
|
|
|
|
continue
|
2005-08-29 21:05:49 +04:00
|
|
|
filerevmatches[c] = 1
|
|
|
|
else:
|
|
|
|
cols.append(l.line)
|
|
|
|
ui.write(sep.join(cols), eol)
|
2006-12-23 00:51:39 +03:00
|
|
|
found = True
|
|
|
|
return found
|
2005-08-25 13:00:03 +04:00
|
|
|
|
|
|
|
fstate = {}
|
2005-08-29 19:24:06 +04:00
|
|
|
skip = {}
|
2006-11-17 10:06:54 +03:00
|
|
|
get = util.cachefunc(lambda r: repo.changectx(r).changeset())
|
2006-11-16 00:51:58 +03:00
|
|
|
changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
|
2006-12-23 00:51:39 +03:00
|
|
|
found = False
|
2006-08-13 02:01:46 +04:00
|
|
|
follow = opts.get('follow')
|
2005-08-29 21:05:49 +04:00
|
|
|
for st, rev, fns in changeiter:
|
2005-08-25 13:00:03 +04:00
|
|
|
if st == 'window':
|
|
|
|
matches.clear()
|
|
|
|
elif st == 'add':
|
2006-10-27 08:59:21 +04:00
|
|
|
mf = repo.changectx(rev).manifest()
|
2005-08-25 13:00:03 +04:00
|
|
|
matches[rev] = {}
|
|
|
|
for fn in fns:
|
2006-01-12 09:57:58 +03:00
|
|
|
if fn in skip:
|
|
|
|
continue
|
2005-08-25 13:00:03 +04:00
|
|
|
try:
|
|
|
|
grepbody(fn, rev, getfile(fn).read(mf[fn]))
|
2007-08-15 18:09:04 +04:00
|
|
|
fstate.setdefault(fn, [])
|
2006-08-13 02:01:46 +04:00
|
|
|
if follow:
|
|
|
|
copied = getfile(fn).renamed(mf[fn])
|
|
|
|
if copied:
|
2006-08-18 21:05:44 +04:00
|
|
|
copies.setdefault(rev, {})[fn] = copied[0]
|
2005-08-25 13:00:03 +04:00
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
elif st == 'iter':
|
|
|
|
states = matches[rev].items()
|
|
|
|
states.sort()
|
|
|
|
for fn, m in states:
|
2006-08-18 21:05:44 +04:00
|
|
|
copy = copies.get(rev, {}).get(fn)
|
2006-01-12 09:57:58 +03:00
|
|
|
if fn in skip:
|
2006-08-13 02:01:46 +04:00
|
|
|
if copy:
|
|
|
|
skip[copy] = True
|
2006-01-12 09:57:58 +03:00
|
|
|
continue
|
2006-12-23 00:51:39 +03:00
|
|
|
if fn in prev or fstate[fn]:
|
|
|
|
r = display(fn, rev, m, fstate[fn])
|
|
|
|
found = found or r
|
|
|
|
if r and not opts['all']:
|
2005-08-29 19:24:06 +04:00
|
|
|
skip[fn] = True
|
2006-08-13 02:01:46 +04:00
|
|
|
if copy:
|
|
|
|
skip[copy] = True
|
2005-08-25 13:00:03 +04:00
|
|
|
fstate[fn] = m
|
2006-08-13 02:01:46 +04:00
|
|
|
if copy:
|
|
|
|
fstate[copy] = m
|
2005-08-25 13:00:03 +04:00
|
|
|
prev[fn] = rev
|
|
|
|
|
2006-12-23 00:16:05 +03:00
|
|
|
fstate = fstate.items()
|
|
|
|
fstate.sort()
|
|
|
|
for fn, state in fstate:
|
|
|
|
if fn in skip:
|
|
|
|
continue
|
|
|
|
if fn not in copies.get(prev[fn], {}):
|
2006-12-23 00:51:39 +03:00
|
|
|
found = display(fn, rev, {}, state) or found
|
|
|
|
return (not found and 1) or 0
|
2005-08-25 13:00:03 +04:00
|
|
|
|
2007-06-19 19:37:43 +04:00
|
|
|
def heads(ui, repo, *branchrevs, **opts):
|
|
|
|
"""show current repository heads or show branch heads
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2007-06-19 19:37:43 +04:00
|
|
|
With no arguments, show all repository head changesets.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2007-06-19 19:37:43 +04:00
|
|
|
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
|
2005-10-25 02:52:28 +04:00
|
|
|
changesets. They are where development generally takes place and
|
|
|
|
are the usual targets for update and merge operations.
|
2007-06-19 19:37:43 +04:00
|
|
|
|
|
|
|
Branch heads are changesets that have a given branch tag, but have
|
|
|
|
no child changesets with that tag. They are usually where
|
|
|
|
development on the given branch takes place.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2005-11-16 14:08:25 +03:00
|
|
|
if opts['rev']:
|
2007-06-19 19:37:43 +04:00
|
|
|
start = repo.lookup(opts['rev'])
|
2005-11-16 14:08:25 +03:00
|
|
|
else:
|
2007-06-19 19:37:43 +04:00
|
|
|
start = None
|
|
|
|
if not branchrevs:
|
|
|
|
# Assume we're looking repo-wide heads if no revs were specified.
|
|
|
|
heads = repo.heads(start)
|
|
|
|
else:
|
|
|
|
heads = []
|
2007-06-21 04:53:11 +04:00
|
|
|
visitedset = util.set()
|
2007-06-19 19:37:43 +04:00
|
|
|
for branchrev in branchrevs:
|
|
|
|
branch = repo.changectx(branchrev).branch()
|
|
|
|
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
|
2006-11-13 22:26:57 +03:00
|
|
|
displayer = cmdutil.show_changeset(ui, repo, opts)
|
2005-11-16 14:08:25 +03:00
|
|
|
for n in heads:
|
2006-11-16 00:51:58 +03:00
|
|
|
displayer.show(changenode=n)
|
2005-06-03 06:07:01 +04:00
|
|
|
|
2006-11-16 00:51:58 +03:00
|
|
|
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 = []
|
|
|
|
|
2007-04-07 11:27:55 +04:00
|
|
|
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, ()))
|
|
|
|
|
2006-11-16 00:51:58 +03:00
|
|
|
def helpcmd(name):
|
|
|
|
if with_version:
|
|
|
|
version_(ui)
|
|
|
|
ui.write('\n')
|
2007-08-16 01:55:13 +04:00
|
|
|
aliases, i = cmdutil.findcmd(ui, name, table)
|
2006-11-16 00:51:58 +03:00
|
|
|
# synopsis
|
2008-01-02 22:22:10 +03:00
|
|
|
ui.write("%s\n" % i[2])
|
|
|
|
|
|
|
|
# aliases
|
|
|
|
if not ui.quiet and len(aliases) > 1:
|
|
|
|
ui.write(_("\naliases: %s\n") % ', '.join(aliases[1:]))
|
2006-11-16 00:51:58 +03:00
|
|
|
|
|
|
|
# description
|
|
|
|
doc = i[0].__doc__
|
|
|
|
if not doc:
|
|
|
|
doc = _("(No help text available)")
|
|
|
|
if ui.quiet:
|
|
|
|
doc = doc.splitlines(0)[0]
|
2008-01-02 22:22:10 +03:00
|
|
|
ui.write("\n%s\n" % doc.rstrip())
|
2006-11-16 00:51:58 +03:00
|
|
|
|
|
|
|
if not ui.quiet:
|
|
|
|
# options
|
|
|
|
if i[1]:
|
2007-04-07 11:27:55 +04:00
|
|
|
option_lists.append((_("options:\n"), i[1]))
|
|
|
|
|
|
|
|
addglobalopts(False)
|
2006-11-16 00:51:58 +03:00
|
|
|
|
2007-07-20 02:43:25 +04:00
|
|
|
def helplist(header, select=None):
|
2006-11-16 00:51:58 +03:00
|
|
|
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("^")
|
|
|
|
|
2007-07-20 02:43:25 +04:00
|
|
|
if not h:
|
|
|
|
ui.status(_('no commands defined\n'))
|
|
|
|
return
|
|
|
|
|
|
|
|
ui.status(header)
|
2006-11-16 00:51:58 +03:00
|
|
|
fns = h.keys()
|
|
|
|
fns.sort()
|
|
|
|
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]))
|
|
|
|
|
2007-04-07 11:27:55 +04:00
|
|
|
if not ui.quiet:
|
|
|
|
addglobalopts(True)
|
|
|
|
|
2006-12-06 01:06:13 +03:00
|
|
|
def helptopic(name):
|
|
|
|
v = None
|
|
|
|
for i in help.helptable:
|
|
|
|
l = i.split('|')
|
|
|
|
if name in l:
|
|
|
|
v = i
|
|
|
|
header = l[-1]
|
|
|
|
if not v:
|
2007-06-12 06:09:24 +04:00
|
|
|
raise cmdutil.UnknownCommand(name)
|
2006-12-06 01:06:13 +03:00
|
|
|
|
|
|
|
# description
|
|
|
|
doc = help.helptable[v]
|
|
|
|
if not doc:
|
|
|
|
doc = _("(No help text available)")
|
2006-12-06 01:28:56 +03:00
|
|
|
if callable(doc):
|
|
|
|
doc = doc()
|
2006-12-06 01:06:13 +03:00
|
|
|
|
|
|
|
ui.write("%s\n" % header)
|
|
|
|
ui.write("%s\n" % doc.rstrip())
|
|
|
|
|
2006-11-16 00:51:58 +03:00
|
|
|
def helpext(name):
|
|
|
|
try:
|
2007-06-12 06:09:23 +04:00
|
|
|
mod = extensions.find(name)
|
2006-11-16 00:51:58 +03:00
|
|
|
except KeyError:
|
2007-06-12 06:09:24 +04:00
|
|
|
raise cmdutil.UnknownCommand(name)
|
2006-11-16 00:51:58 +03:00
|
|
|
|
|
|
|
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')
|
2006-12-26 23:59:01 +03:00
|
|
|
|
|
|
|
try:
|
|
|
|
ct = mod.cmdtable
|
|
|
|
except AttributeError:
|
2007-07-20 02:43:25 +04:00
|
|
|
ct = {}
|
2006-12-26 23:59:01 +03:00
|
|
|
|
|
|
|
modcmds = dict.fromkeys([c.split('|', 1)[0] for c in ct])
|
2007-07-20 02:43:25 +04:00
|
|
|
helplist(_('list of commands:\n\n'), modcmds.has_key)
|
2006-11-16 00:51:58 +03:00
|
|
|
|
|
|
|
if name and name != 'shortlist':
|
2006-12-06 01:06:13 +03:00
|
|
|
i = None
|
|
|
|
for f in (helpcmd, helptopic, helpext):
|
|
|
|
try:
|
|
|
|
f(name)
|
|
|
|
i = None
|
|
|
|
break
|
2007-06-12 06:09:24 +04:00
|
|
|
except cmdutil.UnknownCommand, inst:
|
2006-12-06 01:06:13 +03:00
|
|
|
i = inst
|
|
|
|
if i:
|
|
|
|
raise i
|
2006-11-16 00:51:58 +03:00
|
|
|
|
|
|
|
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":
|
2007-07-20 02:43:25 +04:00
|
|
|
header = _('basic commands:\n\n')
|
2006-11-16 00:51:58 +03:00
|
|
|
else:
|
2007-07-20 02:43:25 +04:00
|
|
|
header = _('list of commands:\n\n')
|
2006-11-16 00:51:58 +03:00
|
|
|
|
2007-07-20 02:43:25 +04:00
|
|
|
helplist(header)
|
2006-11-16 00:51:58 +03:00
|
|
|
|
|
|
|
# list all option lists
|
|
|
|
opt_output = []
|
|
|
|
for title, options in option_lists:
|
2007-04-07 11:27:55 +04:00
|
|
|
opt_output.append(("\n%s" % title, None))
|
2006-11-16 00:51:58 +03:00
|
|
|
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 "")))
|
|
|
|
|
|
|
|
if opt_output:
|
2007-04-07 11:27:55 +04:00
|
|
|
opts_len = max([len(line[0]) for line in opt_output if line[1]] or [0])
|
2006-11-16 00:51:58 +03:00
|
|
|
for first, second in opt_output:
|
|
|
|
if second:
|
|
|
|
ui.write(" %-*s %s\n" % (opts_len, first, second))
|
|
|
|
else:
|
|
|
|
ui.write("%s\n" % first)
|
|
|
|
|
2007-06-21 22:09:01 +04:00
|
|
|
def identify(ui, repo, source=None,
|
|
|
|
rev=None, num=None, id=None, branch=None, tags=None):
|
2007-06-21 20:54:11 +04:00
|
|
|
"""identify the working copy or specified revision
|
2005-10-28 00:29:28 +04:00
|
|
|
|
2007-06-21 22:09:01 +04:00
|
|
|
With no revision, print a summary of the current state of the repo.
|
|
|
|
|
|
|
|
With a path, do a lookup in another repository.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
|
|
|
This summary identifies the repository state using one or two parent
|
|
|
|
hash identifiers, followed by a "+" if there are uncommitted changes
|
2007-06-21 20:54:11 +04:00
|
|
|
in the working directory, a list of tags for this revision and a branch
|
|
|
|
name for non-default branches.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2007-06-21 20:42:39 +04:00
|
|
|
|
2007-09-25 02:00:11 +04:00
|
|
|
if not repo and not source:
|
|
|
|
raise util.Abort(_("There is no Mercurial repository here "
|
|
|
|
"(.hg not found)"))
|
|
|
|
|
2006-08-21 07:51:56 +04:00
|
|
|
hexfunc = ui.debugflag and hex or short
|
2007-06-21 20:54:13 +04:00
|
|
|
default = not (num or id or branch or tags)
|
|
|
|
output = []
|
2005-06-17 13:19:43 +04:00
|
|
|
|
2007-06-21 22:09:01 +04:00
|
|
|
if source:
|
2007-08-27 09:21:58 +04:00
|
|
|
source, revs, checkout = hg.parseurl(ui.expandpath(source), [])
|
2007-06-21 22:09:01 +04:00
|
|
|
srepo = hg.repository(ui, source)
|
|
|
|
if not rev and revs:
|
|
|
|
rev = revs[0]
|
2007-06-21 20:54:16 +04:00
|
|
|
if not rev:
|
|
|
|
rev = "tip"
|
|
|
|
if num or branch or tags:
|
|
|
|
raise util.Abort(
|
|
|
|
"can't query remote revision number, branch, or tags")
|
2007-06-21 22:09:01 +04:00
|
|
|
output = [hexfunc(srepo.lookup(rev))]
|
2007-06-21 20:54:16 +04:00
|
|
|
elif not rev:
|
2007-06-21 20:54:11 +04:00
|
|
|
ctx = repo.workingctx()
|
|
|
|
parents = ctx.parents()
|
2007-06-21 20:54:13 +04:00
|
|
|
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 ""))
|
2007-06-21 20:54:11 +04:00
|
|
|
else:
|
|
|
|
ctx = repo.changectx(rev)
|
2007-06-21 20:54:13 +04:00
|
|
|
if default or id:
|
|
|
|
output = [hexfunc(ctx.node())]
|
|
|
|
if num:
|
|
|
|
output.append(str(ctx.rev()))
|
2007-06-21 20:42:39 +04:00
|
|
|
|
2007-06-21 22:09:01 +04:00
|
|
|
if not source and default and not ui.quiet:
|
2007-06-21 20:54:13 +04:00
|
|
|
b = util.tolocal(ctx.branch())
|
|
|
|
if b != 'default':
|
|
|
|
output.append("(%s)" % b)
|
2006-10-18 03:30:19 +04:00
|
|
|
|
2005-06-17 13:19:43 +04:00
|
|
|
# multiple tags for a single parent separated by '/'
|
2007-06-21 20:54:13 +04:00
|
|
|
t = "/".join(ctx.tags())
|
|
|
|
if t:
|
|
|
|
output.append(t)
|
|
|
|
|
|
|
|
if branch:
|
|
|
|
output.append(util.tolocal(ctx.branch()))
|
|
|
|
|
|
|
|
if tags:
|
|
|
|
output.extend(ctx.tags())
|
2005-06-15 09:44:43 +04:00
|
|
|
|
2005-06-17 13:19:43 +04:00
|
|
|
ui.write("%s\n" % ' '.join(output))
|
2005-06-15 09:44:43 +04:00
|
|
|
|
2005-06-23 10:31:25 +04:00
|
|
|
def import_(ui, repo, patch1, *patches, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""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.
|
|
|
|
|
2006-06-27 11:09:13 +04:00
|
|
|
You can import a patch straight from a mail message. Even patches
|
|
|
|
as attachments work (body part must be type text/plain or
|
2006-06-27 20:41:05 +04:00
|
|
|
text/x-patch to be used). From and Subject headers of email
|
|
|
|
message are used as default committer and commit message. All
|
|
|
|
text/plain body parts before first diff are added to commit
|
|
|
|
message.
|
2006-06-27 11:09:13 +04:00
|
|
|
|
2007-03-22 20:44:59 +03:00
|
|
|
If the imported patch was generated by hg export, user and description
|
2006-06-27 11:09:13 +04:00
|
|
|
from patch override values from message headers and body. Values
|
|
|
|
given on command line with -m and -u override these.
|
2006-06-05 03:47:46 +04:00
|
|
|
|
2007-03-22 20:44:59 +03:00
|
|
|
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.
|
|
|
|
|
2006-06-05 03:47:46 +04:00
|
|
|
To read a patch from standard input, use patch name "-".
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2005-06-23 10:31:25 +04:00
|
|
|
patches = (patch1,) + patches
|
2005-06-28 12:59:59 +04:00
|
|
|
|
2007-03-22 20:44:59 +03:00
|
|
|
if opts.get('exact') or not opts['force']:
|
2007-06-12 06:09:24 +04:00
|
|
|
cmdutil.bail_if_changed(repo)
|
2005-08-20 11:07:31 +04:00
|
|
|
|
2005-06-23 10:31:25 +04:00
|
|
|
d = opts["base"]
|
|
|
|
strip = opts["strip"]
|
2007-07-22 01:02:10 +04:00
|
|
|
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)
|
|
|
|
else:
|
|
|
|
ui.status(_("applying %s\n") % p)
|
2007-08-21 00:02:05 +04:00
|
|
|
if os.path.exists(pf):
|
|
|
|
data = patch.extract(ui, file(pf, 'rb'))
|
|
|
|
else:
|
|
|
|
data = patch.extract(ui, urllib.urlopen(pf))
|
2007-07-22 01:02:10 +04:00
|
|
|
tmpname, message, user, date, branch, nodeid, p1, p2 = data
|
2006-06-27 11:09:13 +04:00
|
|
|
|
2007-07-22 01:02:10 +04:00
|
|
|
if tmpname is None:
|
|
|
|
raise util.Abort(_('no diffs found'))
|
2006-06-27 11:09:13 +04:00
|
|
|
|
2006-10-18 21:37:34 +04:00
|
|
|
try:
|
2007-07-22 01:02:10 +04:00
|
|
|
cmdline_message = cmdutil.logmessage(opts)
|
|
|
|
if cmdline_message:
|
|
|
|
# pickup the cmdline msg
|
|
|
|
message = cmdline_message
|
|
|
|
elif message:
|
|
|
|
# pickup the patch msg
|
|
|
|
message = message.strip()
|
|
|
|
else:
|
|
|
|
# launch the editor
|
|
|
|
message = None
|
|
|
|
ui.debug(_('message:\n%s\n') % message)
|
|
|
|
|
|
|
|
wp = repo.workingctx().parents()
|
|
|
|
if opts.get('exact'):
|
|
|
|
if not nodeid or not p1:
|
|
|
|
raise util.Abort(_('not a mercurial patch'))
|
|
|
|
p1 = repo.lookup(p1)
|
|
|
|
p2 = repo.lookup(p2 or hex(nullid))
|
|
|
|
|
|
|
|
if p1 != wp[0].node():
|
2007-07-22 01:02:10 +04:00
|
|
|
hg.clean(repo, p1)
|
2007-07-22 01:02:10 +04:00
|
|
|
repo.dirstate.setparents(p1, p2)
|
|
|
|
elif p2:
|
|
|
|
try:
|
|
|
|
p1 = repo.lookup(p1)
|
|
|
|
p2 = repo.lookup(p2)
|
|
|
|
if p1 == wp[0].node():
|
|
|
|
repo.dirstate.setparents(p1, p2)
|
|
|
|
except hg.RepoError:
|
|
|
|
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:
|
2007-07-22 01:02:10 +04:00
|
|
|
files = patch.updatedir(ui, repo, files)
|
2008-01-25 15:48:35 +03:00
|
|
|
if not opts.get('no_commit'):
|
2008-01-26 03:49:15 +03:00
|
|
|
n = repo.commit(files, message, opts.get('user') or user,
|
|
|
|
opts.get('date') or date)
|
2008-01-25 15:48:35 +03:00
|
|
|
if opts.get('exact'):
|
|
|
|
if hex(n) != nodeid:
|
|
|
|
repo.rollback()
|
|
|
|
raise util.Abort(_('patch is damaged'
|
|
|
|
' or loses information'))
|
2006-10-18 21:37:34 +04:00
|
|
|
finally:
|
2007-07-22 01:02:10 +04:00
|
|
|
os.unlink(tmpname)
|
|
|
|
finally:
|
2007-08-02 08:56:08 +04:00
|
|
|
del lock, wlock
|
2005-06-23 10:31:25 +04:00
|
|
|
|
2005-09-01 20:11:25 +04:00
|
|
|
def incoming(ui, repo, source="default", **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""show new changesets found in source
|
|
|
|
|
2006-03-20 19:14:58 +03:00
|
|
|
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
|
2005-10-25 02:52:28 +04:00
|
|
|
was requested.
|
|
|
|
|
2006-03-13 05:54:23 +03:00
|
|
|
For remote repository, using --bundle avoids downloading the changesets
|
|
|
|
twice if the incoming is followed by a pull.
|
2006-03-20 19:14:58 +03:00
|
|
|
|
|
|
|
See pull for valid source format details.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2007-08-27 09:21:58 +04:00
|
|
|
source, revs, checkout = hg.parseurl(ui.expandpath(source), opts['rev'])
|
2007-06-12 06:09:24 +04:00
|
|
|
cmdutil.setremoteconfig(ui, opts)
|
2006-03-16 08:58:15 +03:00
|
|
|
|
2005-08-17 07:17:16 +04:00
|
|
|
other = hg.repository(ui, source)
|
2007-11-05 22:29:32 +03:00
|
|
|
ui.status(_('comparing with %s\n') % util.hidepassword(source))
|
2007-06-02 03:40:14 +04:00
|
|
|
if revs:
|
2007-08-28 01:48:08 +04:00
|
|
|
revs = [other.lookup(rev) for rev in revs]
|
2007-06-01 21:45:05 +04:00
|
|
|
incoming = repo.findincoming(other, heads=revs, force=opts["force"])
|
2006-03-13 05:54:23 +03:00
|
|
|
if not incoming:
|
2006-12-20 01:37:45 +03:00
|
|
|
try:
|
|
|
|
os.unlink(opts["bundle"])
|
|
|
|
except:
|
|
|
|
pass
|
2006-03-24 10:34:56 +03:00
|
|
|
ui.status(_("no changes found\n"))
|
2006-12-19 17:58:56 +03:00
|
|
|
return 1
|
2006-03-13 05:54:23 +03:00
|
|
|
|
|
|
|
cleanup = None
|
2006-03-18 16:36:45 +03:00
|
|
|
try:
|
|
|
|
fname = opts["bundle"]
|
|
|
|
if fname or not other.local():
|
|
|
|
# create a bundle (uncompressed if other repo is not local)
|
2007-06-01 21:45:05 +04:00
|
|
|
if revs is None:
|
|
|
|
cg = other.changegroup(incoming, "incoming")
|
|
|
|
else:
|
|
|
|
cg = other.changegroupsubset(incoming, revs, 'incoming')
|
2006-11-23 00:33:57 +03:00
|
|
|
bundletype = other.local() and "HG10BZ" or "HG10UN"
|
|
|
|
fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
|
2006-03-18 16:36:45 +03:00
|
|
|
# keep written bundle?
|
|
|
|
if opts["bundle"]:
|
|
|
|
cleanup = None
|
|
|
|
if not other.local():
|
|
|
|
# use the created uncompressed bundlerepo
|
|
|
|
other = bundlerepo.bundlerepository(ui, repo.root, fname)
|
|
|
|
|
2006-06-30 18:16:35 +04:00
|
|
|
o = other.changelog.nodesbetween(incoming, revs)[0]
|
2006-03-18 16:36:45 +03:00
|
|
|
if opts['newest_first']:
|
|
|
|
o.reverse()
|
2006-11-13 22:26:57 +03:00
|
|
|
displayer = cmdutil.show_changeset(ui, other, opts)
|
2006-03-18 16:36:45 +03:00
|
|
|
for n in o:
|
|
|
|
parents = [p for p in other.changelog.parents(n) if p != nullid]
|
|
|
|
if opts['no_merges'] and len(parents) == 2:
|
|
|
|
continue
|
|
|
|
displayer.show(changenode=n)
|
|
|
|
finally:
|
|
|
|
if hasattr(other, 'close'):
|
|
|
|
other.close()
|
|
|
|
if cleanup:
|
|
|
|
os.unlink(cleanup)
|
2006-03-13 05:54:23 +03:00
|
|
|
|
2006-07-12 10:57:18 +04:00
|
|
|
def init(ui, dest=".", **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""create a new repository in the given directory
|
|
|
|
|
|
|
|
Initialize a new repository in the given directory. If the given
|
|
|
|
directory does not exist, it is created.
|
|
|
|
|
|
|
|
If no directory is given, the current directory is used.
|
2006-07-12 00:36:52 +04:00
|
|
|
|
|
|
|
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.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2007-06-12 06:09:24 +04:00
|
|
|
cmdutil.setremoteconfig(ui, opts)
|
2005-08-15 09:33:09 +04:00
|
|
|
hg.repository(ui, dest, create=1)
|
2005-06-15 06:37:53 +04:00
|
|
|
|
2005-07-06 06:19:01 +04:00
|
|
|
def locate(ui, repo, *pats, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""locate files matching specific patterns
|
|
|
|
|
|
|
|
Print all files under Mercurial control whose names match the
|
|
|
|
given patterns.
|
|
|
|
|
2007-03-11 05:00:57 +03:00
|
|
|
This command searches the entire repository by default. To search
|
2007-06-24 07:25:11 +04:00
|
|
|
just the current directory and its subdirectories, use
|
|
|
|
"--include .".
|
2005-10-25 02:52:28 +04:00
|
|
|
|
|
|
|
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.
|
|
|
|
"""
|
2005-08-26 17:19:18 +04:00
|
|
|
end = opts['print0'] and '\0' or '\n'
|
2006-01-16 17:51:09 +03:00
|
|
|
rev = opts['rev']
|
|
|
|
if rev:
|
|
|
|
node = repo.lookup(rev)
|
|
|
|
else:
|
|
|
|
node = None
|
2005-07-21 21:21:33 +04:00
|
|
|
|
2007-03-11 05:00:58 +03:00
|
|
|
ret = 1
|
2006-08-14 03:11:22 +04:00
|
|
|
for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, node=node,
|
2007-04-04 11:22:06 +04:00
|
|
|
badmatch=util.always,
|
2007-03-11 05:00:57 +03:00
|
|
|
default='relglob'):
|
2007-04-04 11:22:06 +04:00
|
|
|
if src == 'b':
|
|
|
|
continue
|
2007-07-22 01:02:09 +04:00
|
|
|
if not node and abs not in repo.dirstate:
|
2005-08-26 17:19:18 +04:00
|
|
|
continue
|
2005-07-14 13:42:28 +04:00
|
|
|
if opts['fullpath']:
|
2005-07-18 18:54:21 +04:00
|
|
|
ui.write(os.path.join(repo.root, abs), end)
|
|
|
|
else:
|
2006-01-17 18:10:22 +03:00
|
|
|
ui.write(((pats and rel) or abs), end)
|
2007-03-11 05:00:58 +03:00
|
|
|
ret = 0
|
|
|
|
|
|
|
|
return ret
|
2005-07-06 06:19:01 +04:00
|
|
|
|
2005-08-24 23:39:10 +04:00
|
|
|
def log(ui, repo, *pats, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""show revision history of entire repository or files
|
|
|
|
|
2006-07-31 18:31:31 +04:00
|
|
|
Print the revision history of the specified files or the entire
|
|
|
|
project.
|
|
|
|
|
|
|
|
File history is shown without following rename or copy history of
|
2006-08-03 22:06:09 +04:00
|
|
|
files. Use -f/--follow with a file name to follow history across
|
|
|
|
renames and copies. --follow without a file name will only show
|
2006-08-03 22:48:56 +04:00
|
|
|
ancestors or descendants of the starting revision. --follow-first
|
|
|
|
only follows the first parent of merge revisions.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2006-08-04 00:29:31 +04:00
|
|
|
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.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
|
|
|
By default this command outputs: changeset id and hash, tags,
|
2005-11-23 20:36:44 +03:00
|
|
|
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.
|
2006-12-08 22:04:10 +03:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2006-02-20 22:06:41 +03:00
|
|
|
|
2006-11-17 10:06:54 +03:00
|
|
|
get = util.cachefunc(lambda r: repo.changectx(r).changeset())
|
2006-11-16 00:51:58 +03:00
|
|
|
changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts)
|
2006-02-20 22:06:41 +03:00
|
|
|
|
|
|
|
if opts['limit']:
|
|
|
|
try:
|
|
|
|
limit = int(opts['limit'])
|
|
|
|
except ValueError:
|
|
|
|
raise util.Abort(_('limit must be a positive integer'))
|
|
|
|
if limit <= 0: raise util.Abort(_('limit must be positive'))
|
|
|
|
else:
|
|
|
|
limit = sys.maxint
|
|
|
|
count = 0
|
|
|
|
|
2006-09-30 00:01:19 +04:00
|
|
|
if opts['copies'] and opts['rev']:
|
2006-11-23 01:02:28 +03:00
|
|
|
endrev = max(cmdutil.revrange(repo, opts['rev'])) + 1
|
2006-09-30 00:01:19 +04:00
|
|
|
else:
|
|
|
|
endrev = repo.changelog.count()
|
|
|
|
rcache = {}
|
|
|
|
ncache = {}
|
2007-12-29 17:11:48 +03:00
|
|
|
def getrenamed(fn, rev):
|
2006-09-30 00:01:19 +04:00
|
|
|
'''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)
|
|
|
|
for i in xrange(fl.count()):
|
|
|
|
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]
|
2007-12-29 17:11:48 +03:00
|
|
|
|
|
|
|
# If linkrev != rev (i.e. rev not found in rcache) fallback to
|
|
|
|
# filectx logic.
|
|
|
|
|
|
|
|
try:
|
|
|
|
return repo.changectx(rev).filectx(fn).renamed()
|
|
|
|
except revlog.LookupError:
|
|
|
|
pass
|
2006-09-30 00:01:19 +04:00
|
|
|
return None
|
|
|
|
|
2006-12-07 00:29:17 +03:00
|
|
|
df = False
|
|
|
|
if opts["date"]:
|
|
|
|
df = util.matchdate(opts["date"])
|
|
|
|
|
2006-12-09 05:44:58 +03:00
|
|
|
displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn)
|
2005-08-29 21:05:49 +04:00
|
|
|
for st, rev, fns in changeiter:
|
2006-11-13 22:26:57 +03:00
|
|
|
if st == 'add':
|
2005-10-25 02:37:20 +04:00
|
|
|
changenode = repo.changelog.node(rev)
|
2006-10-29 12:53:51 +03:00
|
|
|
parents = [p for p in repo.changelog.parentrevs(rev)
|
|
|
|
if p != nullrev]
|
2005-10-25 02:37:20 +04:00
|
|
|
if opts['no_merges'] and len(parents) == 2:
|
2006-01-12 09:57:58 +03:00
|
|
|
continue
|
2005-10-25 02:37:45 +04:00
|
|
|
if opts['only_merges'] and len(parents) != 2:
|
2006-01-12 09:57:58 +03:00
|
|
|
continue
|
2005-10-25 02:37:20 +04:00
|
|
|
|
2006-12-07 00:29:17 +03:00
|
|
|
if df:
|
|
|
|
changes = get(rev)
|
|
|
|
if not df(changes[2][0]):
|
|
|
|
continue
|
|
|
|
|
2005-10-04 00:45:59 +04:00
|
|
|
if opts['keyword']:
|
2006-11-16 00:51:58 +03:00
|
|
|
changes = get(rev)
|
2005-10-04 00:45:59 +04:00
|
|
|
miss = 0
|
2005-10-19 07:06:05 +04:00
|
|
|
for k in [kw.lower() for kw in opts['keyword']]:
|
2005-10-04 00:45:59 +04:00
|
|
|
if not (k in changes[1].lower() or
|
|
|
|
k in changes[4].lower() or
|
2007-03-29 18:28:10 +04:00
|
|
|
k in " ".join(changes[3]).lower()):
|
2005-10-04 00:45:59 +04:00
|
|
|
miss = 1
|
|
|
|
break
|
|
|
|
if miss:
|
|
|
|
continue
|
|
|
|
|
2006-09-30 00:01:19 +04:00
|
|
|
copies = []
|
|
|
|
if opts.get('copies') and rev:
|
2006-11-16 00:51:58 +03:00
|
|
|
for fn in get(rev)[3]:
|
2007-12-29 17:11:48 +03:00
|
|
|
rename = getrenamed(fn, rev)
|
2006-09-30 00:01:19 +04:00
|
|
|
if rename:
|
|
|
|
copies.append((fn, rename[0]))
|
2006-11-16 00:51:58 +03:00
|
|
|
displayer.show(rev, changenode, copies=copies)
|
2005-08-25 13:00:03 +04:00
|
|
|
elif st == 'iter':
|
2006-02-20 22:06:41 +03:00
|
|
|
if count == limit: break
|
2006-11-13 22:26:57 +03:00
|
|
|
if displayer.flush(rev):
|
2006-02-21 17:54:50 +03:00
|
|
|
count += 1
|
big heap of command clean-up work
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
big heap of command clean-up work
Migrate add, forget, remove, commit, diff, addremove, tip, log,
recover, and serve.
Fix up filterfiles, relfilter, and relpath to be a bit more bulletproof
Alphabetize functions and the command table
Make everything in commands.py relative-path aware
manifest hash: f0856031a7be4e49289677b467f29bcf24ebce4a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCof6gywK+sNU5EO8RAoW1AJsHu8vchPSjls7wVbvsq/UKlGhqtgCgtnnl
xSBxyf/TEVWjHIk3uTa8WSE=
=YPMl
-----END PGP SIGNATURE-----
2005-06-04 23:18:56 +04:00
|
|
|
|
2007-08-10 06:42:33 +04:00
|
|
|
def manifest(ui, repo, node=None, rev=None):
|
2006-12-17 00:33:39 +03:00
|
|
|
"""output the current or given revision of the project manifest
|
2005-10-25 02:52:28 +04:00
|
|
|
|
|
|
|
Print a list of version controlled files for the given revision.
|
2006-12-17 00:58:10 +03:00
|
|
|
If no revision is given, the parent of the working directory is used,
|
|
|
|
or tip if no revision is checked out.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
|
|
|
The manifest is the list of files being version controlled. If no revision
|
2006-12-01 07:38:48 +03:00
|
|
|
is given then the first parent of the working directory is used.
|
|
|
|
|
2007-12-29 21:49:48 +03:00
|
|
|
With -v flag, print file permissions, symlink and executable bits. With
|
2007-10-07 00:30:22 +04:00
|
|
|
--debug flag, print file revision hashes.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2006-12-01 07:38:48 +03:00
|
|
|
|
2007-08-10 06:42:33 +04:00
|
|
|
if rev and node:
|
|
|
|
raise util.Abort(_("please specify just one revision"))
|
|
|
|
|
|
|
|
if not node:
|
|
|
|
node = rev
|
|
|
|
|
|
|
|
m = repo.changectx(node).manifest()
|
2005-06-05 01:45:31 +04:00
|
|
|
files = m.keys()
|
|
|
|
files.sort()
|
|
|
|
|
|
|
|
for f in files:
|
2006-12-01 07:38:48 +03:00
|
|
|
if ui.debugflag:
|
|
|
|
ui.write("%40s " % hex(m[f]))
|
|
|
|
if ui.verbose:
|
2007-10-07 00:30:22 +04:00
|
|
|
type = m.execf(f) and "*" or m.linkf(f) and "@" or " "
|
|
|
|
perm = m.execf(f) and "755" or "644"
|
|
|
|
ui.write("%3s %1s " % (perm, type))
|
2006-12-01 07:38:48 +03:00
|
|
|
ui.write("%s\n" % f)
|
2005-06-05 01:45:31 +04:00
|
|
|
|
2007-05-17 21:55:24 +04:00
|
|
|
def merge(ui, repo, node=None, force=None, rev=None):
|
2006-12-29 08:37:43 +03:00
|
|
|
"""merge working directory with another revision
|
2006-03-29 22:27:16 +04:00
|
|
|
|
|
|
|
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.
|
2006-08-15 22:38:07 +04:00
|
|
|
|
|
|
|
If no revision is specified, the working directory's parent is a
|
|
|
|
head revision, and the repository contains exactly one other head,
|
|
|
|
the other head is merged with by default. Otherwise, an explicit
|
|
|
|
revision to merge with must be provided.
|
2006-03-29 22:27:16 +04:00
|
|
|
"""
|
2006-08-08 05:54:03 +04:00
|
|
|
|
2007-05-17 21:55:24 +04:00
|
|
|
if rev and node:
|
|
|
|
raise util.Abort(_("please specify just one revision"))
|
|
|
|
if not node:
|
|
|
|
node = rev
|
|
|
|
|
2006-12-13 03:16:23 +03:00
|
|
|
if not node:
|
2006-08-15 22:38:07 +04:00
|
|
|
heads = repo.heads()
|
|
|
|
if len(heads) > 2:
|
|
|
|
raise util.Abort(_('repo has %d heads - '
|
|
|
|
'please merge with an explicit rev') %
|
|
|
|
len(heads))
|
|
|
|
parent = repo.dirstate.parents()[0]
|
2007-08-25 13:30:11 +04:00
|
|
|
if len(heads) == 1:
|
|
|
|
msg = _('there is nothing to merge')
|
|
|
|
if parent != repo.lookup(repo.workingctx().branch()):
|
2007-11-21 00:54:25 +03:00
|
|
|
msg = _('%s - use "hg update" instead') % msg
|
2007-08-25 13:30:11 +04:00
|
|
|
raise util.Abort(msg)
|
|
|
|
|
2006-08-15 22:38:07 +04:00
|
|
|
if parent not in heads:
|
|
|
|
raise util.Abort(_('working dir not at a head rev - '
|
|
|
|
'use "hg update" or merge with an explicit rev'))
|
|
|
|
node = parent == heads[0] and heads[-1] or heads[0]
|
2006-08-08 07:54:33 +04:00
|
|
|
return hg.merge(repo, node, force=force)
|
2006-03-31 22:37:25 +04:00
|
|
|
|
2006-06-24 05:09:44 +04:00
|
|
|
def outgoing(ui, repo, dest=None, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""show changesets not found in destination
|
|
|
|
|
2006-03-20 19:14:58 +03:00
|
|
|
Show changesets not found in the specified destination repository or
|
|
|
|
the default push location. These are the changesets that would be pushed
|
2005-10-25 02:52:28 +04:00
|
|
|
if a push was requested.
|
2006-02-28 02:46:06 +03:00
|
|
|
|
2006-03-20 19:14:58 +03:00
|
|
|
See pull for valid destination format details.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2007-08-27 09:21:58 +04:00
|
|
|
dest, revs, checkout = hg.parseurl(
|
2007-06-02 03:40:14 +04:00
|
|
|
ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev'])
|
2007-06-12 06:09:24 +04:00
|
|
|
cmdutil.setremoteconfig(ui, opts)
|
2007-06-02 03:40:14 +04:00
|
|
|
if revs:
|
|
|
|
revs = [repo.lookup(rev) for rev in revs]
|
2006-03-16 08:58:15 +03:00
|
|
|
|
2005-08-17 03:49:26 +04:00
|
|
|
other = hg.repository(ui, dest)
|
2007-11-05 22:29:32 +03:00
|
|
|
ui.status(_('comparing with %s\n') % util.hidepassword(dest))
|
2006-03-15 09:58:14 +03:00
|
|
|
o = repo.findoutgoing(other, force=opts['force'])
|
2006-03-24 10:51:08 +03:00
|
|
|
if not o:
|
|
|
|
ui.status(_("no changes found\n"))
|
2006-12-19 17:58:56 +03:00
|
|
|
return 1
|
2006-06-30 18:16:35 +04:00
|
|
|
o = repo.changelog.nodesbetween(o, revs)[0]
|
2005-10-25 03:59:31 +04:00
|
|
|
if opts['newest_first']:
|
|
|
|
o.reverse()
|
2006-11-13 22:26:57 +03:00
|
|
|
displayer = cmdutil.show_changeset(ui, repo, opts)
|
2005-08-17 03:49:26 +04:00
|
|
|
for n in o:
|
2005-10-25 02:37:20 +04:00
|
|
|
parents = [p for p in repo.changelog.parents(n) if p != nullid]
|
|
|
|
if opts['no_merges'] and len(parents) == 2:
|
|
|
|
continue
|
2006-02-28 00:18:57 +03:00
|
|
|
displayer.show(changenode=n)
|
2005-08-17 03:49:26 +04:00
|
|
|
|
2006-11-16 00:51:58 +03:00
|
|
|
def parents(ui, repo, file_=None, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""show the parents of the working dir or revision
|
|
|
|
|
2007-06-14 21:58:49 +04:00
|
|
|
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.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2006-11-16 00:51:58 +03:00
|
|
|
rev = opts.get('rev')
|
2007-09-12 01:04:42 +04:00
|
|
|
if rev:
|
|
|
|
ctx = repo.changectx(rev)
|
|
|
|
else:
|
|
|
|
ctx = repo.workingctx()
|
|
|
|
|
2007-06-14 21:58:49 +04:00
|
|
|
if file_:
|
2007-07-17 16:08:29 +04:00
|
|
|
files, match, anypats = cmdutil.matchpats(repo, (file_,), opts)
|
|
|
|
if anypats or len(files) != 1:
|
|
|
|
raise util.Abort(_('can only specify an explicit file name'))
|
2007-09-12 01:04:42 +04:00
|
|
|
file_ = files[0]
|
|
|
|
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]
|
2005-06-04 00:46:38 +04:00
|
|
|
else:
|
2007-09-12 01:04:42 +04:00
|
|
|
p = [cp.node() for cp in ctx.parents()]
|
2005-06-04 00:46:38 +04:00
|
|
|
|
2006-11-13 22:26:57 +03:00
|
|
|
displayer = cmdutil.show_changeset(ui, repo, opts)
|
2005-06-04 00:46:38 +04:00
|
|
|
for n in p:
|
2005-08-28 01:55:07 +04:00
|
|
|
if n != nullid:
|
2006-11-16 00:51:58 +03:00
|
|
|
displayer.show(changenode=n)
|
2005-06-04 00:46:38 +04:00
|
|
|
|
2006-03-08 03:30:43 +03:00
|
|
|
def paths(ui, repo, search=None):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""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
|
|
|
|
and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too.
|
|
|
|
"""
|
2005-07-27 20:19:59 +04:00
|
|
|
if search:
|
|
|
|
for name, path in ui.configitems("paths"):
|
|
|
|
if name == search:
|
|
|
|
ui.write("%s\n" % path)
|
|
|
|
return
|
2005-10-19 05:38:39 +04:00
|
|
|
ui.warn(_("not found!\n"))
|
2005-07-27 20:19:59 +04:00
|
|
|
return 1
|
|
|
|
else:
|
|
|
|
for name, path in ui.configitems("paths"):
|
|
|
|
ui.write("%s = %s\n" % (name, path))
|
|
|
|
|
2007-08-27 08:44:35 +04:00
|
|
|
def postincoming(ui, repo, modheads, optupdate, checkout):
|
2006-03-29 22:27:16 +04:00
|
|
|
if modheads == 0:
|
|
|
|
return
|
|
|
|
if optupdate:
|
2007-08-27 08:44:35 +04:00
|
|
|
if modheads <= 1 or checkout:
|
|
|
|
return hg.update(repo, checkout)
|
2006-03-29 22:27:16 +04:00
|
|
|
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"))
|
2006-03-31 22:37:25 +04:00
|
|
|
|
2005-06-22 06:04:25 +04:00
|
|
|
def pull(ui, repo, source="default", **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""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:
|
|
|
|
|
2006-10-27 17:56:34 +04:00
|
|
|
local/filesystem/path (or file://local/filesystem/path)
|
2006-07-12 00:19:49 +04:00
|
|
|
http://[user@]host[:port]/[path]
|
|
|
|
https://[user@]host[:port]/[path]
|
|
|
|
ssh://[user@]host[:port]/[path]
|
2006-10-27 17:56:34 +04:00
|
|
|
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.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2007-06-02 03:40:14 +04:00
|
|
|
An optional identifier after # indicates a particular branch, tag,
|
|
|
|
or changeset to pull.
|
|
|
|
|
2006-03-20 19:14:58 +03:00
|
|
|
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.
|
2006-07-12 00:19:49 +04:00
|
|
|
- path is relative to the remote user's home directory by default.
|
2006-07-12 00:36:52 +04:00
|
|
|
Use an extra slash at the start of a path to specify an absolute path:
|
|
|
|
ssh://example.com//tmp/repository
|
2006-03-20 19:14:58 +03:00
|
|
|
- Mercurial doesn't use its own compression via SSH; the right thing
|
2006-10-19 15:00:02 +04:00
|
|
|
to do is to configure it in your ~/.ssh/config, e.g.:
|
2006-03-20 19:14:58 +03:00
|
|
|
Host *.mylocalnetwork.example.com
|
2006-10-19 15:00:02 +04:00
|
|
|
Compression no
|
2006-03-20 19:14:58 +03:00
|
|
|
Host *
|
2006-10-19 15:00:02 +04:00
|
|
|
Compression yes
|
2006-03-20 19:14:58 +03:00
|
|
|
Alternatively specify "ssh -C" as your ssh command in your hgrc or
|
|
|
|
with the --ssh command line option.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2007-08-27 09:21:58 +04:00
|
|
|
source, revs, checkout = hg.parseurl(ui.expandpath(source), opts['rev'])
|
2007-06-12 06:09:24 +04:00
|
|
|
cmdutil.setremoteconfig(ui, opts)
|
2005-08-20 10:11:48 +04:00
|
|
|
|
2005-06-05 00:14:14 +04:00
|
|
|
other = hg.repository(ui, source)
|
2007-11-05 22:29:32 +03:00
|
|
|
ui.status(_('pulling from %s\n') % util.hidepassword(source))
|
2007-06-02 03:40:14 +04:00
|
|
|
if revs:
|
2007-08-28 01:48:08 +04:00
|
|
|
try:
|
2007-06-02 03:40:14 +04:00
|
|
|
revs = [other.lookup(rev) for rev in revs]
|
2007-08-28 01:48:08 +04:00
|
|
|
except repo.NoCapability:
|
|
|
|
error = _("Other repository doesn't support revision lookup, "
|
|
|
|
"so a rev cannot be specified.")
|
2006-09-10 05:25:07 +04:00
|
|
|
raise util.Abort(error)
|
2007-06-02 03:40:14 +04:00
|
|
|
|
2006-03-29 22:27:16 +04:00
|
|
|
modheads = repo.pull(other, heads=revs, force=opts['force'])
|
2007-08-27 08:44:35 +04:00
|
|
|
return postincoming(ui, repo, modheads, opts['update'], checkout)
|
2005-06-05 00:14:14 +04:00
|
|
|
|
2006-06-24 05:09:44 +04:00
|
|
|
def push(ui, repo, dest=None, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""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
|
|
|
|
the client has forgotten to sync and merge before pushing.
|
|
|
|
|
|
|
|
Valid URLs are of the form:
|
|
|
|
|
2006-10-27 17:56:34 +04:00
|
|
|
local/filesystem/path (or file://local/filesystem/path)
|
2006-07-12 00:19:49 +04:00
|
|
|
ssh://[user@]host[:port]/[path]
|
2006-10-27 17:56:34 +04:00
|
|
|
http://[user@]host[:port]/[path]
|
|
|
|
https://[user@]host[:port]/[path]
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2007-06-02 03:40:14 +04:00
|
|
|
An optional identifier after # indicates a particular branch, tag,
|
|
|
|
or changeset to push.
|
|
|
|
|
2006-03-20 19:14:58 +03:00
|
|
|
Look at the help text for the pull command for important details
|
|
|
|
about ssh:// URLs.
|
2006-07-12 00:36:52 +04:00
|
|
|
|
2006-10-27 17:56:34 +04:00
|
|
|
Pushing to http:// and https:// URLs is only possible, if this
|
|
|
|
feature is explicitly enabled on the remote Mercurial server.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2007-08-27 09:21:58 +04:00
|
|
|
dest, revs, checkout = hg.parseurl(
|
2007-06-02 03:40:14 +04:00
|
|
|
ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev'])
|
2007-06-12 06:09:24 +04:00
|
|
|
cmdutil.setremoteconfig(ui, opts)
|
2005-08-20 09:36:57 +04:00
|
|
|
|
2005-07-07 10:25:40 +04:00
|
|
|
other = hg.repository(ui, dest)
|
2007-11-05 22:29:32 +03:00
|
|
|
ui.status('pushing to %s\n' % util.hidepassword(dest))
|
2007-06-02 03:40:14 +04:00
|
|
|
if revs:
|
|
|
|
revs = [repo.lookup(rev) for rev in revs]
|
2006-02-14 23:11:57 +03:00
|
|
|
r = repo.push(other, opts['force'], revs=revs)
|
2006-03-29 22:27:16 +04:00
|
|
|
return r == 0
|
2005-06-13 07:35:41 +04:00
|
|
|
|
2006-11-16 00:51:58 +03:00
|
|
|
def rawcommit(ui, repo, *pats, **opts):
|
2006-01-29 09:06:42 +03:00
|
|
|
"""raw commit interface (DEPRECATED)
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2006-02-28 02:46:06 +03:00
|
|
|
(DEPRECATED)
|
2005-10-25 02:52:28 +04:00
|
|
|
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.
|
2006-01-29 09:06:42 +03:00
|
|
|
|
|
|
|
This command is now deprecated and will be removed in a future
|
|
|
|
release, please use debugsetparents and commit instead.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2006-01-29 09:06:42 +03:00
|
|
|
|
|
|
|
ui.warn(_("(the rawcommit command is deprecated)\n"))
|
|
|
|
|
2007-06-12 06:09:24 +04:00
|
|
|
message = cmdutil.logmessage(opts)
|
2005-06-05 00:14:14 +04:00
|
|
|
|
2006-11-16 00:51:58 +03:00
|
|
|
files, match, anypats = cmdutil.matchpats(repo, pats, opts)
|
|
|
|
if opts['files']:
|
|
|
|
files += open(opts['files']).read().splitlines()
|
2005-06-24 05:43:04 +04:00
|
|
|
|
2006-11-16 00:51:58 +03:00
|
|
|
parents = [repo.lookup(p) for p in opts['parent']]
|
2005-06-28 12:59:59 +04:00
|
|
|
|
2005-09-05 01:47:02 +04:00
|
|
|
try:
|
2006-11-16 00:51:58 +03:00
|
|
|
repo.rawcommit(files, message, opts['user'], opts['date'], *parents)
|
2005-09-05 01:47:02 +04:00
|
|
|
except ValueError, inst:
|
|
|
|
raise util.Abort(str(inst))
|
2005-06-28 12:59:59 +04:00
|
|
|
|
big heap of command clean-up work
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
big heap of command clean-up work
Migrate add, forget, remove, commit, diff, addremove, tip, log,
recover, and serve.
Fix up filterfiles, relfilter, and relpath to be a bit more bulletproof
Alphabetize functions and the command table
Make everything in commands.py relative-path aware
manifest hash: f0856031a7be4e49289677b467f29bcf24ebce4a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCof6gywK+sNU5EO8RAoW1AJsHu8vchPSjls7wVbvsq/UKlGhqtgCgtnnl
xSBxyf/TEVWjHIk3uTa8WSE=
=YPMl
-----END PGP SIGNATURE-----
2005-06-04 23:18:56 +04:00
|
|
|
def recover(ui, repo):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""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.
|
|
|
|
"""
|
2005-11-09 01:22:03 +03:00
|
|
|
if repo.recover():
|
2006-08-08 01:27:09 +04:00
|
|
|
return hg.verify(repo)
|
2006-04-11 10:42:07 +04:00
|
|
|
return 1
|
big heap of command clean-up work
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
big heap of command clean-up work
Migrate add, forget, remove, commit, diff, addremove, tip, log,
recover, and serve.
Fix up filterfiles, relfilter, and relpath to be a bit more bulletproof
Alphabetize functions and the command table
Make everything in commands.py relative-path aware
manifest hash: f0856031a7be4e49289677b467f29bcf24ebce4a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCof6gywK+sNU5EO8RAoW1AJsHu8vchPSjls7wVbvsq/UKlGhqtgCgtnnl
xSBxyf/TEVWjHIk3uTa8WSE=
=YPMl
-----END PGP SIGNATURE-----
2005-06-04 23:18:56 +04:00
|
|
|
|
2006-05-03 08:44:24 +04:00
|
|
|
def remove(ui, repo, *pats, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""remove the specified files on the next commit
|
|
|
|
|
|
|
|
Schedule the indicated files for removal from the repository.
|
|
|
|
|
|
|
|
This only removes files from the current branch, not from the
|
|
|
|
entire project history. If the files still exist in the working
|
2006-05-03 08:44:24 +04:00
|
|
|
directory, they will be deleted from it. If invoked with --after,
|
2007-04-30 19:51:59 +04:00
|
|
|
files are marked as removed, but not actually unlinked unless --force
|
2007-04-30 20:32:44 +04:00
|
|
|
is also given. Without exact file names, --after will only mark
|
2007-04-30 20:13:27 +04:00
|
|
|
files as removed if they are no longer in the working directory.
|
2006-05-19 00:48:12 +04:00
|
|
|
|
2006-12-08 23:55:45 +03:00
|
|
|
This command schedules the files to be removed at the next commit.
|
|
|
|
To undo a remove before that, see hg revert.
|
|
|
|
|
2006-05-19 00:48:12 +04:00
|
|
|
Modified files and added files are not removed by default. To
|
|
|
|
remove them, use the -f/--force option.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2006-05-03 08:44:24 +04:00
|
|
|
if not opts['after'] and not pats:
|
|
|
|
raise util.Abort(_('no files specified'))
|
2006-08-14 03:11:22 +04:00
|
|
|
files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
|
2006-05-19 00:48:12 +04:00
|
|
|
exact = dict.fromkeys(files)
|
2006-08-13 03:40:12 +04:00
|
|
|
mardu = map(dict.fromkeys, repo.status(files=files, match=matchfn))[:5]
|
2006-05-19 00:48:12 +04:00
|
|
|
modified, added, removed, deleted, unknown = mardu
|
|
|
|
remove, forget = [], []
|
2006-08-14 03:11:22 +04:00
|
|
|
for src, abs, rel, exact in cmdutil.walk(repo, pats, opts):
|
2005-09-01 19:01:10 +04:00
|
|
|
reason = None
|
2007-04-30 19:51:59 +04:00
|
|
|
if abs in modified and not opts['force']:
|
2006-05-19 00:48:12 +04:00
|
|
|
reason = _('is modified (use -f to force removal)')
|
|
|
|
elif abs in added:
|
|
|
|
if opts['force']:
|
|
|
|
forget.append(abs)
|
|
|
|
continue
|
|
|
|
reason = _('has been marked for add (use -f to force removal)')
|
2007-12-10 19:24:21 +03:00
|
|
|
exact = 1 # force the message
|
2007-07-22 01:02:09 +04:00
|
|
|
elif abs not in repo.dirstate:
|
2006-01-12 09:57:58 +03:00
|
|
|
reason = _('is not managed')
|
2007-04-30 20:32:44 +04:00
|
|
|
elif opts['after'] and not exact and abs not in deleted:
|
2007-04-30 20:13:27 +04:00
|
|
|
continue
|
2006-05-19 00:48:12 +04:00
|
|
|
elif abs in removed:
|
|
|
|
continue
|
2005-09-15 09:32:12 +04:00
|
|
|
if reason:
|
2006-01-12 09:57:58 +03:00
|
|
|
if exact:
|
|
|
|
ui.warn(_('not removing %s: file %s\n') % (rel, reason))
|
2005-09-01 19:01:10 +04:00
|
|
|
else:
|
2006-01-12 09:57:58 +03:00
|
|
|
if ui.verbose or not exact:
|
|
|
|
ui.status(_('removing %s\n') % rel)
|
2006-05-19 00:48:12 +04:00
|
|
|
remove.append(abs)
|
|
|
|
repo.forget(forget)
|
2007-04-30 19:51:59 +04:00
|
|
|
repo.remove(remove, unlink=opts['force'] or not opts['after'])
|
big heap of command clean-up work
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
big heap of command clean-up work
Migrate add, forget, remove, commit, diff, addremove, tip, log,
recover, and serve.
Fix up filterfiles, relfilter, and relpath to be a bit more bulletproof
Alphabetize functions and the command table
Make everything in commands.py relative-path aware
manifest hash: f0856031a7be4e49289677b467f29bcf24ebce4a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCof6gywK+sNU5EO8RAoW1AJsHu8vchPSjls7wVbvsq/UKlGhqtgCgtnnl
xSBxyf/TEVWjHIk3uTa8WSE=
=YPMl
-----END PGP SIGNATURE-----
2005-06-04 23:18:56 +04:00
|
|
|
|
2005-09-15 03:34:22 +04:00
|
|
|
def rename(ui, repo, *pats, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""rename files; equivalent of copy + remove
|
|
|
|
|
|
|
|
Mark dest as copies of sources; mark sources for deletion. If
|
|
|
|
dest is a directory, copies are put in that directory. If dest is
|
|
|
|
a file, there can only be one source.
|
|
|
|
|
|
|
|
By default, this command copies the contents of files as they
|
|
|
|
stand in the working directory. If invoked with --after, the
|
|
|
|
operation is recorded, but no copying is performed.
|
|
|
|
|
2006-12-08 23:55:45 +03:00
|
|
|
This command takes effect in the next commit. To undo a rename
|
|
|
|
before that, see hg revert.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2007-07-22 01:02:09 +04:00
|
|
|
wlock = repo.wlock(False)
|
2007-07-22 01:02:10 +04:00
|
|
|
try:
|
2007-12-07 11:29:55 +03:00
|
|
|
return cmdutil.copy(ui, repo, pats, opts, rename=True)
|
2007-07-22 01:02:10 +04:00
|
|
|
finally:
|
|
|
|
del wlock
|
2005-09-15 03:34:22 +04:00
|
|
|
|
2005-10-28 00:31:12 +04:00
|
|
|
def revert(ui, repo, *pats, **opts):
|
2007-12-03 00:25:37 +03:00
|
|
|
"""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)
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2006-05-05 21:31:03 +04:00
|
|
|
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
|
2006-12-08 23:55:45 +03:00
|
|
|
state and unschedules adds, removes, copies, and renames. If the
|
|
|
|
working directory has two parents, you must explicitly specify the
|
|
|
|
revision to revert to.
|
2006-02-28 02:46:06 +03:00
|
|
|
|
2006-08-22 21:20:24 +04:00
|
|
|
Using the -r option, revert the given files or directories to their
|
|
|
|
contents as of a specific revision. This can be helpful to "roll
|
2007-12-03 00:25:37 +03:00
|
|
|
back" some or all of an earlier change.
|
2006-02-28 02:46:06 +03:00
|
|
|
|
|
|
|
Revert modifies the working directory. It does not commit any
|
2006-05-05 02:23:58 +04:00
|
|
|
changes, or change the parent of the working directory. If you
|
|
|
|
revert to a revision other than the parent of the working
|
|
|
|
directory, the reverted files will thus appear modified
|
|
|
|
afterwards.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2007-07-05 21:13:08 +04:00
|
|
|
If a file has been deleted, it is restored. If the executable
|
2005-10-25 02:52:28 +04:00
|
|
|
mode of a file was changed, it is reset.
|
|
|
|
|
2005-10-28 00:31:12 +04:00
|
|
|
If names are given, all files matching the names are reverted.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2006-08-21 20:44:52 +04:00
|
|
|
If no arguments are given, no files are reverted.
|
2007-12-03 00:25:37 +03:00
|
|
|
|
|
|
|
Modified files are saved with a .orig suffix before reverting.
|
|
|
|
To disable these backups, use --no-backup.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2006-08-21 20:44:52 +04:00
|
|
|
|
2006-12-07 02:58:09 +03:00
|
|
|
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"])
|
|
|
|
|
2006-08-21 20:44:52 +04:00
|
|
|
if not pats and not opts['all']:
|
2006-08-29 21:02:57 +04:00
|
|
|
raise util.Abort(_('no files or directories specified; '
|
|
|
|
'use --all to revert the whole repo'))
|
2006-08-21 20:44:52 +04:00
|
|
|
|
2006-05-05 21:31:03 +04:00
|
|
|
parent, p2 = repo.dirstate.parents()
|
2006-09-16 02:23:52 +04:00
|
|
|
if not opts['rev'] and p2 != nullid:
|
|
|
|
raise util.Abort(_('uncommitted merge - please provide a '
|
|
|
|
'specific revision'))
|
2006-12-26 05:13:57 +03:00
|
|
|
ctx = repo.changectx(opts['rev'])
|
|
|
|
node = ctx.node()
|
|
|
|
mf = ctx.manifest()
|
2006-06-08 00:16:25 +04:00
|
|
|
if node == parent:
|
|
|
|
pmf = mf
|
|
|
|
else:
|
|
|
|
pmf = None
|
2006-03-31 22:37:25 +04:00
|
|
|
|
2006-04-03 21:02:09 +04:00
|
|
|
# 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.
|
|
|
|
|
2006-03-31 22:37:25 +04:00
|
|
|
names = {}
|
2006-04-03 21:02:09 +04:00
|
|
|
target_only = {}
|
|
|
|
|
2007-07-22 01:02:10 +04:00
|
|
|
wlock = repo.wlock()
|
|
|
|
try:
|
|
|
|
# walk dirstate.
|
|
|
|
for src, abs, rel, exact in cmdutil.walk(repo, pats, opts,
|
|
|
|
badmatch=mf.has_key):
|
|
|
|
names[abs] = (rel, exact)
|
|
|
|
if src == 'b':
|
|
|
|
target_only[abs] = True
|
2006-04-03 21:02:09 +04:00
|
|
|
|
2007-07-22 01:02:10 +04:00
|
|
|
# walk target manifest.
|
2006-04-03 21:02:09 +04:00
|
|
|
|
2007-07-22 01:02:10 +04:00
|
|
|
def badmatch(path):
|
|
|
|
if path in names:
|
2007-03-16 06:22:52 +03:00
|
|
|
return True
|
2007-07-22 01:02:10 +04:00
|
|
|
path_ = path + '/'
|
|
|
|
for f in names:
|
|
|
|
if f.startswith(path_):
|
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
|
|
|
for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, node=node,
|
|
|
|
badmatch=badmatch):
|
|
|
|
if abs in names or src == 'b':
|
2006-03-31 22:37:25 +04:00
|
|
|
continue
|
2007-07-22 01:02:10 +04:00
|
|
|
names[abs] = (rel, exact)
|
|
|
|
target_only[abs] = True
|
|
|
|
|
2007-07-22 01:02:10 +04:00
|
|
|
changes = repo.status(match=names.has_key)[:5]
|
2007-07-22 01:02:10 +04:00
|
|
|
modified, added, removed, deleted, unknown = map(dict.fromkeys, changes)
|
|
|
|
|
2007-08-30 03:19:27 +04:00
|
|
|
# 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)
|
|
|
|
|
2007-07-22 01:02:10 +04:00
|
|
|
revert = ([], _('reverting %s\n'))
|
|
|
|
add = ([], _('adding %s\n'))
|
|
|
|
remove = ([], _('removing %s\n'))
|
|
|
|
forget = ([], _('forgetting %s\n'))
|
|
|
|
undelete = ([], _('undeleting %s\n'))
|
|
|
|
update = {}
|
|
|
|
|
|
|
|
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),
|
|
|
|
(added, revert, forget, True, False),
|
|
|
|
(removed, undelete, None, False, False),
|
|
|
|
(deleted, revert, remove, False, False),
|
|
|
|
(unknown, add, None, True, False),
|
|
|
|
(target_only, add, None, False, False),
|
|
|
|
)
|
|
|
|
|
|
|
|
entries = names.items()
|
|
|
|
entries.sort()
|
|
|
|
|
|
|
|
for abs, (rel, exact) in entries:
|
|
|
|
mfentry = mf.get(abs)
|
|
|
|
target = repo.wjoin(abs)
|
|
|
|
def handle(xlist, dobackup):
|
|
|
|
xlist[0].append(abs)
|
|
|
|
update[abs] = 1
|
|
|
|
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:
|
|
|
|
ui.status(xlist[1] % rel)
|
|
|
|
for table, hitlist, misslist, backuphit, backupmiss in disptable:
|
|
|
|
if abs not in table: continue
|
|
|
|
# file has changed in dirstate
|
2006-06-08 00:16:25 +04:00
|
|
|
if mfentry:
|
2007-07-22 01:02:10 +04:00
|
|
|
handle(hitlist, backuphit)
|
|
|
|
elif misslist is not None:
|
|
|
|
handle(misslist, backupmiss)
|
2006-06-08 00:16:25 +04:00
|
|
|
else:
|
2007-07-22 01:02:10 +04:00
|
|
|
if exact: ui.warn(_('file not managed: %s\n') % rel)
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
# 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
|
|
|
|
pmf = repo.changectx(parent).manifest()
|
|
|
|
if abs in pmf:
|
|
|
|
if mfentry:
|
|
|
|
# if version of file is same in parent and target
|
|
|
|
# manifests, do nothing
|
|
|
|
if pmf[abs] != mfentry:
|
|
|
|
handle(revert, False)
|
|
|
|
else:
|
|
|
|
handle(remove, False)
|
|
|
|
|
|
|
|
if not opts.get('dry_run'):
|
|
|
|
for f in forget[0]:
|
|
|
|
repo.dirstate.forget(f)
|
2007-07-22 01:02:10 +04:00
|
|
|
r = hg.revert(repo, node, update.has_key)
|
2007-07-22 01:02:10 +04:00
|
|
|
for f in add[0]:
|
|
|
|
repo.dirstate.add(f)
|
|
|
|
for f in undelete[0]:
|
|
|
|
repo.dirstate.normal(f)
|
|
|
|
for f in remove[0]:
|
|
|
|
repo.dirstate.remove(f)
|
|
|
|
return r
|
|
|
|
finally:
|
|
|
|
del wlock
|
2005-07-03 07:49:46 +04:00
|
|
|
|
2006-05-09 01:19:05 +04:00
|
|
|
def rollback(ui, repo):
|
2007-12-03 00:26:01 +03:00
|
|
|
"""roll back the last transaction
|
2006-05-09 01:19:05 +04:00
|
|
|
|
2007-12-03 00:26:01 +03:00
|
|
|
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.
|
2006-05-09 01:19:05 +04:00
|
|
|
|
|
|
|
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.
|
|
|
|
"""
|
2006-06-01 21:08:29 +04:00
|
|
|
repo.rollback()
|
2006-05-09 01:19:05 +04:00
|
|
|
|
2005-06-25 11:22:46 +04:00
|
|
|
def root(ui, repo):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""print the root (top) of the current working dir
|
|
|
|
|
|
|
|
Print the root directory of the current repository.
|
|
|
|
"""
|
2005-06-25 11:22:46 +04:00
|
|
|
ui.write(repo.root + "\n")
|
|
|
|
|
big heap of command clean-up work
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
big heap of command clean-up work
Migrate add, forget, remove, commit, diff, addremove, tip, log,
recover, and serve.
Fix up filterfiles, relfilter, and relpath to be a bit more bulletproof
Alphabetize functions and the command table
Make everything in commands.py relative-path aware
manifest hash: f0856031a7be4e49289677b467f29bcf24ebce4a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCof6gywK+sNU5EO8RAoW1AJsHu8vchPSjls7wVbvsq/UKlGhqtgCgtnnl
xSBxyf/TEVWjHIk3uTa8WSE=
=YPMl
-----END PGP SIGNATURE-----
2005-06-04 23:18:56 +04:00
|
|
|
def serve(ui, repo, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""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
|
|
|
|
stderr. Use the "-A" and "-E" options to log to files.
|
|
|
|
"""
|
2005-07-06 05:55:22 +04:00
|
|
|
|
|
|
|
if opts["stdio"]:
|
2006-04-25 21:38:19 +04:00
|
|
|
if repo is None:
|
2006-09-11 12:08:30 +04:00
|
|
|
raise hg.RepoError(_("There is no Mercurial repository here"
|
|
|
|
" (.hg not found)"))
|
2006-06-04 21:26:05 +04:00
|
|
|
s = sshserver.sshserver(ui, repo)
|
|
|
|
s.serve_forever()
|
2005-07-07 10:23:57 +04:00
|
|
|
|
2007-02-13 15:00:17 +03:00
|
|
|
parentui = ui.parentui or ui
|
2008-01-09 13:15:00 +03:00
|
|
|
optlist = ("name templates style address port prefix ipv6"
|
2007-07-10 09:12:28 +04:00
|
|
|
" accesslog errorlog webdir_conf certificate")
|
2005-08-22 02:56:14 +04:00
|
|
|
for o in optlist.split():
|
|
|
|
if opts[o]:
|
2007-02-13 15:00:17 +03:00
|
|
|
parentui.setconfig("web", o, str(opts[o]))
|
2007-08-09 00:47:30 +04:00
|
|
|
if (repo is not None) and (repo.ui != parentui):
|
2007-07-12 02:56:16 +04:00
|
|
|
repo.ui.setconfig("web", o, str(opts[o]))
|
2005-08-22 02:56:14 +04:00
|
|
|
|
2006-04-25 21:38:19 +04:00
|
|
|
if repo is None and not ui.config("web", "webdir_conf"):
|
2006-09-11 12:08:30 +04:00
|
|
|
raise hg.RepoError(_("There is no Mercurial repository here"
|
|
|
|
" (.hg not found)"))
|
2006-04-25 21:38:19 +04:00
|
|
|
|
2007-04-28 08:30:55 +04:00
|
|
|
class service:
|
|
|
|
def init(self):
|
2007-06-21 23:58:18 +04:00
|
|
|
util.set_signal_handler()
|
2007-04-28 08:30:55 +04:00
|
|
|
try:
|
|
|
|
self.httpd = hgweb.server.create_server(parentui, repo)
|
|
|
|
except socket.error, inst:
|
|
|
|
raise util.Abort(_('cannot start server: ') + inst.args[1])
|
|
|
|
|
|
|
|
if not ui.verbose: return
|
|
|
|
|
2007-06-04 23:49:01 +04:00
|
|
|
if self.httpd.port != 80:
|
2007-04-28 08:30:55 +04:00
|
|
|
ui.status(_('listening at http://%s:%d/\n') %
|
2007-06-04 23:49:01 +04:00
|
|
|
(self.httpd.addr, self.httpd.port))
|
2007-04-28 08:30:55 +04:00
|
|
|
else:
|
2007-06-04 23:49:01 +04:00
|
|
|
ui.status(_('listening at http://%s/\n') % self.httpd.addr)
|
2007-04-28 08:30:55 +04:00
|
|
|
|
|
|
|
def run(self):
|
|
|
|
self.httpd.serve_forever()
|
|
|
|
|
|
|
|
service = service()
|
|
|
|
|
|
|
|
cmdutil.service(opts, initfn=service.init, runfn=service.run)
|
2005-06-28 12:59:59 +04:00
|
|
|
|
2005-07-20 15:01:23 +04:00
|
|
|
def status(ui, repo, *pats, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""show changed files in the working directory
|
2005-06-01 23:48:34 +04:00
|
|
|
|
2006-07-21 03:21:07 +04:00
|
|
|
Show status of files in the repository. If names are given, only
|
|
|
|
files that match are shown. Files that are clean or ignored, are
|
|
|
|
not listed unless -c (clean), -i (ignored) or -A is given.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2006-12-08 22:04:10 +03:00
|
|
|
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.
|
|
|
|
|
2006-10-19 01:24:38 +04:00
|
|
|
If one revision is given, it is used as the base revision.
|
|
|
|
If two revisions are given, the difference between them is shown.
|
|
|
|
|
2005-10-25 02:52:28 +04:00
|
|
|
The codes used to show the status of files are:
|
2005-07-21 21:24:42 +04:00
|
|
|
M = modified
|
big heap of command clean-up work
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
big heap of command clean-up work
Migrate add, forget, remove, commit, diff, addremove, tip, log,
recover, and serve.
Fix up filterfiles, relfilter, and relpath to be a bit more bulletproof
Alphabetize functions and the command table
Make everything in commands.py relative-path aware
manifest hash: f0856031a7be4e49289677b467f29bcf24ebce4a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCof6gywK+sNU5EO8RAoW1AJsHu8vchPSjls7wVbvsq/UKlGhqtgCgtnnl
xSBxyf/TEVWjHIk3uTa8WSE=
=YPMl
-----END PGP SIGNATURE-----
2005-06-04 23:18:56 +04:00
|
|
|
A = added
|
|
|
|
R = removed
|
2008-01-01 02:47:02 +03:00
|
|
|
C = clean
|
2006-01-12 15:58:36 +03:00
|
|
|
! = deleted, but still tracked
|
2005-08-06 15:05:09 +04:00
|
|
|
? = not tracked
|
2006-03-30 00:58:34 +04:00
|
|
|
I = ignored (not shown by default)
|
2006-07-19 18:52:16 +04:00
|
|
|
= the previous added file was copied from here
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2005-06-12 20:11:43 +04:00
|
|
|
|
2006-07-21 03:21:07 +04:00
|
|
|
all = opts['all']
|
2006-11-23 01:02:28 +03:00
|
|
|
node1, node2 = cmdutil.revpair(repo, opts.get('rev'))
|
2006-10-01 21:26:33 +04:00
|
|
|
|
2006-08-14 03:11:22 +04:00
|
|
|
files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts)
|
2006-01-17 18:10:22 +03:00
|
|
|
cwd = (pats and repo.getcwd()) or ''
|
2006-07-21 03:21:07 +04:00
|
|
|
modified, added, removed, deleted, unknown, ignored, clean = [
|
2007-01-14 21:10:35 +03:00
|
|
|
n for n in repo.status(node1=node1, node2=node2, files=files,
|
2006-10-19 01:24:38 +04:00
|
|
|
match=matchfn,
|
2006-07-21 03:21:07 +04:00
|
|
|
list_ignored=all or opts['ignored'],
|
|
|
|
list_clean=all or opts['clean'])]
|
2005-06-01 23:48:34 +04:00
|
|
|
|
2006-07-21 03:21:07 +04:00
|
|
|
changetypes = (('modified', 'M', modified),
|
2006-03-17 20:19:05 +03:00
|
|
|
('added', 'A', added),
|
|
|
|
('removed', 'R', removed),
|
|
|
|
('deleted', '!', deleted),
|
2006-03-30 00:58:34 +04:00
|
|
|
('unknown', '?', unknown),
|
2006-07-21 03:21:07 +04:00
|
|
|
('ignored', 'I', ignored))
|
|
|
|
|
2008-01-01 02:47:02 +03:00
|
|
|
explicit_changetypes = changetypes + (('clean', 'C', clean),)
|
2005-08-06 15:05:09 +04:00
|
|
|
|
2005-08-27 12:49:41 +04:00
|
|
|
end = opts['print0'] and '\0' or '\n'
|
2005-08-28 01:25:55 +04:00
|
|
|
|
2006-07-21 03:21:07 +04:00
|
|
|
for opt, char, changes in ([ct for ct in explicit_changetypes
|
|
|
|
if all or opts[ct[0]]]
|
2005-08-06 15:05:09 +04:00
|
|
|
or changetypes):
|
2005-08-28 01:23:32 +04:00
|
|
|
if opts['no_status']:
|
2005-08-27 12:49:41 +04:00
|
|
|
format = "%%s%s" % end
|
|
|
|
else:
|
2006-03-17 20:19:05 +03:00
|
|
|
format = "%s %%s%s" % (char, end)
|
2005-08-28 01:25:55 +04:00
|
|
|
|
2005-08-06 15:05:09 +04:00
|
|
|
for f in changes:
|
2007-06-09 06:49:12 +04:00
|
|
|
ui.write(format % repo.pathto(f, cwd))
|
2006-10-05 02:59:27 +04:00
|
|
|
if ((all or opts.get('copies')) and not opts.get('no_status')):
|
2006-09-26 15:58:58 +04:00
|
|
|
copied = repo.dirstate.copied(f)
|
|
|
|
if copied:
|
2007-06-09 06:49:12 +04:00
|
|
|
ui.write(' %s%s' % (repo.pathto(copied, cwd), end))
|
2005-06-01 23:48:34 +04:00
|
|
|
|
2005-12-27 21:52:10 +03:00
|
|
|
def tag(ui, repo, name, rev_=None, **opts):
|
2006-12-17 00:58:10 +03:00
|
|
|
"""add a tag for the current or given revision
|
2005-10-25 02:52:28 +04:00
|
|
|
|
|
|
|
Name a particular revision using <name>.
|
|
|
|
|
|
|
|
Tags are used to name particular revisions of the repository and are
|
|
|
|
very useful to compare different revision, to go back to significant
|
|
|
|
earlier versions or to mark branch points as releases, etc.
|
|
|
|
|
2006-12-17 00:58:10 +03:00
|
|
|
If no revision is given, the parent of the working directory is used,
|
|
|
|
or tip if no revision is checked out.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
|
|
|
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
|
2006-01-29 07:12:31 +03:00
|
|
|
necessary. The file '.hg/localtags' is used for local tags (not
|
|
|
|
shared among repositories).
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2006-12-06 00:41:42 +03:00
|
|
|
if name in ['tip', '.', 'null']:
|
2006-08-05 01:36:03 +04:00
|
|
|
raise util.Abort(_("the name '%s' is reserved") % name)
|
2006-01-29 07:12:31 +03:00
|
|
|
if rev_ is not None:
|
|
|
|
ui.warn(_("use of 'hg tag NAME [REV]' is deprecated, "
|
2006-01-29 16:33:12 +03:00
|
|
|
"please use 'hg tag [-r REV] NAME' instead\n"))
|
2006-01-29 07:12:31 +03:00
|
|
|
if opts['rev']:
|
|
|
|
raise util.Abort(_("use only one form to specify the revision"))
|
2007-03-15 03:13:04 +03:00
|
|
|
if opts['rev'] and opts['remove']:
|
|
|
|
raise util.Abort(_("--rev and --remove are incompatible"))
|
2005-12-27 21:52:10 +03:00
|
|
|
if opts['rev']:
|
|
|
|
rev_ = opts['rev']
|
2007-03-15 03:13:04 +03:00
|
|
|
message = opts['message']
|
|
|
|
if opts['remove']:
|
2007-12-09 10:32:05 +03:00
|
|
|
tagtype = repo.tagtype(name)
|
|
|
|
|
|
|
|
if not tagtype:
|
2007-06-15 23:48:21 +04:00
|
|
|
raise util.Abort(_('tag %s does not exist') % name)
|
2007-12-09 10:32:05 +03:00
|
|
|
if opts['local'] and tagtype == 'global':
|
|
|
|
raise util.Abort(_('%s tag is global') % name)
|
|
|
|
if not opts['local'] and tagtype == 'local':
|
|
|
|
raise util.Abort(_('%s tag is local') % name)
|
|
|
|
|
2007-03-15 03:13:04 +03:00
|
|
|
rev_ = nullid
|
|
|
|
if not message:
|
|
|
|
message = _('Removed tag %s') % name
|
2007-03-23 08:12:28 +03:00
|
|
|
elif name in repo.tags() and not opts['force']:
|
|
|
|
raise util.Abort(_('a tag named %s already exists (use -f to force)')
|
|
|
|
% name)
|
2006-09-16 02:23:52 +04:00
|
|
|
if not rev_ and repo.dirstate.parents()[1] != nullid:
|
|
|
|
raise util.Abort(_('uncommitted merge - please provide a '
|
|
|
|
'specific revision'))
|
|
|
|
r = repo.changectx(rev_).node()
|
2005-07-04 23:00:25 +04:00
|
|
|
|
2006-08-21 08:52:52 +04:00
|
|
|
if not message:
|
|
|
|
message = _('Added tag %s for changeset %s') % (name, short(r))
|
2005-07-04 23:00:25 +04:00
|
|
|
|
2006-08-21 08:52:52 +04:00
|
|
|
repo.tag(name, r, message, opts['local'], opts['user'], opts['date'])
|
2005-06-22 05:47:28 +04:00
|
|
|
|
2005-06-05 01:45:31 +04:00
|
|
|
def tags(ui, repo):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""list repository tags
|
|
|
|
|
|
|
|
List the repository tags.
|
|
|
|
|
2007-12-09 11:14:38 +03:00
|
|
|
This lists both regular and local tags. When the -v/--verbose switch
|
|
|
|
is used, a third column "local" is printed for local tags.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2005-06-26 16:25:07 +04:00
|
|
|
|
2005-06-15 12:08:03 +04:00
|
|
|
l = repo.tagslist()
|
|
|
|
l.reverse()
|
2006-08-21 07:51:56 +04:00
|
|
|
hexfunc = ui.debugflag and hex or short
|
2007-12-09 11:14:38 +03:00
|
|
|
tagtype = ""
|
|
|
|
|
2005-06-26 16:25:07 +04:00
|
|
|
for t, n in l:
|
2007-12-09 11:14:38 +03:00
|
|
|
if ui.quiet:
|
|
|
|
ui.write("%s\n" % t)
|
|
|
|
continue
|
|
|
|
|
2005-06-05 01:45:31 +04:00
|
|
|
try:
|
2007-06-06 22:22:52 +04:00
|
|
|
hn = hexfunc(n)
|
2007-12-09 11:14:38 +03:00
|
|
|
r = "%5d:%s" % (repo.changelog.rev(n), hn)
|
2006-12-18 23:22:43 +03:00
|
|
|
except revlog.LookupError:
|
|
|
|
r = " ?:%s" % hn
|
2006-04-02 01:57:24 +04:00
|
|
|
else:
|
2007-03-05 21:48:21 +03:00
|
|
|
spaces = " " * (30 - util.locallen(t))
|
2007-12-09 11:14:38 +03:00
|
|
|
if ui.verbose:
|
|
|
|
if repo.tagtype(t) == 'local':
|
|
|
|
tagtype = " local"
|
|
|
|
else:
|
|
|
|
tagtype = ""
|
|
|
|
ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype))
|
2005-06-05 01:45:31 +04:00
|
|
|
|
2006-02-15 22:05:43 +03:00
|
|
|
def tip(ui, repo, **opts):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""show the tip revision
|
|
|
|
|
|
|
|
Show the tip revision.
|
|
|
|
"""
|
2006-11-16 10:51:22 +03:00
|
|
|
cmdutil.show_changeset(ui, repo, opts).show(nullrev+repo.changelog.count())
|
big heap of command clean-up work
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
big heap of command clean-up work
Migrate add, forget, remove, commit, diff, addremove, tip, log,
recover, and serve.
Fix up filterfiles, relfilter, and relpath to be a bit more bulletproof
Alphabetize functions and the command table
Make everything in commands.py relative-path aware
manifest hash: f0856031a7be4e49289677b467f29bcf24ebce4a
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCof6gywK+sNU5EO8RAoW1AJsHu8vchPSjls7wVbvsq/UKlGhqtgCgtnnl
xSBxyf/TEVWjHIk3uTa8WSE=
=YPMl
-----END PGP SIGNATURE-----
2005-06-04 23:18:56 +04:00
|
|
|
|
2007-06-24 19:08:38 +04:00
|
|
|
def unbundle(ui, repo, fname1, *fnames, **opts):
|
|
|
|
"""apply one or more changegroup files
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2007-06-24 19:08:38 +04:00
|
|
|
Apply one or more compressed changegroup files generated by the
|
|
|
|
bundle command.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2007-06-24 19:08:38 +04:00
|
|
|
fnames = (fname1,) + fnames
|
|
|
|
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)
|
|
|
|
|
2007-08-27 08:44:35 +04:00
|
|
|
return postincoming(ui, repo, modheads, opts['update'], None)
|
2005-09-08 12:27:25 +04:00
|
|
|
|
2007-05-17 21:55:24 +04:00
|
|
|
def update(ui, repo, node=None, rev=None, clean=False, date=None):
|
2006-12-29 08:37:43 +03:00
|
|
|
"""update working directory
|
2005-10-25 02:52:28 +04:00
|
|
|
|
2007-03-12 00:21:09 +03:00
|
|
|
Update the working directory to the specified revision, or the
|
|
|
|
tip of the current branch if none is specified.
|
2005-06-05 06:34:35 +04:00
|
|
|
|
|
|
|
If there are no outstanding changes in the working directory and
|
|
|
|
there is a linear relationship between the current version and the
|
|
|
|
requested version, the result is the requested version.
|
|
|
|
|
2006-05-15 08:07:34 +04:00
|
|
|
To merge the working directory with another revision, use the
|
|
|
|
merge command.
|
2005-10-25 02:52:28 +04:00
|
|
|
|
|
|
|
By default, update will refuse to run if doing so would require
|
2006-12-29 08:37:43 +03:00
|
|
|
discarding local changes.
|
2005-10-25 02:52:28 +04:00
|
|
|
"""
|
2007-05-17 21:55:24 +04:00
|
|
|
if rev and node:
|
|
|
|
raise util.Abort(_("please specify just one revision"))
|
|
|
|
|
|
|
|
if not rev:
|
|
|
|
rev = node
|
|
|
|
|
2006-12-07 02:58:09 +03:00
|
|
|
if date:
|
2007-05-17 21:55:24 +04:00
|
|
|
if rev:
|
2006-12-07 02:58:09 +03:00
|
|
|
raise util.Abort(_("you can't specify a revision and a date"))
|
2007-05-17 21:55:24 +04:00
|
|
|
rev = cmdutil.finddate(ui, repo, date)
|
2006-12-07 02:58:09 +03:00
|
|
|
|
2006-10-26 03:29:54 +04:00
|
|
|
if clean:
|
2007-05-17 21:55:24 +04:00
|
|
|
return hg.clean(repo, rev)
|
2006-08-08 07:54:33 +04:00
|
|
|
else:
|
2007-05-17 21:55:24 +04:00
|
|
|
return hg.update(repo, rev)
|
2006-05-15 08:07:34 +04:00
|
|
|
|
2005-06-05 00:24:23 +04:00
|
|
|
def verify(ui, repo):
|
2005-10-25 02:52:28 +04:00
|
|
|
"""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.
|
|
|
|
"""
|
2006-08-08 01:27:09 +04:00
|
|
|
return hg.verify(repo)
|
2005-06-05 00:24:23 +04:00
|
|
|
|
2006-11-16 00:51:58 +03:00
|
|
|
def version_(ui):
|
|
|
|
"""output version and copyright information"""
|
|
|
|
ui.write(_("Mercurial Distributed SCM (version %s)\n")
|
|
|
|
% version.get_version())
|
|
|
|
ui.status(_(
|
2007-06-19 10:51:34 +04:00
|
|
|
"\nCopyright (C) 2005-2007 Matt Mackall <mpm@selenic.com> and others\n"
|
2006-11-16 00:51:58 +03:00
|
|
|
"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"
|
|
|
|
))
|
|
|
|
|
2005-06-05 07:09:00 +04:00
|
|
|
# Command options and aliases are listed here, alphabetically
|
|
|
|
|
2006-09-29 20:39:08 +04:00
|
|
|
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')),
|
2006-12-04 01:16:33 +03:00
|
|
|
('', 'encoding', util._encoding, _('set the charset encoding')),
|
|
|
|
('', 'encodingmode', util._encodingmode, _('set the charset encoding mode')),
|
2006-09-29 20:39:08 +04:00
|
|
|
('', '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')),
|
|
|
|
]
|
|
|
|
|
2006-09-29 20:39:49 +04:00
|
|
|
dryrunopts = [('n', 'dry-run', None,
|
|
|
|
_('do not perform actions, just print output'))]
|
|
|
|
|
2006-09-29 21:59:06 +04:00
|
|
|
remoteopts = [
|
|
|
|
('e', 'ssh', '', _('specify ssh command to use')),
|
|
|
|
('', 'remotecmd', '', _('specify hg command to run on the remote side')),
|
|
|
|
]
|
|
|
|
|
2006-09-29 20:39:32 +04:00
|
|
|
walkopts = [
|
|
|
|
('I', 'include', [], _('include names matching the given patterns')),
|
|
|
|
('X', 'exclude', [], _('exclude names matching the given patterns')),
|
|
|
|
]
|
|
|
|
|
2006-11-21 01:37:21 +03:00
|
|
|
commitopts = [
|
|
|
|
('m', 'message', '', _('use <text> as commit message')),
|
|
|
|
('l', 'logfile', '', _('read commit message from <file>')),
|
|
|
|
]
|
|
|
|
|
2007-08-08 14:27:20 +04:00
|
|
|
commitopts2 = [
|
|
|
|
('d', 'date', '', _('record datecode as commit date')),
|
|
|
|
('u', 'user', '', _('record user as committer')),
|
|
|
|
]
|
|
|
|
|
2005-06-01 12:25:42 +04:00
|
|
|
table = {
|
2006-12-07 13:22:17 +03:00
|
|
|
"^add": (add, walkopts + dryrunopts, _('hg add [OPTION]... [FILE]...')),
|
2006-07-23 20:04:14 +04:00
|
|
|
"addremove":
|
2005-08-06 10:16:37 +04:00
|
|
|
(addremove,
|
2006-09-29 20:39:32 +04:00
|
|
|
[('s', 'similarity', '',
|
2006-09-29 20:39:49 +04:00
|
|
|
_('guess renamed files by similarity (0<=s<=100)')),
|
|
|
|
] + walkopts + dryrunopts,
|
2006-01-12 09:57:58 +03:00
|
|
|
_('hg addremove [OPTION]... [FILE]...')),
|
2005-07-14 13:42:28 +04:00
|
|
|
"^annotate":
|
|
|
|
(annotate,
|
2005-10-25 02:52:28 +04:00
|
|
|
[('r', 'rev', '', _('annotate the specified revision')),
|
2006-09-27 20:10:21 +04:00
|
|
|
('f', 'follow', None, _('follow file copies and renames')),
|
2005-10-19 05:38:39 +04:00
|
|
|
('a', 'text', None, _('treat all files as text')),
|
2005-10-25 02:52:28 +04:00
|
|
|
('u', 'user', None, _('list the author')),
|
2005-11-10 00:39:24 +03:00
|
|
|
('d', 'date', None, _('list the date')),
|
2005-10-25 02:52:28 +04:00
|
|
|
('n', 'number', None, _('list the revision number (default)')),
|
|
|
|
('c', 'changeset', None, _('list the changeset')),
|
2007-07-08 21:59:02 +04:00
|
|
|
('l', 'line-number', None,
|
|
|
|
_('show line number at the first appearance'))
|
2006-09-29 20:39:32 +04:00
|
|
|
] + walkopts,
|
2007-07-08 21:59:02 +04:00
|
|
|
_('hg annotate [-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...')),
|
2006-04-30 20:46:49 +04:00
|
|
|
"archive":
|
2006-04-22 02:27:57 +04:00
|
|
|
(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')),
|
2006-09-29 20:39:32 +04:00
|
|
|
] + walkopts,
|
2006-04-22 02:27:57 +04:00
|
|
|
_('hg archive [OPTION]... DEST')),
|
2006-04-30 20:40:30 +04:00
|
|
|
"backout":
|
2006-04-30 07:56:46 +04:00
|
|
|
(backout,
|
2006-04-30 20:40:30 +04:00
|
|
|
[('', 'merge', None,
|
|
|
|
_('merge with old dirstate parent after backout')),
|
2006-07-15 10:19:15 +04:00
|
|
|
('', 'parent', '', _('parent to choose when backing out merge')),
|
2007-05-17 21:55:24 +04:00
|
|
|
('r', 'rev', '', _('revision to backout')),
|
2007-08-08 14:27:20 +04:00
|
|
|
] + walkopts + commitopts + commitopts2,
|
2007-05-17 21:55:24 +04:00
|
|
|
_('hg backout [OPTION]... [-r] REV')),
|
2008-01-01 13:19:15 +03:00
|
|
|
"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]")),
|
2007-06-27 00:38:57 +04:00
|
|
|
"branch":
|
|
|
|
(branch,
|
|
|
|
[('f', 'force', None,
|
|
|
|
_('set branch name even if it shadows an existing branch'))],
|
2008-01-01 13:19:15 +03:00
|
|
|
_('hg branch [-f] [NAME]')),
|
2007-06-27 00:38:57 +04:00
|
|
|
"branches":
|
|
|
|
(branches,
|
|
|
|
[('a', 'active', False,
|
|
|
|
_('show only branches that have unmerged heads'))],
|
|
|
|
_('hg branches [-a]')),
|
2005-09-08 12:27:25 +04:00
|
|
|
"bundle":
|
|
|
|
(bundle,
|
2006-03-15 09:58:14 +03:00
|
|
|
[('f', 'force', None,
|
2006-09-29 22:00:24 +04:00
|
|
|
_('run even when remote repository is unrelated')),
|
2006-07-20 21:25:11 +04:00
|
|
|
('r', 'rev', [],
|
|
|
|
_('a changeset you would like to bundle')),
|
|
|
|
('', 'base', [],
|
|
|
|
_('a base changeset to specify instead of a destination')),
|
2006-09-29 22:00:24 +04:00
|
|
|
] + remoteopts,
|
2006-12-14 21:30:18 +03:00
|
|
|
_('hg bundle [-f] [-r REV]... [--base REV]... FILE [DEST]')),
|
2005-07-14 13:42:28 +04:00
|
|
|
"cat":
|
|
|
|
(cat,
|
2006-03-01 11:08:56 +03:00
|
|
|
[('o', 'output', '', _('print output to file with formatted name')),
|
|
|
|
('r', 'rev', '', _('print the given revision')),
|
2006-09-29 20:39:32 +04:00
|
|
|
] + walkopts,
|
2005-10-19 05:38:39 +04:00
|
|
|
_('hg cat [OPTION]... FILE...')),
|
2005-07-14 13:42:28 +04:00
|
|
|
"^clone":
|
|
|
|
(clone,
|
2005-10-25 02:52:28 +04:00
|
|
|
[('U', 'noupdate', None, _('do not update the new working directory')),
|
2005-12-28 09:27:05 +03:00
|
|
|
('r', 'rev', [],
|
|
|
|
_('a changeset you would like to have after cloning')),
|
2006-03-01 11:08:56 +03:00
|
|
|
('', 'pull', None, _('use pull protocol to copy metadata')),
|
2006-07-16 03:06:05 +04:00
|
|
|
('', 'uncompressed', None,
|
|
|
|
_('use uncompressed transfer (fast over LAN)')),
|
2006-09-29 21:59:06 +04:00
|
|
|
] + remoteopts,
|
2005-10-19 05:38:39 +04:00
|
|
|
_('hg clone [OPTION]... SOURCE [DEST]')),
|
2005-07-14 13:42:28 +04:00
|
|
|
"^commit|ci":
|
|
|
|
(commit,
|
2006-05-03 12:53:51 +04:00
|
|
|
[('A', 'addremove', None,
|
|
|
|
_('mark new/missing files as added/removed before committing')),
|
2007-08-08 14:27:20 +04:00
|
|
|
] + walkopts + commitopts + commitopts2,
|
2005-10-19 05:38:39 +04:00
|
|
|
_('hg commit [OPTION]... [FILE]...')),
|
2006-01-12 09:57:58 +03:00
|
|
|
"copy|cp":
|
|
|
|
(copy,
|
2006-03-01 11:08:56 +03:00
|
|
|
[('A', 'after', None, _('record a copy that has already occurred')),
|
2006-01-12 09:57:58 +03:00
|
|
|
('f', 'force', None,
|
2006-03-01 11:08:56 +03:00
|
|
|
_('forcibly copy over an existing managed file')),
|
2006-09-29 20:39:49 +04:00
|
|
|
] + walkopts + dryrunopts,
|
2006-01-12 09:57:58 +03:00
|
|
|
_('hg copy [OPTION]... [SOURCE]... DEST')),
|
2008-01-01 21:20:03 +03:00
|
|
|
"debugancestor": (debugancestor, [], _('hg debugancestor INDEX REV1 REV2')),
|
|
|
|
"debugcheckstate": (debugcheckstate, [], _('hg debugcheckstate')),
|
2006-04-02 00:50:12 +04:00
|
|
|
"debugcomplete":
|
|
|
|
(debugcomplete,
|
|
|
|
[('o', 'options', None, _('show the command options'))],
|
2008-01-01 21:20:03 +03:00
|
|
|
_('hg debugcomplete [-o] CMD')),
|
2006-12-07 13:22:17 +03:00
|
|
|
"debugdate":
|
|
|
|
(debugdate,
|
|
|
|
[('e', 'extended', None, _('try extended date formats'))],
|
2008-01-01 21:20:03 +03:00
|
|
|
_('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]...')),
|
|
|
|
"debugrebuildstate":
|
|
|
|
(debugrebuildstate,
|
|
|
|
[('r', 'rev', '', _('revision to rebuild to'))],
|
|
|
|
_('hg debugrebuildstate [-r REV] [REV]')),
|
2007-06-27 00:38:57 +04:00
|
|
|
"debugrename":
|
|
|
|
(debugrename,
|
|
|
|
[('r', 'rev', '', _('revision to debug'))],
|
2008-01-01 21:20:03 +03:00
|
|
|
_('hg debugrename [-r REV] FILE')),
|
|
|
|
"debugsetparents":
|
|
|
|
(debugsetparents,
|
|
|
|
[],
|
|
|
|
_('hg debugsetparents REV1 [REV2]')),
|
|
|
|
"debugstate": (debugstate, [], _('hg debugstate')),
|
|
|
|
"debugwalk": (debugwalk, walkopts, _('hg debugwalk [OPTION]... [FILE]...')),
|
2005-07-14 13:42:28 +04:00
|
|
|
"^diff":
|
|
|
|
(diff,
|
2005-10-19 05:38:39 +04:00
|
|
|
[('r', 'rev', [], _('revision')),
|
|
|
|
('a', 'text', None, _('treat all files as text')),
|
2006-02-15 21:39:47 +03:00
|
|
|
('p', 'show-function', None,
|
|
|
|
_('show which function each change is in')),
|
2006-08-15 09:48:03 +04:00
|
|
|
('g', 'git', None, _('use git extended diff format')),
|
2006-09-29 00:00:01 +04:00
|
|
|
('', 'nodates', None, _("don't include dates in diff headers")),
|
2006-02-15 21:39:47 +03:00
|
|
|
('w', 'ignore-all-space', None,
|
|
|
|
_('ignore white space when comparing lines')),
|
2006-06-29 17:16:25 +04:00
|
|
|
('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')),
|
2006-09-29 20:39:32 +04:00
|
|
|
] + walkopts,
|
2006-12-14 21:30:18 +03:00
|
|
|
_('hg diff [OPTION]... [-r REV1 [-r REV2]] [FILE]...')),
|
2005-07-14 13:42:28 +04:00
|
|
|
"^export":
|
|
|
|
(export,
|
2006-01-12 09:57:58 +03:00
|
|
|
[('o', 'output', '', _('print output to file with formatted name')),
|
2005-12-15 06:01:57 +03:00
|
|
|
('a', 'text', None, _('treat all files as text')),
|
2006-08-30 21:08:56 +04:00
|
|
|
('g', 'git', None, _('use git extended diff format')),
|
2006-09-29 00:00:01 +04:00
|
|
|
('', 'nodates', None, _("don't include dates in diff headers")),
|
2005-12-15 06:01:57 +03:00
|
|
|
('', 'switch-parent', None, _('diff against the second parent'))],
|
2006-12-14 21:30:18 +03:00
|
|
|
_('hg export [OPTION]... [-o OUTFILESPEC] REV...')),
|
2005-08-26 17:19:18 +04:00
|
|
|
"grep":
|
|
|
|
(grep,
|
2005-10-19 05:38:39 +04:00
|
|
|
[('0', 'print0', None, _('end fields with NUL')),
|
2005-10-25 02:52:28 +04:00
|
|
|
('', 'all', None, _('print all revisions that match')),
|
2006-08-13 02:01:46 +04:00
|
|
|
('f', 'follow', None,
|
|
|
|
_('follow changeset history, or file history across copies and renames')),
|
2005-10-19 05:38:39 +04:00
|
|
|
('i', 'ignore-case', None, _('ignore case when matching')),
|
2005-12-28 09:27:05 +03:00
|
|
|
('l', 'files-with-matches', None,
|
|
|
|
_('print only filenames and revs that match')),
|
2005-10-25 02:52:28 +04:00
|
|
|
('n', 'line-number', None, _('print matching line numbers')),
|
|
|
|
('r', 'rev', [], _('search in given revision range')),
|
2006-03-01 11:08:56 +03:00
|
|
|
('u', 'user', None, _('print user who committed change')),
|
2006-09-29 20:39:32 +04:00
|
|
|
] + walkopts,
|
2006-01-12 09:57:58 +03:00
|
|
|
_('hg grep [OPTION]... PATTERN [FILE]...')),
|
2005-08-15 08:22:40 +04:00
|
|
|
"heads":
|
|
|
|
(heads,
|
2006-12-13 03:16:23 +03:00
|
|
|
[('', 'style', '', _('display using template map file')),
|
2006-02-28 00:18:57 +03:00
|
|
|
('r', 'rev', '', _('show only heads which are descendants of rev')),
|
2006-03-04 23:40:10 +03:00
|
|
|
('', 'template', '', _('display with template'))],
|
2007-06-19 19:37:43 +04:00
|
|
|
_('hg heads [-r REV] [REV]...')),
|
2005-10-19 05:38:39 +04:00
|
|
|
"help": (help_, [], _('hg help [COMMAND]')),
|
2007-06-21 20:54:11 +04:00
|
|
|
"identify|id":
|
|
|
|
(identify,
|
2007-06-21 20:54:13 +04:00
|
|
|
[('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'))],
|
2007-06-21 22:09:01 +04:00
|
|
|
_('hg identify [-nibt] [-r REV] [SOURCE]')),
|
2005-07-14 13:42:28 +04:00
|
|
|
"import|patch":
|
|
|
|
(import_,
|
2005-12-28 09:27:05 +03:00
|
|
|
[('p', 'strip', 1,
|
2006-04-25 11:00:09 +04:00
|
|
|
_('directory strip option for patch. This has the same\n'
|
|
|
|
'meaning as the corresponding patch option')),
|
2006-12-13 03:16:23 +03:00
|
|
|
('b', 'base', '', _('base path')),
|
2005-12-28 09:27:05 +03:00
|
|
|
('f', 'force', None,
|
2007-03-22 20:44:59 +03:00
|
|
|
_('skip check for outstanding uncommitted changes')),
|
2008-01-25 15:48:35 +03:00
|
|
|
('', 'no-commit', None, _("don't commit, just update the working directory")),
|
2007-03-22 20:44:59 +03:00
|
|
|
('', 'exact', None,
|
2007-06-14 20:01:51 +04:00
|
|
|
_('apply patch to the nodes from which it was generated')),
|
|
|
|
('', 'import-branch', None,
|
2008-01-26 03:49:15 +03:00
|
|
|
_('Use any branch information in patch (implied by --exact)'))] +
|
|
|
|
commitopts + commitopts2,
|
|
|
|
_('hg import [OPTION]... PATCH...')),
|
2008-01-01 13:19:15 +03:00
|
|
|
"incoming|in":
|
|
|
|
(incoming,
|
2006-01-12 09:57:58 +03:00
|
|
|
[('M', 'no-merges', None, _('do not show merges')),
|
2006-03-15 09:58:14 +03:00
|
|
|
('f', 'force', None,
|
|
|
|
_('run even when remote repository is unrelated')),
|
2006-03-04 23:40:10 +03:00
|
|
|
('', 'style', '', _('display using template map file')),
|
2006-02-28 00:18:57 +03:00
|
|
|
('n', 'newest-first', None, _('show newest record first')),
|
2006-03-13 05:54:23 +03:00
|
|
|
('', 'bundle', '', _('file to store the bundles into')),
|
2005-10-25 03:59:31 +04:00
|
|
|
('p', 'patch', None, _('show patch')),
|
2006-08-13 19:35:24 +04:00
|
|
|
('r', 'rev', [], _('a specific revision up to which you would like to pull')),
|
2006-03-16 08:58:15 +03:00
|
|
|
('', 'template', '', _('display with template')),
|
2006-09-29 21:59:06 +04:00
|
|
|
] + remoteopts,
|
2006-12-14 21:30:18 +03:00
|
|
|
_('hg incoming [-p] [-n] [-M] [-f] [-r REV]...'
|
2006-06-30 23:57:57 +04:00
|
|
|
' [--bundle FILENAME] [SOURCE]')),
|
2006-07-12 10:57:18 +04:00
|
|
|
"^init":
|
2006-12-14 21:30:18 +03:00
|
|
|
(init,
|
|
|
|
remoteopts,
|
|
|
|
_('hg init [-e CMD] [--remotecmd CMD] [DEST]')),
|
2005-07-14 13:42:28 +04:00
|
|
|
"locate":
|
|
|
|
(locate,
|
2005-10-25 02:52:28 +04:00
|
|
|
[('r', 'rev', '', _('search the repository as it stood at rev')),
|
2005-12-28 09:27:05 +03:00
|
|
|
('0', 'print0', None,
|
|
|
|
_('end filenames with NUL, for use with xargs')),
|
|
|
|
('f', 'fullpath', None,
|
|
|
|
_('print complete paths from the filesystem root')),
|
2006-09-29 20:39:32 +04:00
|
|
|
] + walkopts,
|
2005-10-19 05:38:39 +04:00
|
|
|
_('hg locate [OPTION]... [PATTERN]...')),
|
2005-07-14 13:42:28 +04:00
|
|
|
"^log|history":
|
|
|
|
(log,
|
2006-12-13 03:16:23 +03:00
|
|
|
[('f', 'follow', None,
|
2006-08-03 22:06:09 +04:00
|
|
|
_('follow changeset history, or file history across copies and renames')),
|
2006-08-03 22:48:56 +04:00
|
|
|
('', 'follow-first', None,
|
|
|
|
_('only follow the first parent of merge changesets')),
|
2006-12-07 00:29:17 +03:00
|
|
|
('d', 'date', '', _('show revs matching date spec')),
|
2006-09-30 00:01:19 +04:00
|
|
|
('C', 'copies', None, _('show copied files')),
|
2007-03-29 19:25:19 +04:00
|
|
|
('k', 'keyword', [], _('do case-insensitive search for a keyword')),
|
2006-02-20 22:06:41 +03:00
|
|
|
('l', 'limit', '', _('limit number of changes displayed')),
|
2005-10-25 02:52:28 +04:00
|
|
|
('r', 'rev', [], _('show the specified revision or range')),
|
2006-11-16 00:51:58 +03:00
|
|
|
('', 'removed', None, _('include revs where files were removed')),
|
2006-01-12 09:57:58 +03:00
|
|
|
('M', 'no-merges', None, _('do not show merges')),
|
2006-03-04 23:40:10 +03:00
|
|
|
('', 'style', '', _('display using template map file')),
|
2006-01-12 09:57:58 +03:00
|
|
|
('m', 'only-merges', None, _('show only merges')),
|
2006-02-28 00:18:57 +03:00
|
|
|
('p', 'patch', None, _('show patch')),
|
2006-08-14 21:27:02 +04:00
|
|
|
('P', 'prune', [], _('do not display revision or any of its ancestors')),
|
2006-03-13 03:21:59 +03:00
|
|
|
('', 'template', '', _('display with template')),
|
2006-09-29 20:39:32 +04:00
|
|
|
] + walkopts,
|
2006-03-01 11:08:56 +03:00
|
|
|
_('hg log [OPTION]... [FILE]')),
|
2008-01-01 13:19:15 +03:00
|
|
|
"manifest":
|
|
|
|
(manifest,
|
|
|
|
[('r', 'rev', '', _('revision to display'))],
|
|
|
|
_('hg manifest [-r REV]')),
|
2006-12-29 08:37:43 +03:00
|
|
|
"^merge":
|
2006-04-03 23:38:59 +04:00
|
|
|
(merge,
|
2007-05-17 21:55:24 +04:00
|
|
|
[('f', 'force', None, _('force a merge with outstanding changes')),
|
|
|
|
('r', 'rev', '', _('revision to merge')),
|
|
|
|
],
|
|
|
|
_('hg merge [-f] [[-r] REV]')),
|
2008-01-01 13:19:15 +03:00
|
|
|
"outgoing|out":
|
|
|
|
(outgoing,
|
2006-01-12 09:57:58 +03:00
|
|
|
[('M', 'no-merges', None, _('do not show merges')),
|
2006-03-15 09:58:14 +03:00
|
|
|
('f', 'force', None,
|
|
|
|
_('run even when remote repository is unrelated')),
|
2005-10-25 03:59:31 +04:00
|
|
|
('p', 'patch', None, _('show patch')),
|
2006-03-04 23:40:10 +03:00
|
|
|
('', 'style', '', _('display using template map file')),
|
2006-06-30 18:16:35 +04:00
|
|
|
('r', 'rev', [], _('a specific revision you would like to push')),
|
2006-02-28 00:18:57 +03:00
|
|
|
('n', 'newest-first', None, _('show newest record first')),
|
2006-03-16 08:58:15 +03:00
|
|
|
('', 'template', '', _('display with template')),
|
2006-09-29 21:59:06 +04:00
|
|
|
] + remoteopts,
|
2006-12-14 21:30:18 +03:00
|
|
|
_('hg outgoing [-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
|
2006-02-16 00:21:20 +03:00
|
|
|
"^parents":
|
|
|
|
(parents,
|
2006-12-13 03:16:23 +03:00
|
|
|
[('r', 'rev', '', _('show parents from the specified rev')),
|
2006-03-04 23:40:10 +03:00
|
|
|
('', 'style', '', _('display using template map file')),
|
|
|
|
('', 'template', '', _('display with template'))],
|
2006-10-25 02:22:07 +04:00
|
|
|
_('hg parents [-r REV] [FILE]')),
|
2005-10-19 05:38:39 +04:00
|
|
|
"paths": (paths, [], _('hg paths [NAME]')),
|
2005-07-14 13:42:28 +04:00
|
|
|
"^pull":
|
|
|
|
(pull,
|
2005-12-28 09:27:05 +03:00
|
|
|
[('u', 'update', None,
|
2006-09-30 01:14:22 +04:00
|
|
|
_('update to new tip if changesets were pulled')),
|
2006-03-15 09:58:14 +03:00
|
|
|
('f', 'force', None,
|
|
|
|
_('run even when remote repository is unrelated')),
|
2006-12-14 21:30:18 +03:00
|
|
|
('r', 'rev', [],
|
|
|
|
_('a specific revision up to which you would like to pull')),
|
2006-09-29 21:59:06 +04:00
|
|
|
] + remoteopts,
|
2006-12-14 21:30:18 +03:00
|
|
|
_('hg pull [-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')),
|
2005-08-02 11:34:23 +04:00
|
|
|
"^push":
|
|
|
|
(push,
|
2005-10-19 05:38:39 +04:00
|
|
|
[('f', 'force', None, _('force push')),
|
2006-02-14 23:11:57 +03:00
|
|
|
('r', 'rev', [], _('a specific revision you would like to push')),
|
2006-09-29 21:59:06 +04:00
|
|
|
] + remoteopts,
|
2006-12-14 21:30:18 +03:00
|
|
|
_('hg push [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')),
|
2006-01-12 09:57:58 +03:00
|
|
|
"recover": (recover, [], _('hg recover')),
|
|
|
|
"^remove|rm":
|
|
|
|
(remove,
|
2007-11-09 19:45:58 +03:00
|
|
|
[('A', 'after', None, _('record remove without deleting')),
|
2006-05-03 08:44:24 +04:00
|
|
|
('f', 'force', None, _('remove file even if modified')),
|
2006-09-29 20:39:32 +04:00
|
|
|
] + walkopts,
|
2006-01-12 09:57:58 +03:00
|
|
|
_('hg remove [OPTION]... FILE...')),
|
|
|
|
"rename|mv":
|
|
|
|
(rename,
|
2006-03-01 11:08:56 +03:00
|
|
|
[('A', 'after', None, _('record a rename that has already occurred')),
|
2006-01-12 09:57:58 +03:00
|
|
|
('f', 'force', None,
|
2006-03-01 11:08:56 +03:00
|
|
|
_('forcibly copy over an existing managed file')),
|
2006-09-29 20:39:49 +04:00
|
|
|
] + walkopts + dryrunopts,
|
2006-03-09 10:27:49 +03:00
|
|
|
_('hg rename [OPTION]... SOURCE... DEST')),
|
2007-12-03 00:25:37 +03:00
|
|
|
"revert":
|
2005-07-14 13:42:28 +04:00
|
|
|
(revert,
|
2006-08-21 22:05:43 +04:00
|
|
|
[('a', 'all', None, _('revert all changes when no arguments given')),
|
2006-12-07 02:58:09 +03:00
|
|
|
('d', 'date', '', _('tipmost revision matching date')),
|
2006-08-21 20:44:52 +04:00
|
|
|
('r', 'rev', '', _('revision to revert to')),
|
2006-03-31 22:37:25 +04:00
|
|
|
('', 'no-backup', None, _('do not save backup copies of files')),
|
2006-09-29 20:39:49 +04:00
|
|
|
] + walkopts + dryrunopts,
|
2006-12-14 21:30:18 +03:00
|
|
|
_('hg revert [OPTION]... [-r REV] [NAME]...')),
|
2006-05-09 01:19:05 +04:00
|
|
|
"rollback": (rollback, [], _('hg rollback')),
|
2006-01-12 09:57:58 +03:00
|
|
|
"root": (root, [], _('hg root')),
|
2005-07-14 13:42:28 +04:00
|
|
|
"^serve":
|
|
|
|
(serve,
|
2005-10-25 02:52:28 +04:00
|
|
|
[('A', 'accesslog', '', _('name of access log file to write to')),
|
2006-02-18 03:29:30 +03:00
|
|
|
('d', 'daemon', None, _('run server in background')),
|
2006-02-18 07:40:08 +03:00
|
|
|
('', 'daemon-pipefds', '', _('used internally by daemon mode')),
|
2005-10-25 02:52:28 +04:00
|
|
|
('E', 'errorlog', '', _('name of error log file to write to')),
|
|
|
|
('p', 'port', 0, _('port to use (default: 8000)')),
|
|
|
|
('a', 'address', '', _('address to use')),
|
2008-01-09 13:15:00 +03:00
|
|
|
('', 'prefix', '', _('prefix path to serve from (default: server root)')),
|
2006-01-12 09:57:58 +03:00
|
|
|
('n', 'name', '',
|
2005-12-28 09:27:05 +03:00
|
|
|
_('name to show in web pages (default: working dir)')),
|
2006-04-25 02:43:40 +04:00
|
|
|
('', 'webdir-conf', '', _('name of the webdir config file'
|
|
|
|
' (serve more than one repo)')),
|
2006-02-18 03:29:30 +03:00
|
|
|
('', 'pid-file', '', _('name of file to write process ID to')),
|
2005-10-19 05:38:39 +04:00
|
|
|
('', 'stdio', None, _('for remote clients')),
|
2006-01-12 09:57:58 +03:00
|
|
|
('t', 'templates', '', _('web templates to use')),
|
|
|
|
('', 'style', '', _('template style to use')),
|
2007-07-10 09:12:28 +04:00
|
|
|
('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
|
|
|
|
('', 'certificate', '', _('SSL certificate file'))],
|
2006-01-12 09:57:58 +03:00
|
|
|
_('hg serve [OPTION]...')),
|
2008-01-01 21:20:03 +03:00
|
|
|
"showconfig|debugconfig":
|
|
|
|
(showconfig,
|
|
|
|
[('u', 'untrusted', None, _('show untrusted configuration options'))],
|
|
|
|
_('hg showconfig [-u] [NAME]...')),
|
2005-11-04 21:24:05 +03:00
|
|
|
"^status|st":
|
2005-08-06 10:09:10 +04:00
|
|
|
(status,
|
2006-07-21 03:21:07 +04:00
|
|
|
[('A', 'all', None, _('show status of all files')),
|
|
|
|
('m', 'modified', None, _('show only modified files')),
|
2005-10-19 05:38:39 +04:00
|
|
|
('a', 'added', None, _('show only added files')),
|
|
|
|
('r', 'removed', None, _('show only removed files')),
|
2006-01-12 15:58:36 +03:00
|
|
|
('d', 'deleted', None, _('show only deleted (but tracked) files')),
|
2006-07-21 03:21:07 +04:00
|
|
|
('c', 'clean', None, _('show only files without changes')),
|
2005-10-19 05:38:39 +04:00
|
|
|
('u', 'unknown', None, _('show only unknown (not tracked) files')),
|
2007-03-06 14:52:07 +03:00
|
|
|
('i', 'ignored', None, _('show only ignored files')),
|
2005-10-19 05:38:39 +04:00
|
|
|
('n', 'no-status', None, _('hide status prefix')),
|
2006-07-19 18:52:16 +04:00
|
|
|
('C', 'copies', None, _('show source of copied files')),
|
2005-12-28 09:27:05 +03:00
|
|
|
('0', 'print0', None,
|
|
|
|
_('end filenames with NUL, for use with xargs')),
|
2006-10-19 01:24:38 +04:00
|
|
|
('', 'rev', [], _('show difference from revision')),
|
2006-09-29 20:39:32 +04:00
|
|
|
] + walkopts,
|
2006-01-12 09:57:58 +03:00
|
|
|
_('hg status [OPTION]... [FILE]...')),
|
2005-07-14 13:42:28 +04:00
|
|
|
"tag":
|
|
|
|
(tag,
|
2007-03-23 08:12:28 +03:00
|
|
|
[('f', 'force', None, _('replace existing tag')),
|
|
|
|
('l', 'local', None, _('make the tag local')),
|
2007-03-15 03:13:04 +03:00
|
|
|
('r', 'rev', '', _('revision to tag')),
|
2007-08-08 14:27:20 +04:00
|
|
|
('', 'remove', None, _('remove a tag')),
|
|
|
|
# -l/--local is already there, commitopts cannot be used
|
|
|
|
('m', 'message', '', _('use <text> as commit message')),
|
|
|
|
] + commitopts2,
|
2006-03-01 00:50:49 +03:00
|
|
|
_('hg tag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME')),
|
2005-10-19 05:38:39 +04:00
|
|
|
"tags": (tags, [], _('hg tags')),
|
2006-02-21 14:59:16 +03:00
|
|
|
"tip":
|
|
|
|
(tip,
|
2006-12-13 03:16:23 +03:00
|
|
|
[('', 'style', '', _('display using template map file')),
|
2006-02-28 00:18:57 +03:00
|
|
|
('p', 'patch', None, _('show patch')),
|
2006-03-04 23:40:10 +03:00
|
|
|
('', 'template', '', _('display with template'))],
|
2006-10-25 02:22:07 +04:00
|
|
|
_('hg tip [-p]')),
|
2005-09-08 12:27:25 +04:00
|
|
|
"unbundle":
|
|
|
|
(unbundle,
|
2005-12-28 01:18:00 +03:00
|
|
|
[('u', 'update', None,
|
2006-09-30 01:14:22 +04:00
|
|
|
_('update to new tip if changesets were unbundled'))],
|
2007-06-24 19:08:38 +04:00
|
|
|
_('hg unbundle [-u] FILE...')),
|
2005-07-03 15:58:05 +04:00
|
|
|
"^update|up|checkout|co":
|
2005-07-14 13:42:28 +04:00
|
|
|
(update,
|
2006-12-13 03:16:23 +03:00
|
|
|
[('C', 'clean', None, _('overwrite locally modified files')),
|
2007-05-17 21:55:24 +04:00
|
|
|
('d', 'date', '', _('tipmost revision matching date')),
|
|
|
|
('r', 'rev', '', _('revision'))],
|
|
|
|
_('hg update [-C] [-d DATE] [[-r] REV]')),
|
2005-10-19 05:38:39 +04:00
|
|
|
"verify": (verify, [], _('hg verify')),
|
2006-11-16 00:51:58 +03:00
|
|
|
"version": (version_, [], _('hg version')),
|
2005-08-25 20:35:35 +04:00
|
|
|
}
|
|
|
|
|
2006-03-12 13:32:03 +03:00
|
|
|
norepo = ("clone init version help debugancestor debugcomplete debugdata"
|
2007-12-28 08:55:40 +03:00
|
|
|
" debugindex debugindexdot debugdate debuginstall debugfsinfo")
|
2007-09-25 02:00:11 +04:00
|
|
|
optionalrepo = ("identify paths serve showconfig")
|