2010-09-03 13:19:50 +04:00
|
|
|
Test basic extension support
|
|
|
|
|
|
|
|
$ cat > foobar.py <<EOF
|
|
|
|
> import os
|
2014-05-05 09:48:07 +04:00
|
|
|
> from mercurial import cmdutil, commands
|
|
|
|
> cmdtable = {}
|
|
|
|
> command = cmdutil.command(cmdtable)
|
2010-09-03 13:19:50 +04:00
|
|
|
> 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 "!"))
|
2014-05-05 09:48:07 +04:00
|
|
|
> @command('foo', [], 'hg foo')
|
2010-09-03 13:19:50 +04:00
|
|
|
> def foo(ui, *args, **kwargs):
|
|
|
|
> ui.write("Foo\\n")
|
2014-05-05 09:07:45 +04:00
|
|
|
> @command('bar', [], 'hg bar', norepo=True)
|
2010-09-03 13:19:50 +04:00
|
|
|
> def bar(ui, *args, **kwargs):
|
|
|
|
> ui.write("Bar\\n")
|
|
|
|
> EOF
|
|
|
|
$ abspath=`pwd`/foobar.py
|
|
|
|
|
|
|
|
$ mkdir barfoo
|
|
|
|
$ cp foobar.py barfoo/__init__.py
|
|
|
|
$ barfoopath=`pwd`/barfoo
|
|
|
|
|
|
|
|
$ hg init a
|
|
|
|
$ cd a
|
|
|
|
$ echo foo > file
|
|
|
|
$ hg add file
|
|
|
|
$ hg commit -m 'add file'
|
|
|
|
|
|
|
|
$ echo '[extensions]' >> $HGRCPATH
|
|
|
|
$ echo "foobar = $abspath" >> $HGRCPATH
|
|
|
|
$ hg foo
|
|
|
|
uisetup called
|
|
|
|
reposetup called for a
|
|
|
|
ui == repo.ui
|
|
|
|
Foo
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
$ hg clone a b
|
|
|
|
uisetup called
|
|
|
|
reposetup called for a
|
|
|
|
ui == repo.ui
|
|
|
|
reposetup called for b
|
|
|
|
ui == repo.ui
|
|
|
|
updating to branch default
|
|
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
$ hg bar
|
|
|
|
uisetup called
|
|
|
|
Bar
|
|
|
|
$ echo 'foobar = !' >> $HGRCPATH
|
|
|
|
|
|
|
|
module/__init__.py-style
|
|
|
|
|
|
|
|
$ echo "barfoo = $barfoopath" >> $HGRCPATH
|
|
|
|
$ cd a
|
|
|
|
$ hg foo
|
|
|
|
uisetup called
|
|
|
|
reposetup called for a
|
|
|
|
ui == repo.ui
|
|
|
|
Foo
|
|
|
|
$ echo 'barfoo = !' >> $HGRCPATH
|
|
|
|
|
|
|
|
Check that extensions are loaded in phases:
|
|
|
|
|
|
|
|
$ cat > foo.py <<EOF
|
|
|
|
> import os
|
|
|
|
> name = os.path.basename(__file__).rsplit('.', 1)[0]
|
|
|
|
> print "1) %s imported" % name
|
|
|
|
> def uisetup(ui):
|
|
|
|
> print "2) %s uisetup" % name
|
|
|
|
> def extsetup():
|
|
|
|
> print "3) %s extsetup" % name
|
|
|
|
> def reposetup(ui, repo):
|
|
|
|
> print "4) %s reposetup" % name
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ cp foo.py bar.py
|
|
|
|
$ echo 'foo = foo.py' >> $HGRCPATH
|
|
|
|
$ echo 'bar = bar.py' >> $HGRCPATH
|
|
|
|
|
|
|
|
Command with no output, we just want to see the extensions loaded:
|
|
|
|
|
|
|
|
$ hg paths
|
|
|
|
1) foo imported
|
|
|
|
1) bar imported
|
|
|
|
2) foo uisetup
|
|
|
|
2) bar uisetup
|
|
|
|
3) foo extsetup
|
|
|
|
3) bar extsetup
|
|
|
|
4) foo reposetup
|
|
|
|
4) bar reposetup
|
|
|
|
|
|
|
|
Check hgweb's load order:
|
|
|
|
|
|
|
|
$ cat > hgweb.cgi <<EOF
|
|
|
|
> #!/usr/bin/env python
|
|
|
|
> from mercurial import demandimport; demandimport.enable()
|
|
|
|
> from mercurial.hgweb import hgweb
|
|
|
|
> from mercurial.hgweb import wsgicgi
|
|
|
|
> application = hgweb('.', 'test repo')
|
|
|
|
> wsgicgi.launch(application)
|
|
|
|
> EOF
|
|
|
|
|
2013-01-27 06:32:09 +04:00
|
|
|
$ REQUEST_METHOD='GET' PATH_INFO='/' SCRIPT_NAME='' QUERY_STRING='' \
|
|
|
|
> SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
|
2010-09-03 13:19:50 +04:00
|
|
|
> | grep '^[0-9]) ' # ignores HTML output
|
|
|
|
1) foo imported
|
|
|
|
1) bar imported
|
|
|
|
2) foo uisetup
|
|
|
|
2) bar uisetup
|
|
|
|
3) foo extsetup
|
|
|
|
3) bar extsetup
|
|
|
|
4) foo reposetup
|
|
|
|
4) bar reposetup
|
|
|
|
4) foo reposetup
|
|
|
|
4) bar reposetup
|
|
|
|
|
|
|
|
$ echo 'foo = !' >> $HGRCPATH
|
|
|
|
$ echo 'bar = !' >> $HGRCPATH
|
|
|
|
|
2013-10-04 20:02:22 +04:00
|
|
|
Check "from __future__ import absolute_import" support for external libraries
|
|
|
|
|
2013-11-10 11:48:24 +04:00
|
|
|
#if windows
|
|
|
|
$ PATHSEP=";"
|
|
|
|
#else
|
|
|
|
$ PATHSEP=":"
|
|
|
|
#endif
|
|
|
|
$ export PATHSEP
|
|
|
|
|
2013-10-04 20:02:22 +04:00
|
|
|
$ mkdir $TESTTMP/libroot
|
|
|
|
$ echo "s = 'libroot/ambig.py'" > $TESTTMP/libroot/ambig.py
|
|
|
|
$ mkdir $TESTTMP/libroot/mod
|
|
|
|
$ touch $TESTTMP/libroot/mod/__init__.py
|
|
|
|
$ echo "s = 'libroot/mod/ambig.py'" > $TESTTMP/libroot/mod/ambig.py
|
|
|
|
|
|
|
|
#if absimport
|
|
|
|
$ cat > $TESTTMP/libroot/mod/ambigabs.py <<EOF
|
|
|
|
> from __future__ import absolute_import
|
|
|
|
> import ambig # should load "libroot/ambig.py"
|
|
|
|
> s = ambig.s
|
|
|
|
> EOF
|
|
|
|
$ cat > loadabs.py <<EOF
|
|
|
|
> import mod.ambigabs as ambigabs
|
|
|
|
> def extsetup():
|
|
|
|
> print 'ambigabs.s=%s' % ambigabs.s
|
|
|
|
> EOF
|
2013-11-10 11:48:24 +04:00
|
|
|
$ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadabs=loadabs.py root)
|
2013-10-04 20:02:22 +04:00
|
|
|
ambigabs.s=libroot/ambig.py
|
2013-11-10 11:48:24 +04:00
|
|
|
$TESTTMP/a (glob)
|
2013-10-04 20:02:22 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if no-py3k
|
|
|
|
$ cat > $TESTTMP/libroot/mod/ambigrel.py <<EOF
|
|
|
|
> import ambig # should load "libroot/mod/ambig.py"
|
|
|
|
> s = ambig.s
|
|
|
|
> EOF
|
|
|
|
$ cat > loadrel.py <<EOF
|
|
|
|
> import mod.ambigrel as ambigrel
|
|
|
|
> def extsetup():
|
|
|
|
> print 'ambigrel.s=%s' % ambigrel.s
|
|
|
|
> EOF
|
2013-11-10 11:48:24 +04:00
|
|
|
$ (PYTHONPATH=${PYTHONPATH}${PATHSEP}${TESTTMP}/libroot; hg --config extensions.loadrel=loadrel.py root)
|
2013-10-04 20:02:22 +04:00
|
|
|
ambigrel.s=libroot/mod/ambig.py
|
2013-11-10 11:48:24 +04:00
|
|
|
$TESTTMP/a (glob)
|
2013-10-04 20:02:22 +04:00
|
|
|
#endif
|
|
|
|
|
demandimport: allow extensions to import own modules by absolute name
Before this patch, python modules of each extensions can't import
another one in own extension by absolute name, because root modules of
each extensions are loaded with "hgext_" prefix.
For example, "import extroot.bar" in "extroot/foo.py" of "extroot"
extension fails, even though "import bar" in it succeeds.
Installing extensions into site-packages of python library path can
avoid this problem, but this solution is not reasonable in some cases:
using binary package of Mercurial on Windows, for example.
This patch retries to import with "hgext_" prefix after ImportError,
if the module in the extension may try to import another one in own
extension.
This patch doesn't change some "_import()"/"_origimport()" invocations
below, because ordinary extensions shouldn't cause such invocations.
- invocation of "_import()" when root module imports sub-module by
absolute path without "fromlist"
for example, "import a.b" in "a.__init__.py".
extensions are loaded with "hgext_" prefix, and this causes
execution of another (= fixed by this patch) code path.
- invocation of "_origimport()" when "level != -1" with "fromlist"
for example, importing after "from __future__ import
absolute_import" (level == 0), or "from . import b" or "from .a
import b" (0 < level),
for portability between python versions and environments,
extensions shouldn't cause "level != -1".
2013-10-04 20:02:22 +04:00
|
|
|
Check absolute/relative import of extension specific modules
|
|
|
|
|
|
|
|
$ mkdir $TESTTMP/extroot
|
|
|
|
$ cat > $TESTTMP/extroot/bar.py <<EOF
|
|
|
|
> s = 'this is extroot.bar'
|
|
|
|
> EOF
|
|
|
|
$ mkdir $TESTTMP/extroot/sub1
|
|
|
|
$ cat > $TESTTMP/extroot/sub1/__init__.py <<EOF
|
|
|
|
> s = 'this is extroot.sub1.__init__'
|
|
|
|
> EOF
|
|
|
|
$ cat > $TESTTMP/extroot/sub1/baz.py <<EOF
|
|
|
|
> s = 'this is extroot.sub1.baz'
|
|
|
|
> EOF
|
|
|
|
$ cat > $TESTTMP/extroot/__init__.py <<EOF
|
|
|
|
> s = 'this is extroot.__init__'
|
|
|
|
> import foo
|
|
|
|
> def extsetup(ui):
|
|
|
|
> ui.write('(extroot) ', foo.func(), '\n')
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ cat > $TESTTMP/extroot/foo.py <<EOF
|
|
|
|
> # test absolute import
|
|
|
|
> buf = []
|
|
|
|
> def func():
|
|
|
|
> # "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)
|
|
|
|
> EOF
|
|
|
|
$ hg --config extensions.extroot=$TESTTMP/extroot root
|
|
|
|
(extroot) from extroot.bar import *: this is extroot.bar
|
|
|
|
(extroot) import extroot.sub1.baz: this is extroot.sub1.baz
|
|
|
|
(extroot) import extroot: this is extroot.__init__
|
|
|
|
(extroot) from extroot.bar import s: this is extroot.bar
|
|
|
|
(extroot) import extroot.bar in func(): this is extroot.bar
|
2013-11-10 11:48:24 +04:00
|
|
|
$TESTTMP/a (glob)
|
demandimport: allow extensions to import own modules by absolute name
Before this patch, python modules of each extensions can't import
another one in own extension by absolute name, because root modules of
each extensions are loaded with "hgext_" prefix.
For example, "import extroot.bar" in "extroot/foo.py" of "extroot"
extension fails, even though "import bar" in it succeeds.
Installing extensions into site-packages of python library path can
avoid this problem, but this solution is not reasonable in some cases:
using binary package of Mercurial on Windows, for example.
This patch retries to import with "hgext_" prefix after ImportError,
if the module in the extension may try to import another one in own
extension.
This patch doesn't change some "_import()"/"_origimport()" invocations
below, because ordinary extensions shouldn't cause such invocations.
- invocation of "_import()" when root module imports sub-module by
absolute path without "fromlist"
for example, "import a.b" in "a.__init__.py".
extensions are loaded with "hgext_" prefix, and this causes
execution of another (= fixed by this patch) code path.
- invocation of "_origimport()" when "level != -1" with "fromlist"
for example, importing after "from __future__ import
absolute_import" (level == 0), or "from . import b" or "from .a
import b" (0 < level),
for portability between python versions and environments,
extensions shouldn't cause "level != -1".
2013-10-04 20:02:22 +04:00
|
|
|
|
|
|
|
#if no-py3k
|
2013-11-10 11:48:24 +04:00
|
|
|
$ rm "$TESTTMP"/extroot/foo.*
|
demandimport: allow extensions to import own modules by absolute name
Before this patch, python modules of each extensions can't import
another one in own extension by absolute name, because root modules of
each extensions are loaded with "hgext_" prefix.
For example, "import extroot.bar" in "extroot/foo.py" of "extroot"
extension fails, even though "import bar" in it succeeds.
Installing extensions into site-packages of python library path can
avoid this problem, but this solution is not reasonable in some cases:
using binary package of Mercurial on Windows, for example.
This patch retries to import with "hgext_" prefix after ImportError,
if the module in the extension may try to import another one in own
extension.
This patch doesn't change some "_import()"/"_origimport()" invocations
below, because ordinary extensions shouldn't cause such invocations.
- invocation of "_import()" when root module imports sub-module by
absolute path without "fromlist"
for example, "import a.b" in "a.__init__.py".
extensions are loaded with "hgext_" prefix, and this causes
execution of another (= fixed by this patch) code path.
- invocation of "_origimport()" when "level != -1" with "fromlist"
for example, importing after "from __future__ import
absolute_import" (level == 0), or "from . import b" or "from .a
import b" (0 < level),
for portability between python versions and environments,
extensions shouldn't cause "level != -1".
2013-10-04 20:02:22 +04:00
|
|
|
$ cat > $TESTTMP/extroot/foo.py <<EOF
|
|
|
|
> # test relative import
|
|
|
|
> buf = []
|
|
|
|
> def func():
|
|
|
|
> # "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)
|
|
|
|
> EOF
|
|
|
|
$ hg --config extensions.extroot=$TESTTMP/extroot root
|
|
|
|
(extroot) from bar import *: this is extroot.bar
|
|
|
|
(extroot) import sub1.baz: this is extroot.sub1.baz
|
|
|
|
(extroot) import sub1: this is extroot.sub1.__init__
|
|
|
|
(extroot) from bar import s: this is extroot.bar
|
|
|
|
(extroot) import bar in func(): this is extroot.bar
|
2013-11-10 11:48:24 +04:00
|
|
|
$TESTTMP/a (glob)
|
demandimport: allow extensions to import own modules by absolute name
Before this patch, python modules of each extensions can't import
another one in own extension by absolute name, because root modules of
each extensions are loaded with "hgext_" prefix.
For example, "import extroot.bar" in "extroot/foo.py" of "extroot"
extension fails, even though "import bar" in it succeeds.
Installing extensions into site-packages of python library path can
avoid this problem, but this solution is not reasonable in some cases:
using binary package of Mercurial on Windows, for example.
This patch retries to import with "hgext_" prefix after ImportError,
if the module in the extension may try to import another one in own
extension.
This patch doesn't change some "_import()"/"_origimport()" invocations
below, because ordinary extensions shouldn't cause such invocations.
- invocation of "_import()" when root module imports sub-module by
absolute path without "fromlist"
for example, "import a.b" in "a.__init__.py".
extensions are loaded with "hgext_" prefix, and this causes
execution of another (= fixed by this patch) code path.
- invocation of "_origimport()" when "level != -1" with "fromlist"
for example, importing after "from __future__ import
absolute_import" (level == 0), or "from . import b" or "from .a
import b" (0 < level),
for portability between python versions and environments,
extensions shouldn't cause "level != -1".
2013-10-04 20:02:22 +04:00
|
|
|
#endif
|
|
|
|
|
2010-09-03 13:19:50 +04:00
|
|
|
$ cd ..
|
|
|
|
|
2012-06-21 01:41:21 +04:00
|
|
|
hide outer repo
|
|
|
|
$ hg init
|
|
|
|
|
2010-09-03 13:19:50 +04:00
|
|
|
$ cat > empty.py <<EOF
|
|
|
|
> '''empty cmdtable
|
|
|
|
> '''
|
|
|
|
> cmdtable = {}
|
|
|
|
> EOF
|
|
|
|
$ emptypath=`pwd`/empty.py
|
|
|
|
$ echo "empty = $emptypath" >> $HGRCPATH
|
|
|
|
$ hg help empty
|
|
|
|
empty extension - empty cmdtable
|
|
|
|
|
|
|
|
no commands defined
|
|
|
|
|
2014-07-09 06:57:54 +04:00
|
|
|
|
2010-09-03 13:19:50 +04:00
|
|
|
$ echo 'empty = !' >> $HGRCPATH
|
|
|
|
|
|
|
|
$ cat > debugextension.py <<EOF
|
|
|
|
> '''only debugcommands
|
|
|
|
> '''
|
2014-05-05 09:48:07 +04:00
|
|
|
> from mercurial import cmdutil
|
|
|
|
> cmdtable = {}
|
|
|
|
> command = cmdutil.command(cmdtable)
|
|
|
|
> @command('debugfoobar', [], 'hg debugfoobar')
|
2010-09-03 13:19:50 +04:00
|
|
|
> def debugfoobar(ui, repo, *args, **opts):
|
|
|
|
> "yet another debug command"
|
|
|
|
> pass
|
2014-05-05 09:48:07 +04:00
|
|
|
> @command('foo', [], 'hg foo')
|
2010-09-03 13:19:50 +04:00
|
|
|
> def foo(ui, repo, *args, **opts):
|
|
|
|
> """yet another foo command
|
|
|
|
> This command has been DEPRECATED since forever.
|
|
|
|
> """
|
|
|
|
> pass
|
|
|
|
> EOF
|
|
|
|
$ debugpath=`pwd`/debugextension.py
|
|
|
|
$ echo "debugextension = $debugpath" >> $HGRCPATH
|
|
|
|
|
|
|
|
$ hg help debugextension
|
|
|
|
debugextension extension - only debugcommands
|
|
|
|
|
|
|
|
no commands defined
|
|
|
|
|
2014-07-09 06:57:54 +04:00
|
|
|
|
2010-09-03 13:19:50 +04:00
|
|
|
$ hg --verbose help debugextension
|
|
|
|
debugextension extension - only debugcommands
|
|
|
|
|
|
|
|
list of commands:
|
|
|
|
|
help: format command and option list help using RST
This patch changes the function which generates help text about commands and
options to use RST formatting. Tables describing options have been formatted
using RST table markup for some time already, so their appearance does not
change. Command lists, however, change appearance.
To format non-verbose command lists, RST field list markup was chosen, because
it resembles the old format:
<http://docutils.sourceforge.net/docs/user/rst/quickref.html#field-lists>
In the old (hand-coded) format of non-verbose command lists, the left column is
12 characters wide. Our minirst implementation formats field lists with a left
column 14 characters wide, so this patch changes the appearance of help output
correspondingly:
<http://markmail.org/message/krl4cxopsnii7s6z?q=mercurial+reinert+from:%22Olav+Reinert%22&page=2>
The minirst markup most closely resembling the old verbose command lists is
definition lists. But using it would cause a blank line to be inserted between
each command definition, making the output excessively long, and no more
useful than before. To avoid this, I chose to use field lists also for verbose
command help, resulting in output like this example:
add add the specified files on the next commit
annotate, blame
show changeset information by line for each file
clone make a copy of an existing repository
commit, ci commit the specified files or all outstanding changes
diff diff repository (or selected files)
export dump the header and diffs for one or more changesets
forget forget the specified files on the next commit
init create a new repository in the given directory
log, history show revision history of entire repository or files
merge merge working directory with another revision
phase set or show the current phase name
pull pull changes from the specified source
push push changes to the specified destination
qdiff diff of the current patch and subsequent modifications
qinit init a new queue repository (DEPRECATED)
qnew create a new patch
qpop pop the current patch off the stack
qpush push the next patch onto the stack
qrefresh update the current patch
remove, rm remove the specified files on the next commit
serve start stand-alone webserver
status, st show changed files in the working directory
summary, sum summarize working directory state
update, up, checkout, co
update working directory (or switch revisions)
This change is a move towards generating all help text as a list of strings
marked up with RST.
2012-06-02 13:25:40 +04:00
|
|
|
foo yet another foo command
|
2010-09-03 13:19:50 +04:00
|
|
|
|
|
|
|
global options:
|
2011-09-21 22:00:48 +04:00
|
|
|
|
|
|
|
-R --repository REPO repository root directory or name of overlay bundle
|
|
|
|
file
|
|
|
|
--cwd DIR change working directory
|
|
|
|
-y --noninteractive do not prompt, automatically pick the first choice for
|
|
|
|
all prompts
|
|
|
|
-q --quiet suppress output
|
|
|
|
-v --verbose enable additional output
|
|
|
|
--config CONFIG [+] set/override config option (use 'section.name=value')
|
|
|
|
--debug enable debugging output
|
|
|
|
--debugger start debugger
|
|
|
|
--encoding ENCODE set the charset encoding (default: ascii)
|
|
|
|
--encodingmode MODE set the charset encoding mode (default: strict)
|
|
|
|
--traceback always print a traceback on exception
|
|
|
|
--time time how long the command takes
|
|
|
|
--profile print command execution profile
|
|
|
|
--version output version information and exit
|
|
|
|
-h --help display help and exit
|
2013-01-08 23:37:37 +04:00
|
|
|
--hidden consider hidden changesets
|
2010-09-03 13:19:50 +04:00
|
|
|
|
|
|
|
[+] marked option can be specified multiple times
|
|
|
|
|
2014-07-09 06:57:54 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-03 13:19:50 +04:00
|
|
|
$ hg --debug help debugextension
|
|
|
|
debugextension extension - only debugcommands
|
|
|
|
|
|
|
|
list of commands:
|
|
|
|
|
help: format command and option list help using RST
This patch changes the function which generates help text about commands and
options to use RST formatting. Tables describing options have been formatted
using RST table markup for some time already, so their appearance does not
change. Command lists, however, change appearance.
To format non-verbose command lists, RST field list markup was chosen, because
it resembles the old format:
<http://docutils.sourceforge.net/docs/user/rst/quickref.html#field-lists>
In the old (hand-coded) format of non-verbose command lists, the left column is
12 characters wide. Our minirst implementation formats field lists with a left
column 14 characters wide, so this patch changes the appearance of help output
correspondingly:
<http://markmail.org/message/krl4cxopsnii7s6z?q=mercurial+reinert+from:%22Olav+Reinert%22&page=2>
The minirst markup most closely resembling the old verbose command lists is
definition lists. But using it would cause a blank line to be inserted between
each command definition, making the output excessively long, and no more
useful than before. To avoid this, I chose to use field lists also for verbose
command help, resulting in output like this example:
add add the specified files on the next commit
annotate, blame
show changeset information by line for each file
clone make a copy of an existing repository
commit, ci commit the specified files or all outstanding changes
diff diff repository (or selected files)
export dump the header and diffs for one or more changesets
forget forget the specified files on the next commit
init create a new repository in the given directory
log, history show revision history of entire repository or files
merge merge working directory with another revision
phase set or show the current phase name
pull pull changes from the specified source
push push changes to the specified destination
qdiff diff of the current patch and subsequent modifications
qinit init a new queue repository (DEPRECATED)
qnew create a new patch
qpop pop the current patch off the stack
qpush push the next patch onto the stack
qrefresh update the current patch
remove, rm remove the specified files on the next commit
serve start stand-alone webserver
status, st show changed files in the working directory
summary, sum summarize working directory state
update, up, checkout, co
update working directory (or switch revisions)
This change is a move towards generating all help text as a list of strings
marked up with RST.
2012-06-02 13:25:40 +04:00
|
|
|
debugfoobar yet another debug command
|
|
|
|
foo yet another foo command
|
2010-09-03 13:19:50 +04:00
|
|
|
|
|
|
|
global options:
|
2011-09-21 22:00:48 +04:00
|
|
|
|
|
|
|
-R --repository REPO repository root directory or name of overlay bundle
|
|
|
|
file
|
|
|
|
--cwd DIR change working directory
|
|
|
|
-y --noninteractive do not prompt, automatically pick the first choice for
|
|
|
|
all prompts
|
|
|
|
-q --quiet suppress output
|
|
|
|
-v --verbose enable additional output
|
|
|
|
--config CONFIG [+] set/override config option (use 'section.name=value')
|
|
|
|
--debug enable debugging output
|
|
|
|
--debugger start debugger
|
|
|
|
--encoding ENCODE set the charset encoding (default: ascii)
|
|
|
|
--encodingmode MODE set the charset encoding mode (default: strict)
|
|
|
|
--traceback always print a traceback on exception
|
|
|
|
--time time how long the command takes
|
|
|
|
--profile print command execution profile
|
|
|
|
--version output version information and exit
|
|
|
|
-h --help display help and exit
|
2013-01-08 23:37:37 +04:00
|
|
|
--hidden consider hidden changesets
|
2010-09-03 13:19:50 +04:00
|
|
|
|
|
|
|
[+] marked option can be specified multiple times
|
2014-07-09 06:57:54 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-09-03 13:19:50 +04:00
|
|
|
$ echo 'debugextension = !' >> $HGRCPATH
|
|
|
|
|
2010-01-20 21:24:20 +03:00
|
|
|
Extension module help vs command help:
|
|
|
|
|
|
|
|
$ echo 'extdiff =' >> $HGRCPATH
|
|
|
|
$ hg help extdiff
|
|
|
|
hg extdiff [OPT]... [FILE]...
|
|
|
|
|
|
|
|
use external program to diff repository (or selected files)
|
|
|
|
|
|
|
|
Show differences between revisions for the specified files, using an
|
|
|
|
external program. The default program used is diff, with default options
|
|
|
|
"-Npru".
|
|
|
|
|
|
|
|
To select a different program, use the -p/--program option. The program
|
|
|
|
will be passed the names of two directories to compare. To pass additional
|
|
|
|
options to the program, use -o/--option. These will be passed before the
|
|
|
|
names of the directories to compare.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
2011-05-10 15:19:05 +04:00
|
|
|
use "hg help -e extdiff" to show help for the extdiff extension
|
|
|
|
|
2010-01-20 21:24:20 +03:00
|
|
|
options:
|
|
|
|
|
2011-09-21 22:00:48 +04:00
|
|
|
-p --program CMD comparison program to run
|
|
|
|
-o --option OPT [+] pass option to comparison program
|
|
|
|
-r --rev REV [+] revision
|
|
|
|
-c --change REV change made by revision
|
|
|
|
-I --include PATTERN [+] include names matching the given patterns
|
|
|
|
-X --exclude PATTERN [+] exclude names matching the given patterns
|
2010-01-20 21:24:20 +03:00
|
|
|
|
|
|
|
[+] marked option can be specified multiple times
|
|
|
|
|
help: indicate help omitting if help document is not fully displayed
Before this patch, there is no information about whether help document
is fully displayed or not.
So, some users seem to misunderstand "-v" for "hg help" just as "the
option to show list of global options": experience on "hg help -v" for
some commands not containing verbose containers may strengthen this
misunderstanding.
Such users have less opportunity for noticing omitted help document,
and this may cause insufficient understanding about Mercurial.
This patch indicates help omitting, if help document is not fully
displayed.
For command help, the message below is displayed at the end of help
output, if help document is not fully displayed:
use "hg -v help xxxx" to show more complete help and the global
options
and otherwise:
use "hg -v help xxxx" to show the global options
For topics and extensions help, the message below is displayed, only
if help document is not fully displayed:
use "hg help -v xxxx" to show more complete help
This allows users to know whether there is any omitted information or
not exactly, and can trigger "hg help -v" invocation.
This patch causes formatting help document twice, to switch messages
one for omitted help, and another for not omitted. This decreases
performance of help document formatting, but it is not mainly focused
at help command invocation, so this wouldn't become problem.
2012-10-18 05:31:15 +04:00
|
|
|
use "hg -v help extdiff" to show the global options
|
2010-01-20 21:24:20 +03:00
|
|
|
|
2014-07-09 06:57:54 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-20 21:24:20 +03:00
|
|
|
$ hg help --extension extdiff
|
|
|
|
extdiff extension - command to allow external programs to compare revisions
|
|
|
|
|
|
|
|
The extdiff Mercurial extension allows you to use external programs to compare
|
|
|
|
revisions, or revision with working directory. The external diff programs are
|
|
|
|
called with a configurable set of options and two non-option arguments: paths
|
|
|
|
to directories containing snapshots of files to compare.
|
|
|
|
|
2011-05-15 21:00:22 +04:00
|
|
|
The extdiff extension also allows you to configure new diff commands, so you
|
|
|
|
do not need to type "hg extdiff -p kdiff3" always.
|
2010-01-20 21:24:20 +03:00
|
|
|
|
|
|
|
[extdiff]
|
|
|
|
# add new command that runs GNU diff(1) in 'context diff' mode
|
|
|
|
cdiff = gdiff -Nprc5
|
|
|
|
## or the old way:
|
|
|
|
#cmd.cdiff = gdiff
|
|
|
|
#opts.cdiff = -Nprc5
|
|
|
|
|
|
|
|
# add new command called vdiff, runs kdiff3
|
|
|
|
vdiff = kdiff3
|
|
|
|
|
|
|
|
# add new command called meld, runs meld (no need to name twice)
|
|
|
|
meld =
|
|
|
|
|
|
|
|
# add new command called vimdiff, runs gvimdiff with DirDiff plugin
|
|
|
|
# (see http://www.vim.org/scripts/script.php?script_id=102) Non
|
|
|
|
# English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
|
|
|
|
# your .vimrc
|
2012-03-12 12:39:30 +04:00
|
|
|
vimdiff = gvim -f "+next" \
|
|
|
|
"+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))"
|
2010-01-20 21:24:20 +03:00
|
|
|
|
|
|
|
Tool arguments can include variables that are expanded at runtime:
|
|
|
|
|
|
|
|
$parent1, $plabel1 - filename, descriptive label of first parent
|
|
|
|
$child, $clabel - filename, descriptive label of child revision
|
|
|
|
$parent2, $plabel2 - filename, descriptive label of second parent
|
|
|
|
$root - repository root
|
|
|
|
$parent is an alias for $parent1.
|
|
|
|
|
|
|
|
The extdiff extension will look in your [diff-tools] and [merge-tools]
|
|
|
|
sections for diff tool arguments, when none are specified in [extdiff].
|
|
|
|
|
|
|
|
[extdiff]
|
|
|
|
kdiff3 =
|
|
|
|
|
|
|
|
[diff-tools]
|
|
|
|
kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
|
|
|
|
|
|
|
|
You can use -I/-X and list of file or directory names like normal "hg diff"
|
|
|
|
command. The extdiff extension makes snapshots of only needed files, so
|
|
|
|
running the external diff program will actually be pretty fast (at least
|
|
|
|
faster than having to compare the entire tree).
|
|
|
|
|
|
|
|
list of commands:
|
|
|
|
|
help: format command and option list help using RST
This patch changes the function which generates help text about commands and
options to use RST formatting. Tables describing options have been formatted
using RST table markup for some time already, so their appearance does not
change. Command lists, however, change appearance.
To format non-verbose command lists, RST field list markup was chosen, because
it resembles the old format:
<http://docutils.sourceforge.net/docs/user/rst/quickref.html#field-lists>
In the old (hand-coded) format of non-verbose command lists, the left column is
12 characters wide. Our minirst implementation formats field lists with a left
column 14 characters wide, so this patch changes the appearance of help output
correspondingly:
<http://markmail.org/message/krl4cxopsnii7s6z?q=mercurial+reinert+from:%22Olav+Reinert%22&page=2>
The minirst markup most closely resembling the old verbose command lists is
definition lists. But using it would cause a blank line to be inserted between
each command definition, making the output excessively long, and no more
useful than before. To avoid this, I chose to use field lists also for verbose
command help, resulting in output like this example:
add add the specified files on the next commit
annotate, blame
show changeset information by line for each file
clone make a copy of an existing repository
commit, ci commit the specified files or all outstanding changes
diff diff repository (or selected files)
export dump the header and diffs for one or more changesets
forget forget the specified files on the next commit
init create a new repository in the given directory
log, history show revision history of entire repository or files
merge merge working directory with another revision
phase set or show the current phase name
pull pull changes from the specified source
push push changes to the specified destination
qdiff diff of the current patch and subsequent modifications
qinit init a new queue repository (DEPRECATED)
qnew create a new patch
qpop pop the current patch off the stack
qpush push the next patch onto the stack
qrefresh update the current patch
remove, rm remove the specified files on the next commit
serve start stand-alone webserver
status, st show changed files in the working directory
summary, sum summarize working directory state
update, up, checkout, co
update working directory (or switch revisions)
This change is a move towards generating all help text as a list of strings
marked up with RST.
2012-06-02 13:25:40 +04:00
|
|
|
extdiff use external program to diff repository (or selected files)
|
2010-01-20 21:24:20 +03:00
|
|
|
|
|
|
|
use "hg -v help extdiff" to show builtin aliases and global options
|
|
|
|
|
2014-07-09 06:57:54 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-20 21:24:20 +03:00
|
|
|
$ echo 'extdiff = !' >> $HGRCPATH
|
|
|
|
|
2011-05-10 16:42:53 +04:00
|
|
|
Test help topic with same name as extension
|
|
|
|
|
|
|
|
$ cat > multirevs.py <<EOF
|
2014-05-05 09:48:07 +04:00
|
|
|
> from mercurial import cmdutil, commands
|
|
|
|
> cmdtable = {}
|
|
|
|
> command = cmdutil.command(cmdtable)
|
2011-05-10 16:42:53 +04:00
|
|
|
> """multirevs extension
|
|
|
|
> Big multi-line module docstring."""
|
2014-05-05 09:07:45 +04:00
|
|
|
> @command('multirevs', [], 'ARG', norepo=True)
|
2011-05-10 16:42:53 +04:00
|
|
|
> def multirevs(ui, repo, arg, *args, **opts):
|
|
|
|
> """multirevs command"""
|
|
|
|
> pass
|
|
|
|
> EOF
|
|
|
|
$ echo "multirevs = multirevs.py" >> $HGRCPATH
|
|
|
|
|
|
|
|
$ hg help multirevs
|
|
|
|
Specifying Multiple Revisions
|
2013-02-10 15:58:57 +04:00
|
|
|
"""""""""""""""""""""""""""""
|
2011-05-10 16:42:53 +04:00
|
|
|
|
|
|
|
When Mercurial accepts more than one revision, they may be specified
|
|
|
|
individually, or provided as a topologically continuous range, separated
|
|
|
|
by the ":" character.
|
|
|
|
|
|
|
|
The syntax of range notation is [BEGIN]:[END], where BEGIN and END are
|
|
|
|
revision identifiers. Both BEGIN and END are optional. If BEGIN is not
|
|
|
|
specified, it defaults to revision number 0. If END is not specified, it
|
|
|
|
defaults to the tip. The range ":" thus means "all revisions".
|
|
|
|
|
|
|
|
If BEGIN is greater than END, revisions are treated in reverse order.
|
|
|
|
|
|
|
|
A range acts as a closed interval. This means that a range of 3:5 gives 3,
|
|
|
|
4 and 5. Similarly, a range of 9:6 gives 9, 8, 7, and 6.
|
|
|
|
|
|
|
|
use "hg help -c multirevs" to see help for the multirevs command
|
|
|
|
|
2014-07-09 06:57:54 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-05-10 16:42:53 +04:00
|
|
|
$ hg help -c multirevs
|
|
|
|
hg multirevs ARG
|
|
|
|
|
|
|
|
multirevs command
|
|
|
|
|
help: indicate help omitting if help document is not fully displayed
Before this patch, there is no information about whether help document
is fully displayed or not.
So, some users seem to misunderstand "-v" for "hg help" just as "the
option to show list of global options": experience on "hg help -v" for
some commands not containing verbose containers may strengthen this
misunderstanding.
Such users have less opportunity for noticing omitted help document,
and this may cause insufficient understanding about Mercurial.
This patch indicates help omitting, if help document is not fully
displayed.
For command help, the message below is displayed at the end of help
output, if help document is not fully displayed:
use "hg -v help xxxx" to show more complete help and the global
options
and otherwise:
use "hg -v help xxxx" to show the global options
For topics and extensions help, the message below is displayed, only
if help document is not fully displayed:
use "hg help -v xxxx" to show more complete help
This allows users to know whether there is any omitted information or
not exactly, and can trigger "hg help -v" invocation.
This patch causes formatting help document twice, to switch messages
one for omitted help, and another for not omitted. This decreases
performance of help document formatting, but it is not mainly focused
at help command invocation, so this wouldn't become problem.
2012-10-18 05:31:15 +04:00
|
|
|
use "hg -v help multirevs" to show the global options
|
2011-05-10 16:42:53 +04:00
|
|
|
|
2014-07-09 06:57:54 +04:00
|
|
|
|
|
|
|
|
2011-05-10 16:42:53 +04:00
|
|
|
$ hg multirevs
|
|
|
|
hg multirevs: invalid arguments
|
|
|
|
hg multirevs ARG
|
|
|
|
|
|
|
|
multirevs command
|
|
|
|
|
|
|
|
use "hg help multirevs" to show the full help text
|
|
|
|
[255]
|
|
|
|
|
2014-07-09 06:57:54 +04:00
|
|
|
|
|
|
|
|
2011-05-10 16:42:53 +04:00
|
|
|
$ echo "multirevs = !" >> $HGRCPATH
|
|
|
|
|
2010-09-24 12:13:49 +04:00
|
|
|
Issue811: Problem loading extensions twice (by site and by user)
|
2010-09-03 13:19:50 +04:00
|
|
|
|
|
|
|
$ debugpath=`pwd`/debugissue811.py
|
|
|
|
$ cat > debugissue811.py <<EOF
|
|
|
|
> '''show all loaded extensions
|
|
|
|
> '''
|
2014-05-05 09:48:07 +04:00
|
|
|
> from mercurial import cmdutil, commands, extensions
|
|
|
|
> cmdtable = {}
|
|
|
|
> command = cmdutil.command(cmdtable)
|
2014-05-05 09:07:45 +04:00
|
|
|
> @command('debugextensions', [], 'hg debugextensions', norepo=True)
|
2010-09-03 13:19:50 +04:00
|
|
|
> 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
|
2013-09-27 01:10:11 +04:00
|
|
|
$ echo "strip=" >> $HGRCPATH
|
2010-09-03 13:19:50 +04:00
|
|
|
$ echo "hgext.mq=" >> $HGRCPATH
|
|
|
|
$ echo "hgext/mq=" >> $HGRCPATH
|
|
|
|
|
|
|
|
Show extensions:
|
2013-09-27 01:10:11 +04:00
|
|
|
(note that mq force load strip, also checking it's not loaded twice)
|
2010-09-03 13:19:50 +04:00
|
|
|
|
|
|
|
$ hg debugextensions
|
|
|
|
debugissue811
|
2013-09-27 01:10:11 +04:00
|
|
|
strip
|
2010-09-03 13:19:50 +04:00
|
|
|
mq
|
|
|
|
|
|
|
|
Disabled extension commands:
|
|
|
|
|
2013-09-21 16:33:29 +04:00
|
|
|
$ ORGHGRCPATH=$HGRCPATH
|
2010-09-03 13:19:50 +04:00
|
|
|
$ HGRCPATH=
|
|
|
|
$ export HGRCPATH
|
|
|
|
$ hg help email
|
|
|
|
'email' is provided by the following extension:
|
|
|
|
|
2012-01-11 21:08:25 +04:00
|
|
|
patchbomb command to send changesets as (a series of) patch emails
|
2010-09-03 13:19:50 +04:00
|
|
|
|
|
|
|
use "hg help extensions" for information on enabling extensions
|
2014-07-09 06:57:54 +04:00
|
|
|
|
|
|
|
|
2010-09-03 13:19:50 +04:00
|
|
|
$ hg qdel
|
|
|
|
hg: unknown command 'qdel'
|
|
|
|
'qdelete' is provided by the following extension:
|
|
|
|
|
2012-01-11 21:08:25 +04:00
|
|
|
mq manage a stack of patches
|
2010-09-03 13:19:50 +04:00
|
|
|
|
|
|
|
use "hg help extensions" for information on enabling extensions
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2014-07-09 06:57:54 +04:00
|
|
|
|
|
|
|
|
2010-09-03 13:19:50 +04:00
|
|
|
$ hg churn
|
|
|
|
hg: unknown command 'churn'
|
|
|
|
'churn' is provided by the following extension:
|
|
|
|
|
2012-01-11 21:08:25 +04:00
|
|
|
churn command to display statistics about repository history
|
2010-09-03 13:19:50 +04:00
|
|
|
|
|
|
|
use "hg help extensions" for information on enabling extensions
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2010-09-03 13:19:50 +04:00
|
|
|
|
2014-07-09 06:57:54 +04:00
|
|
|
|
|
|
|
|
2010-09-03 13:19:50 +04:00
|
|
|
Disabled extensions:
|
|
|
|
|
|
|
|
$ hg help churn
|
|
|
|
churn extension - command to display statistics about repository history
|
|
|
|
|
|
|
|
use "hg help extensions" for information on enabling extensions
|
2014-07-09 06:57:54 +04:00
|
|
|
|
2010-09-03 13:19:50 +04:00
|
|
|
$ hg help patchbomb
|
|
|
|
patchbomb extension - command to send changesets as (a series of) patch emails
|
|
|
|
|
|
|
|
use "hg help extensions" for information on enabling extensions
|
|
|
|
|
2014-07-09 06:57:54 +04:00
|
|
|
|
2010-09-03 13:19:50 +04:00
|
|
|
Broken disabled extension and command:
|
|
|
|
|
|
|
|
$ mkdir hgext
|
|
|
|
$ echo > hgext/__init__.py
|
|
|
|
$ cat > hgext/broken.py <<EOF
|
|
|
|
> "broken extension'
|
|
|
|
> EOF
|
|
|
|
$ cat > path.py <<EOF
|
|
|
|
> import os, sys
|
|
|
|
> sys.path.insert(0, os.environ['HGEXTPATH'])
|
|
|
|
> EOF
|
|
|
|
$ HGEXTPATH=`pwd`
|
|
|
|
$ export HGEXTPATH
|
|
|
|
|
|
|
|
$ hg --config extensions.path=./path.py help broken
|
|
|
|
broken extension - (no help text available)
|
|
|
|
|
|
|
|
use "hg help extensions" for information on enabling extensions
|
|
|
|
|
2014-07-09 06:57:54 +04:00
|
|
|
|
2010-12-26 02:43:49 +03:00
|
|
|
$ cat > hgext/forest.py <<EOF
|
|
|
|
> cmdtable = None
|
|
|
|
> EOF
|
2010-09-03 13:19:50 +04:00
|
|
|
$ hg --config extensions.path=./path.py help foo > /dev/null
|
2011-11-07 06:25:10 +04:00
|
|
|
warning: error finding commands in $TESTTMP/hgext/forest.py (glob)
|
2014-04-17 03:55:40 +04:00
|
|
|
abort: no such help topic: foo
|
|
|
|
(try "hg help --keyword foo")
|
2010-09-17 02:51:32 +04:00
|
|
|
[255]
|
2012-05-17 01:18:07 +04:00
|
|
|
|
|
|
|
$ cat > throw.py <<EOF
|
|
|
|
> from mercurial import cmdutil, commands
|
|
|
|
> cmdtable = {}
|
|
|
|
> command = cmdutil.command(cmdtable)
|
|
|
|
> class Bogon(Exception): pass
|
2014-05-05 09:07:45 +04:00
|
|
|
> @command('throw', [], 'hg throw', norepo=True)
|
2012-05-17 01:18:07 +04:00
|
|
|
> def throw(ui, **opts):
|
|
|
|
> """throws an exception"""
|
|
|
|
> raise Bogon()
|
|
|
|
> EOF
|
|
|
|
No declared supported version, extension complains:
|
|
|
|
$ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
|
|
|
|
** Unknown exception encountered with possibly-broken third-party extension throw
|
|
|
|
** which supports versions unknown of Mercurial.
|
|
|
|
** Please disable throw and try your action again.
|
|
|
|
** If that fixes the bug please report it to the extension author.
|
|
|
|
** Python * (glob)
|
|
|
|
** Mercurial Distributed SCM * (glob)
|
|
|
|
** Extensions loaded: throw
|
2013-01-04 22:06:42 +04:00
|
|
|
empty declaration of supported version, extension complains:
|
|
|
|
$ echo "testedwith = ''" >> throw.py
|
|
|
|
$ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
|
|
|
|
** Unknown exception encountered with possibly-broken third-party extension throw
|
|
|
|
** which supports versions unknown of Mercurial.
|
|
|
|
** Please disable throw and try your action again.
|
|
|
|
** If that fixes the bug please report it to the extension author.
|
|
|
|
** Python * (glob)
|
|
|
|
** Mercurial Distributed SCM (*) (glob)
|
|
|
|
** Extensions loaded: throw
|
2012-05-17 01:18:07 +04:00
|
|
|
If the extension specifies a buglink, show that:
|
|
|
|
$ echo 'buglink = "http://example.com/bts"' >> throw.py
|
|
|
|
$ rm -f throw.pyc throw.pyo
|
|
|
|
$ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
|
|
|
|
** Unknown exception encountered with possibly-broken third-party extension throw
|
|
|
|
** which supports versions unknown of Mercurial.
|
|
|
|
** Please disable throw and try your action again.
|
|
|
|
** If that fixes the bug please report it to http://example.com/bts
|
|
|
|
** Python * (glob)
|
|
|
|
** Mercurial Distributed SCM (*) (glob)
|
|
|
|
** Extensions loaded: throw
|
|
|
|
If the extensions declare outdated versions, accuse the older extension first:
|
2012-07-19 18:50:52 +04:00
|
|
|
$ echo "from mercurial import util" >> older.py
|
|
|
|
$ echo "util.version = lambda:'2.2'" >> older.py
|
2012-05-17 01:18:07 +04:00
|
|
|
$ echo "testedwith = '1.9.3'" >> older.py
|
|
|
|
$ echo "testedwith = '2.1.1'" >> throw.py
|
|
|
|
$ rm -f throw.pyc throw.pyo
|
|
|
|
$ hg --config extensions.throw=throw.py --config extensions.older=older.py \
|
|
|
|
> throw 2>&1 | egrep '^\*\*'
|
|
|
|
** Unknown exception encountered with possibly-broken third-party extension older
|
|
|
|
** which supports versions 1.9.3 of Mercurial.
|
|
|
|
** Please disable older and try your action again.
|
|
|
|
** If that fixes the bug please report it to the extension author.
|
|
|
|
** Python * (glob)
|
2012-07-19 23:20:56 +04:00
|
|
|
** Mercurial Distributed SCM (version 2.2)
|
|
|
|
** Extensions loaded: throw, older
|
|
|
|
One extension only tested with older, one only with newer versions:
|
|
|
|
$ echo "util.version = lambda:'2.1.0'" >> older.py
|
|
|
|
$ rm -f older.pyc older.pyo
|
|
|
|
$ hg --config extensions.throw=throw.py --config extensions.older=older.py \
|
|
|
|
> throw 2>&1 | egrep '^\*\*'
|
|
|
|
** Unknown exception encountered with possibly-broken third-party extension older
|
|
|
|
** which supports versions 1.9.3 of Mercurial.
|
|
|
|
** Please disable older and try your action again.
|
|
|
|
** If that fixes the bug please report it to the extension author.
|
|
|
|
** Python * (glob)
|
|
|
|
** Mercurial Distributed SCM (version 2.1.0)
|
|
|
|
** Extensions loaded: throw, older
|
|
|
|
Older extension is tested with current version, the other only with newer:
|
|
|
|
$ echo "util.version = lambda:'1.9.3'" >> older.py
|
|
|
|
$ rm -f older.pyc older.pyo
|
|
|
|
$ hg --config extensions.throw=throw.py --config extensions.older=older.py \
|
|
|
|
> throw 2>&1 | egrep '^\*\*'
|
|
|
|
** Unknown exception encountered with possibly-broken third-party extension throw
|
|
|
|
** which supports versions 2.1.1 of Mercurial.
|
|
|
|
** Please disable throw and try your action again.
|
|
|
|
** If that fixes the bug please report it to http://example.com/bts
|
|
|
|
** Python * (glob)
|
|
|
|
** Mercurial Distributed SCM (version 1.9.3)
|
2012-05-17 01:18:07 +04:00
|
|
|
** Extensions loaded: throw, older
|
|
|
|
|
|
|
|
Declare the version as supporting this hg version, show regular bts link:
|
|
|
|
$ hgver=`python -c 'from mercurial import util; print util.version().split("+")[0]'`
|
|
|
|
$ echo 'testedwith = """'"$hgver"'"""' >> throw.py
|
|
|
|
$ rm -f throw.pyc throw.pyo
|
|
|
|
$ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
|
|
|
|
** unknown exception encountered, please report by visiting
|
|
|
|
** http://mercurial.selenic.com/wiki/BugTracker
|
|
|
|
** Python * (glob)
|
|
|
|
** Mercurial Distributed SCM (*) (glob)
|
|
|
|
** Extensions loaded: throw
|
2013-09-21 16:33:29 +04:00
|
|
|
|
2014-07-09 06:57:54 +04:00
|
|
|
Test version number support in 'hg version':
|
|
|
|
$ echo '__version__ = (1, 2, 3)' >> throw.py
|
|
|
|
$ rm -f throw.pyc throw.pyo
|
2014-07-23 20:16:22 +04:00
|
|
|
$ hg version -v
|
|
|
|
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:
|
|
|
|
|
|
|
|
|
2014-07-09 06:57:54 +04:00
|
|
|
$ 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
|
|
|
|
|
2013-09-21 16:33:29 +04:00
|
|
|
Restore HGRCPATH
|
|
|
|
|
|
|
|
$ HGRCPATH=$ORGHGRCPATH
|
|
|
|
$ export HGRCPATH
|
|
|
|
|
|
|
|
Commands handling multiple repositories at a time should invoke only
|
|
|
|
"reposetup()" of extensions enabling in the target repository.
|
|
|
|
|
|
|
|
$ mkdir reposetup-test
|
|
|
|
$ cd reposetup-test
|
|
|
|
|
|
|
|
$ cat > $TESTTMP/reposetuptest.py <<EOF
|
|
|
|
> from mercurial import extensions
|
|
|
|
> def reposetup(ui, repo):
|
|
|
|
> ui.write('reposetup() for %s\n' % (repo.root))
|
|
|
|
> EOF
|
|
|
|
$ hg init src
|
|
|
|
$ echo a > src/a
|
|
|
|
$ hg -R src commit -Am '#0 at src/a'
|
|
|
|
adding a
|
|
|
|
$ echo '[extensions]' >> src/.hg/hgrc
|
|
|
|
$ echo '# enable extension locally' >> src/.hg/hgrc
|
|
|
|
$ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> src/.hg/hgrc
|
|
|
|
$ hg -R src status
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/src (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
|
|
|
|
$ hg clone -U src clone-dst1
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/src (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
$ hg init push-dst1
|
|
|
|
$ hg -q -R src push push-dst1
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/src (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
$ hg init pull-src1
|
|
|
|
$ hg -q -R pull-src1 pull src
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/src (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
|
|
|
|
$ echo '[extensions]' >> $HGRCPATH
|
|
|
|
$ echo '# disable extension globally and explicitly' >> $HGRCPATH
|
|
|
|
$ echo 'reposetuptest = !' >> $HGRCPATH
|
|
|
|
$ hg clone -U src clone-dst2
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/src (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
$ hg init push-dst2
|
|
|
|
$ hg -q -R src push push-dst2
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/src (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
$ hg init pull-src2
|
|
|
|
$ hg -q -R pull-src2 pull src
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/src (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
|
|
|
|
$ echo '[extensions]' >> $HGRCPATH
|
|
|
|
$ echo '# enable extension globally' >> $HGRCPATH
|
|
|
|
$ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> $HGRCPATH
|
|
|
|
$ hg clone -U src clone-dst3
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/src (glob)
|
|
|
|
reposetup() for $TESTTMP/reposetup-test/clone-dst3 (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
$ hg init push-dst3
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
$ hg -q -R src push push-dst3
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/src (glob)
|
|
|
|
reposetup() for $TESTTMP/reposetup-test/push-dst3 (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
$ hg init pull-src3
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
$ hg -q -R pull-src3 pull src
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/pull-src3 (glob)
|
|
|
|
reposetup() for $TESTTMP/reposetup-test/src (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
|
|
|
|
$ echo '[extensions]' >> src/.hg/hgrc
|
|
|
|
$ echo '# disable extension locally' >> src/.hg/hgrc
|
|
|
|
$ echo 'reposetuptest = !' >> src/.hg/hgrc
|
|
|
|
$ hg clone -U src clone-dst4
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/clone-dst4 (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
$ hg init push-dst4
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
$ hg -q -R src push push-dst4
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/push-dst4 (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
$ hg init pull-src4
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
$ hg -q -R pull-src4 pull src
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/pull-src4 (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
|
|
|
|
disabling in command line overlays with all configuration
|
|
|
|
$ hg --config extensions.reposetuptest=! clone -U src clone-dst5
|
|
|
|
$ hg --config extensions.reposetuptest=! init push-dst5
|
|
|
|
$ hg --config extensions.reposetuptest=! -q -R src push push-dst5
|
|
|
|
$ hg --config extensions.reposetuptest=! init pull-src5
|
|
|
|
$ hg --config extensions.reposetuptest=! -q -R pull-src5 pull src
|
|
|
|
|
|
|
|
$ echo '[extensions]' >> $HGRCPATH
|
|
|
|
$ echo '# disable extension globally and explicitly' >> $HGRCPATH
|
|
|
|
$ echo 'reposetuptest = !' >> $HGRCPATH
|
|
|
|
$ hg init parent
|
|
|
|
$ hg init parent/sub1
|
|
|
|
$ echo 1 > parent/sub1/1
|
|
|
|
$ hg -R parent/sub1 commit -Am '#0 at parent/sub1'
|
|
|
|
adding 1
|
|
|
|
$ hg init parent/sub2
|
|
|
|
$ hg init parent/sub2/sub21
|
|
|
|
$ echo 21 > parent/sub2/sub21/21
|
|
|
|
$ hg -R parent/sub2/sub21 commit -Am '#0 at parent/sub2/sub21'
|
|
|
|
adding 21
|
|
|
|
$ cat > parent/sub2/.hgsub <<EOF
|
|
|
|
> sub21 = sub21
|
|
|
|
> EOF
|
|
|
|
$ hg -R parent/sub2 commit -Am '#0 at parent/sub2'
|
|
|
|
adding .hgsub
|
|
|
|
$ hg init parent/sub3
|
|
|
|
$ echo 3 > parent/sub3/3
|
|
|
|
$ hg -R parent/sub3 commit -Am '#0 at parent/sub3'
|
|
|
|
adding 3
|
|
|
|
$ cat > parent/.hgsub <<EOF
|
|
|
|
> sub1 = sub1
|
|
|
|
> sub2 = sub2
|
|
|
|
> sub3 = sub3
|
|
|
|
> EOF
|
|
|
|
$ hg -R parent commit -Am '#0 at parent'
|
|
|
|
adding .hgsub
|
|
|
|
$ echo '[extensions]' >> parent/.hg/hgrc
|
|
|
|
$ echo '# enable extension locally' >> parent/.hg/hgrc
|
|
|
|
$ echo "reposetuptest = $TESTTMP/reposetuptest.py" >> parent/.hg/hgrc
|
|
|
|
$ cp parent/.hg/hgrc parent/sub2/.hg/hgrc
|
|
|
|
$ hg -R parent status -S -A
|
2013-11-10 11:48:24 +04:00
|
|
|
reposetup() for $TESTTMP/reposetup-test/parent (glob)
|
|
|
|
reposetup() for $TESTTMP/reposetup-test/parent/sub2 (glob)
|
2013-09-21 16:33:29 +04:00
|
|
|
C .hgsub
|
|
|
|
C .hgsubstate
|
|
|
|
C sub1/1
|
|
|
|
C sub2/.hgsub
|
|
|
|
C sub2/.hgsubstate
|
|
|
|
C sub2/sub21/21
|
|
|
|
C sub3/3
|
|
|
|
|
|
|
|
$ cd ..
|