# HG changeset patch # User Augie Fackler # Date 1404874674 14400 # Node ID a3306b8cdc0f52528c265da5a724418ca163260d # Parent ecdbbb6e5d06c90dcdbad52357fdf896cfaa67c9 test-extension: add check for 'hg version -v' listing enabled extensions diff -r ecdbbb6e5d06 -r a3306b8cdc0f tests/test-extension.t --- a/tests/test-extension.t Tue Jun 10 13:44:37 2014 +0300 +++ b/tests/test-extension.t Tue Jul 08 22:57:54 2014 -0400 @@ -3,25 +3,19 @@ $ cat > foobar.py < import os > from mercurial import cmdutil, commands - > > cmdtable = {} > command = cmdutil.command(cmdtable) - > > def uisetup(ui): > ui.write("uisetup called\\n") - > > def reposetup(ui, repo): > ui.write("reposetup called for %s\\n" % os.path.basename(repo.root)) > ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!")) - > > @command('foo', [], 'hg foo') > def foo(ui, *args, **kwargs): > ui.write("Foo\\n") - > > @command('bar', [], 'hg bar', norepo=True) > def bar(ui, *args, **kwargs): > ui.write("Bar\\n") - > > EOF $ abspath=`pwd`/foobar.py @@ -106,7 +100,6 @@ > from mercurial import demandimport; demandimport.enable() > from mercurial.hgweb import hgweb > from mercurial.hgweb import wsgicgi - > > application = hgweb('.', 'test repo') > wsgicgi.launch(application) > EOF @@ -201,21 +194,16 @@ > # "not locals" case > import extroot.bar > buf.append('import extroot.bar in func(): %s' % extroot.bar.s) - > > return '\n(extroot) '.join(buf) - > > # "fromlist == ('*',)" case > from extroot.bar import * > buf.append('from extroot.bar import *: %s' % s) - > > # "not fromlist" and "if '.' in name" case > import extroot.sub1.baz > buf.append('import extroot.sub1.baz: %s' % extroot.sub1.baz.s) - > > # "not fromlist" and NOT "if '.' in name" case > import extroot > buf.append('import extroot: %s' % extroot.s) - > > # NOT "not fromlist" and NOT "level != -1" case > from extroot.bar import s > buf.append('from extroot.bar import s: %s' % s) @@ -237,21 +225,16 @@ > # "not locals" case > import bar > buf.append('import bar in func(): %s' % bar.s) - > > return '\n(extroot) '.join(buf) - > > # "fromlist == ('*',)" case > from bar import * > buf.append('from bar import *: %s' % s) - > > # "not fromlist" and "if '.' in name" case > import sub1.baz > buf.append('import sub1.baz: %s' % sub1.baz.s) - > > # "not fromlist" and NOT "if '.' in name" case > import sub1 > buf.append('import sub1: %s' % sub1.s) - > > # NOT "not fromlist" and NOT "level != -1" case > from bar import s > buf.append('from bar import s: %s' % s) @@ -282,6 +265,7 @@ no commands defined + $ echo 'empty = !' >> $HGRCPATH $ cat > debugextension.py < from mercurial import cmdutil > cmdtable = {} > command = cmdutil.command(cmdtable) - > > @command('debugfoobar', [], 'hg debugfoobar') > def debugfoobar(ui, repo, *args, **opts): > "yet another debug command" > pass - > > @command('foo', [], 'hg foo') > def foo(ui, repo, *args, **opts): > """yet another foo command - > > This command has been DEPRECATED since forever. > """ > pass @@ -312,6 +293,7 @@ no commands defined + $ hg --verbose help debugextension debugextension extension - only debugcommands @@ -342,6 +324,11 @@ [+] marked option can be specified multiple times + + + + + $ hg --debug help debugextension debugextension extension - only debugcommands @@ -372,6 +359,11 @@ --hidden consider hidden changesets [+] marked option can be specified multiple times + + + + + $ echo 'debugextension = !' >> $HGRCPATH Extension module help vs command help: @@ -411,6 +403,15 @@ use "hg -v help extdiff" to show the global options + + + + + + + + + $ hg help --extension extdiff extdiff extension - command to allow external programs to compare revisions @@ -470,6 +471,21 @@ use "hg -v help extdiff" to show builtin aliases and global options + + + + + + + + + + + + + + + $ echo 'extdiff = !' >> $HGRCPATH Test help topic with same name as extension @@ -507,6 +523,11 @@ use "hg help -c multirevs" to see help for the multirevs command + + + + + $ hg help -c multirevs hg multirevs ARG @@ -514,6 +535,8 @@ use "hg -v help multirevs" to show the global options + + $ hg multirevs hg multirevs: invalid arguments hg multirevs ARG @@ -523,6 +546,8 @@ use "hg help multirevs" to show the full help text [255] + + $ echo "multirevs = !" >> $HGRCPATH Issue811: Problem loading extensions twice (by site and by user) @@ -534,12 +559,10 @@ > from mercurial import cmdutil, commands, extensions > cmdtable = {} > command = cmdutil.command(cmdtable) - > > @command('debugextensions', [], 'hg debugextensions', norepo=True) > def debugextensions(ui): > "yet another debug command" > ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()])) - > > EOF $ echo "debugissue811 = $debugpath" >> $HGRCPATH $ echo "mq=" >> $HGRCPATH @@ -566,6 +589,8 @@ patchbomb command to send changesets as (a series of) patch emails use "hg help extensions" for information on enabling extensions + + $ hg qdel hg: unknown command 'qdel' 'qdelete' is provided by the following extension: @@ -574,6 +599,8 @@ use "hg help extensions" for information on enabling extensions [255] + + $ hg churn hg: unknown command 'churn' 'churn' is provided by the following extension: @@ -583,17 +610,21 @@ use "hg help extensions" for information on enabling extensions [255] + + Disabled extensions: $ hg help churn churn extension - command to display statistics about repository history use "hg help extensions" for information on enabling extensions + $ hg help patchbomb patchbomb extension - command to send changesets as (a series of) patch emails use "hg help extensions" for information on enabling extensions + Broken disabled extension and command: $ mkdir hgext @@ -613,6 +644,7 @@ use "hg help extensions" for information on enabling extensions + $ cat > hgext/forest.py < cmdtable = None > EOF @@ -627,7 +659,6 @@ > cmdtable = {} > command = cmdutil.command(cmdtable) > class Bogon(Exception): pass - > > @command('throw', [], 'hg throw', norepo=True) > def throw(ui, **opts): > """throws an exception""" @@ -714,6 +745,34 @@ ** Mercurial Distributed SCM (*) (glob) ** Extensions loaded: throw +Test version number support in 'hg version': + $ echo '__version__ = (1, 2, 3)' >> throw.py + $ rm -f throw.pyc throw.pyo + $ hg version -v --config extensions.throw=throw.py + Mercurial Distributed SCM (version *) (glob) + (see http://mercurial.selenic.com for more information) + + Copyright (C) 2005-* Matt Mackall and others (glob) + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Enabled extensions: + + throw 1.2.3 + $ echo 'getversion = lambda: "1.twentythree"' >> throw.py + $ rm -f throw.pyc throw.pyo + $ hg version -v --config extensions.throw=throw.py + Mercurial Distributed SCM (version *) (glob) + (see http://mercurial.selenic.com for more information) + + Copyright (C) 2005-* Matt Mackall and others (glob) + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Enabled extensions: + + throw 1.twentythree + Restore HGRCPATH $ HGRCPATH=$ORGHGRCPATH