Merge with crew-stable.
--- a/mercurial/commands.py Thu Apr 05 15:20:42 2007 -0700
+++ b/mercurial/commands.py Sat Apr 07 04:45:27 2007 -0300
@@ -1268,6 +1268,23 @@
commands it provides."""
option_lists = []
+ 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, ()))
+
def helpcmd(name):
if with_version:
version_(ui)
@@ -1291,7 +1308,9 @@
# options
if i[1]:
- option_lists.append(("options", i[1]))
+ option_lists.append((_("options:\n"), i[1]))
+
+ addglobalopts(False)
def helplist(select=None):
h = {}
@@ -1321,6 +1340,9 @@
else:
ui.write(' %-*s %s\n' % (m, f, h[f]))
+ if not ui.quiet:
+ addglobalopts(True)
+
def helptopic(name):
v = None
for i in help.helptable:
@@ -1360,12 +1382,7 @@
ui.status(_('no commands defined\n'))
return
- if ui.verbose:
- ui.status(_('list of commands:\n\n'))
- else:
- ui.status(_('list of commands (use "hg help -v %s" '
- 'to show aliases and global options):\n\n') % name)
-
+ ui.status(_('list of commands:\n\n'))
modcmds = dict.fromkeys([c.split('|', 1)[0] for c in ct])
helplist(modcmds.has_key)
@@ -1391,24 +1408,16 @@
# list of commands
if name == "shortlist":
- ui.status(_('basic commands (use "hg help" '
- 'for the full list or option "-v" for details):\n\n'))
- elif ui.verbose:
+ ui.status(_('basic commands:\n\n'))
+ else:
ui.status(_('list of commands:\n\n'))
- else:
- ui.status(_('list of commands (use "hg help -v" '
- 'to show aliases and global options):\n\n'))
helplist()
- # global options
- if ui.verbose:
- option_lists.append(("global options", globalopts))
-
# list all option lists
opt_output = []
for title, options in option_lists:
- opt_output.append(("\n%s:\n" % title, None))
+ opt_output.append(("\n%s" % title, None))
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,
@@ -1419,7 +1428,7 @@
or "")))
if opt_output:
- opts_len = max([len(line[0]) for line in opt_output if line[1]])
+ opts_len = max([len(line[0]) for line in opt_output if line[1]] or [0])
for first, second in opt_output:
if second:
ui.write(" %-*s %s\n" % (opts_len, first, second))
@@ -1775,7 +1784,7 @@
for k in [kw.lower() for kw in opts['keyword']]:
if not (k in changes[1].lower() or
k in changes[4].lower() or
- k in " ".join(changes[3][:20]).lower()):
+ k in " ".join(changes[3]).lower()):
miss = 1
break
if miss:
@@ -2845,7 +2854,7 @@
_('only follow the first parent of merge changesets')),
('d', 'date', '', _('show revs matching date spec')),
('C', 'copies', None, _('show copied files')),
- ('k', 'keyword', [], _('search for a keyword')),
+ ('k', 'keyword', [], _('do case-insensitive search for a keyword')),
('l', 'limit', '', _('limit number of changes displayed')),
('r', 'rev', [], _('show the specified revision or range')),
('', 'removed', None, _('include revs where files were removed')),
--- a/mercurial/hgweb/hgweb_mod.py Thu Apr 05 15:20:42 2007 -0700
+++ b/mercurial/hgweb/hgweb_mod.py Sat Apr 07 04:45:27 2007 -0300
@@ -257,7 +257,7 @@
for q in qw:
if not (q in ctx.user().lower() or
q in ctx.description().lower() or
- q in " ".join(ctx.files()[:20]).lower()):
+ q in " ".join(ctx.files()).lower()):
miss = 1
break
if miss:
--- a/mercurial/patch.py Thu Apr 05 15:20:42 2007 -0700
+++ b/mercurial/patch.py Sat Apr 07 04:45:27 2007 -0300
@@ -635,6 +635,8 @@
single(rev, seqno+1, fp)
def diffstat(patchlines):
+ if not util.find_in_path('diffstat', os.environ.get('PATH', '')):
+ return
fd, name = tempfile.mkstemp(prefix="hg-patchbomb-", suffix=".txt")
try:
p = popen2.Popen3('diffstat -p1 -w79 2>/dev/null > ' + name)
--- a/mercurial/revlog.py Thu Apr 05 15:20:42 2007 -0700
+++ b/mercurial/revlog.py Sat Apr 07 04:45:27 2007 -0300
@@ -210,7 +210,7 @@
end = end * self.s
blocksize = end - blockstart
else:
- blockstart = (i & ~(32)) * self.s
+ blockstart = (i & ~63) * self.s
blocksize = self.s * 64
end = blockstart + blocksize
while blockstart < end:
--- a/tests/run-tests.py Thu Apr 05 15:20:42 2007 -0700
+++ b/tests/run-tests.py Sat Apr 07 04:45:27 2007 -0300
@@ -45,6 +45,7 @@
(options, args) = parser.parse_args()
verbose = options.verbose
coverage = options.cover or options.cover_stdlib or options.annotate
+python = sys.executable
def vlog(*msg):
if verbose:
@@ -115,6 +116,7 @@
shutil.copymode(sys.executable, my_python)
def install_hg():
+ global python
vlog("# Performing temporary installation of HG")
installerrs = os.path.join("tests", "install.err")
@@ -154,6 +156,8 @@
os.path.join(BINDIR, '_hg.py')))
f.close()
os.chmod(os.path.join(BINDIR, 'hg'), 0700)
+ python = '"%s" "%s" -x' % (sys.executable,
+ os.path.join(TESTDIR,'coverage.py'))
def output_coverage():
vlog("# Producing coverage report")
@@ -163,7 +167,7 @@
omit += [x for x in sys.path if x != '']
omit = ','.join(omit)
os.chdir(PYTHONDIR)
- cmd = '"%s" "%s" -r "--omit=%s"' % (
+ cmd = '"%s" "%s" -i -r "--omit=%s"' % (
sys.executable, os.path.join(TESTDIR, 'coverage.py'), omit)
vlog("# Running: "+cmd)
os.system(cmd)
@@ -171,7 +175,7 @@
adir = os.path.join(TESTDIR, 'annotated')
if not os.path.isdir(adir):
os.mkdir(adir)
- cmd = '"%s" "%s" -a "--directory=%s" "--omit=%s"' % (
+ cmd = '"%s" "%s" -i -a "--directory=%s" "--omit=%s"' % (
sys.executable, os.path.join(TESTDIR, 'coverage.py'),
adir, omit)
vlog("# Running: "+cmd)
@@ -226,6 +230,7 @@
err = os.path.join(TESTDIR, test+".err")
ref = os.path.join(TESTDIR, test+".out")
+ testpath = os.path.join(TESTDIR, test)
if os.path.exists(err):
os.remove(err) # Remove any previous output files
@@ -235,10 +240,16 @@
os.mkdir(tmpd)
os.chdir(tmpd)
+ try:
+ tf = open(testpath)
+ firstline = tf.readline().rstrip()
+ tf.close()
+ except:
+ firstline = ''
lctest = test.lower()
- if lctest.endswith('.py'):
- cmd = '%s "%s"' % (sys.executable, os.path.join(TESTDIR, test))
+ if lctest.endswith('.py') or firstline == '#!/usr/bin/env python':
+ cmd = '%s "%s"' % (python, testpath)
elif lctest.endswith('.bat'):
# do not run batch scripts on non-windows
if os.name != 'nt':
@@ -246,17 +257,17 @@
return None
# To reliably get the error code from batch files on WinXP,
# the "cmd /c call" prefix is needed. Grrr
- cmd = 'cmd /c call "%s"' % (os.path.join(TESTDIR, test))
+ cmd = 'cmd /c call "%s"' % testpath
else:
# do not run shell scripts on windows
if os.name == 'nt':
print '\nSkipping %s: shell script' % test
return None
# do not try to run non-executable programs
- if not os.access(os.path.join(TESTDIR, test), os.X_OK):
+ if not os.access(testpath, os.X_OK):
print '\nSkipping %s: not executable' % test
return None
- cmd = '"%s"' % (os.path.join(TESTDIR, test))
+ cmd = '"%s"' % testpath
if options.timeout > 0:
signal.alarm(options.timeout)
--- a/tests/test-bad-pull Thu Apr 05 15:20:42 2007 -0700
+++ b/tests/test-bad-pull Sat Apr 07 04:45:27 2007 -0300
@@ -20,6 +20,9 @@
python dumb.py 2>/dev/null &
echo $! >> $DAEMON_PIDS
+# give the server some time to start running
+sleep 1
+
http_proxy= hg clone http://localhost:20059/foo copy2 2>&1 | \
sed -e 's/404.*/404/' -e 's/Date:.*/Date:/'
echo $?
--- a/tests/test-extdiff.out Thu Apr 05 15:20:42 2007 -0700
+++ b/tests/test-extdiff.out Sat Apr 07 04:45:27 2007 -0300
@@ -24,6 +24,8 @@
-r --rev revision
-I --include include names matching the given patterns
-X --exclude exclude names matching the given patterns
+
+use "hg -v help falabala" to show global options
making snapshot of 1 files from rev e27a2475d60a
making snapshot of 1 files from rev 5e49ec8d3f05
diffing a.e27a2475d60a a.5e49ec8d3f05
--- a/tests/test-globalopts.out Thu Apr 05 15:20:42 2007 -0700
+++ b/tests/test-globalopts.out Sat Apr 07 04:45:27 2007 -0300
@@ -117,7 +117,7 @@
%% -h/--help
Mercurial Distributed SCM
-list of commands (use "hg help -v" to show aliases and global options):
+list of commands:
add add the specified files on the next commit
addremove add all new files, delete all missing files
@@ -165,9 +165,11 @@
update update working directory
verify verify the integrity of the repository
version output version and copyright information
+
+use "hg -v help" to show aliases and global options
Mercurial Distributed SCM
-list of commands (use "hg help -v" to show aliases and global options):
+list of commands:
add add the specified files on the next commit
addremove add all new files, delete all missing files
@@ -215,4 +217,6 @@
update update working directory
verify verify the integrity of the repository
version output version and copyright information
+
+use "hg -v help" to show aliases and global options
%% not tested: --debugger
--- a/tests/test-help.out Thu Apr 05 15:20:42 2007 -0700
+++ b/tests/test-help.out Sat Apr 07 04:45:27 2007 -0300
@@ -1,6 +1,6 @@
Mercurial Distributed SCM
-basic commands (use "hg help" for the full list or option "-v" for details):
+basic commands:
add add the specified files on the next commit
annotate show changeset information per file line
@@ -19,6 +19,8 @@
serve export the repository via HTTP
status show changed files in the working directory
update update working directory
+
+use "hg help" for the full list of commands or "hg -v" for details
add add the specified files on the next commit
annotate show changeset information per file line
clone make a copy of an existing repository
@@ -38,7 +40,7 @@
update update working directory
Mercurial Distributed SCM
-list of commands (use "hg help -v" to show aliases and global options):
+list of commands:
add add the specified files on the next commit
addremove add all new files, delete all missing files
@@ -86,6 +88,8 @@
update update working directory
verify verify the integrity of the repository
version output version and copyright information
+
+use "hg -v help" to show aliases and global options
add add the specified files on the next commit
addremove add all new files, delete all missing files
annotate show changeset information per file line
@@ -148,6 +152,8 @@
-I --include include names matching the given patterns
-X --exclude exclude names matching the given patterns
-n --dry-run do not perform actions, just print output
+
+use "hg -v help add" to show global options
hg add: option --skjdfks not recognized
hg add [OPTION]... [FILE]...
@@ -165,6 +171,8 @@
-I --include include names matching the given patterns
-X --exclude exclude names matching the given patterns
-n --dry-run do not perform actions, just print output
+
+use "hg -v help add" to show global options
hg diff [OPTION]... [-r REV1 [-r REV2]] [FILE]...
diff repository (or selected files)
@@ -199,6 +207,8 @@
-B --ignore-blank-lines ignore changes whose lines are all blank
-I --include include names matching the given patterns
-X --exclude exclude names matching the given patterns
+
+use "hg -v help diff" to show global options
hg status [OPTION]... [FILE]...
show changed files in the working directory
@@ -243,13 +253,15 @@
--rev show difference from revision
-I --include include names matching the given patterns
-X --exclude exclude names matching the given patterns
+
+use "hg -v help status" to show global options
hg status [OPTION]... [FILE]...
show changed files in the working directory
hg: unknown command 'foo'
Mercurial Distributed SCM
-basic commands (use "hg help" for the full list or option "-v" for details):
+basic commands:
add add the specified files on the next commit
annotate show changeset information per file line
@@ -268,10 +280,12 @@
serve export the repository via HTTP
status show changed files in the working directory
update update working directory
+
+use "hg help" for the full list of commands or "hg -v" for details
hg: unknown command 'skjdfks'
Mercurial Distributed SCM
-basic commands (use "hg help" for the full list or option "-v" for details):
+basic commands:
add add the specified files on the next commit
annotate show changeset information per file line
@@ -290,3 +304,5 @@
serve export the repository via HTTP
status show changed files in the working directory
update update working directory
+
+use "hg help" for the full list of commands or "hg -v" for details
--- a/tests/test-mq.out Thu Apr 05 15:20:42 2007 -0700
+++ b/tests/test-mq.out Sat Apr 07 04:45:27 2007 -0300
@@ -22,7 +22,7 @@
remove patch from applied stack qpop
refresh contents of top applied patch qrefresh
-list of commands (use "hg help -v mq" to show aliases and global options):
+list of commands:
qapplied print the patches already applied
qclone clone main and patch repository at same time
@@ -48,6 +48,8 @@
qtop print the name of the current patch
qunapplied print the patches not yet applied
strip strip a revision and all later revs on the same branch
+
+use "hg -v help mq" to show aliases and global options
adding a
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
adding b/z
--- a/tests/test-strict.out Thu Apr 05 15:20:42 2007 -0700
+++ b/tests/test-strict.out Sat Apr 07 04:45:27 2007 -0300
@@ -3,7 +3,7 @@
hg: unknown command 'an'
Mercurial Distributed SCM
-basic commands (use "hg help" for the full list or option "-v" for details):
+basic commands:
add add the specified files on the next commit
annotate show changeset information per file line
@@ -22,6 +22,8 @@
serve export the repository via HTTP
status show changed files in the working directory
update update working directory
+
+use "hg help" for the full list of commands or "hg -v" for details
0: a
% should succeed - up is an alias, not an abbreviation
0 files updated, 0 files merged, 0 files removed, 0 files unresolved