tests/test-extension
author Brodie Rao <me+hg@dackz.net>
Sun, 07 Feb 2010 14:01:43 +0100
changeset 10364 de1e7099d100
parent 9802 4ce13d7c6b88
child 10669 181cbb23572e
permissions -rwxr-xr-x
dispatch: provide help for disabled extensions and commands Before a command is declared unknown, each extension in hgext is searched, starting with hgext.<cmdname>. If there's a matching command, a help message suggests the appropriate extension and how to enable it. Every extension could potentially be imported, but for cases like rebase, relink, etc. only one extension is imported. For the case of "hg help disabledext", if the extension is in hgext, the extension description is read and a similar help suggestion is printed. No extension import occurs.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     1
#!/bin/sh
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     2
# Test basic extension support
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     3
7429
dbc40381620e tests: Skip tests if they will fail because of outer repo
Mads Kiilerich <mads@kiilerich.com>
parents: 7011
diff changeset
     4
"$TESTDIR/hghave" no-outer-repo || exit 80
dbc40381620e tests: Skip tests if they will fail because of outer repo
Mads Kiilerich <mads@kiilerich.com>
parents: 7011
diff changeset
     5
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     6
cat > foobar.py <<EOF
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     7
import os
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     8
from mercurial import commands
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     9
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    10
def uisetup(ui):
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    11
    ui.write("uisetup called\\n")
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    12
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    13
def reposetup(ui, repo):
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    14
    ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
4074
0f9381cf9723 Try to pass repo.ui to reposetup hooks
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4064
diff changeset
    15
    ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    16
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    17
def foo(ui, *args, **kwargs):
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    18
    ui.write("Foo\\n")
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    19
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    20
def bar(ui, *args, **kwargs):
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    21
    ui.write("Bar\\n")
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    22
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    23
cmdtable = {
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    24
    "foo": (foo, [], "hg foo"),
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    25
    "bar": (bar, [], "hg bar"),
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    26
}
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    27
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    28
commands.norepo += ' bar'
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    29
EOF
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    30
abspath=`pwd`/foobar.py
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    31
4569
622d8ed78b47 extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents: 4074
diff changeset
    32
mkdir barfoo
622d8ed78b47 extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents: 4074
diff changeset
    33
cp foobar.py barfoo/__init__.py
622d8ed78b47 extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents: 4074
diff changeset
    34
barfoopath=`pwd`/barfoo
622d8ed78b47 extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents: 4074
diff changeset
    35
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    36
hg init a
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    37
cd a
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    38
echo foo > file
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    39
hg add file
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    40
hg commit -m 'add file'
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    41
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    42
echo '[extensions]' >> $HGRCPATH
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    43
echo "foobar = $abspath" >> $HGRCPATH
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    44
hg foo
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    45
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    46
cd ..
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    47
hg clone a b
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    48
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    49
hg bar
5523
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4950
diff changeset
    50
echo 'foobar = !' >> $HGRCPATH
4569
622d8ed78b47 extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents: 4074
diff changeset
    51
622d8ed78b47 extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents: 4074
diff changeset
    52
echo '% module/__init__.py-style'
622d8ed78b47 extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents: 4074
diff changeset
    53
echo "barfoo = $barfoopath" >> $HGRCPATH
622d8ed78b47 extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents: 4074
diff changeset
    54
cd a
622d8ed78b47 extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents: 4074
diff changeset
    55
hg foo
5523
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4950
diff changeset
    56
echo 'barfoo = !' >> $HGRCPATH
4738
c41a404ac387 Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents: 4569
diff changeset
    57
9410
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    58
# check that extensions are loaded in phases
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    59
cat > foo.py <<EOF
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    60
import os
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    61
name = os.path.basename(__file__).rsplit('.', 1)[0]
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    62
print "1) %s imported" % name
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    63
def uisetup(ui):
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    64
    print "2) %s uisetup" % name
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    65
def extsetup():
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    66
    print "3) %s extsetup" % name
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    67
def reposetup(ui, repo):
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    68
    print "4) %s reposetup" % name
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    69
EOF
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    70
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    71
cp foo.py bar.py
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    72
echo 'foo = foo.py' >> $HGRCPATH
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    73
echo 'bar = bar.py' >> $HGRCPATH
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    74
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    75
# command with no output, we just want to see the extensions loaded
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    76
hg paths
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    77
9661
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
    78
# check hgweb's load order
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
    79
echo '% hgweb.cgi'
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
    80
cat > hgweb.cgi <<EOF
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
    81
#!/usr/bin/env python
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
    82
from mercurial import demandimport; demandimport.enable()
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
    83
from mercurial.hgweb import hgweb
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
    84
from mercurial.hgweb import wsgicgi
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
    85
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
    86
application = hgweb('.', 'test repo')
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
    87
wsgicgi.launch(application)
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
    88
EOF
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
    89
SCRIPT_NAME='/' SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
9802
4ce13d7c6b88 test-extension: Solaris grep don't know [[:digit:]]
Mads Kiilerich <mads@kiilerich.com>
parents: 9661
diff changeset
    90
    | grep '^[0-9]) ' # ignores HTML output
9661
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
    91
9410
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    92
echo 'foo = !' >> $HGRCPATH
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    93
echo 'bar = !' >> $HGRCPATH
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
    94
4738
c41a404ac387 Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents: 4569
diff changeset
    95
cd ..
c41a404ac387 Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents: 4569
diff changeset
    96
cat > empty.py <<EOF
c41a404ac387 Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents: 4569
diff changeset
    97
'''empty cmdtable
c41a404ac387 Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents: 4569
diff changeset
    98
'''
c41a404ac387 Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents: 4569
diff changeset
    99
cmdtable = {}
c41a404ac387 Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents: 4569
diff changeset
   100
EOF
c41a404ac387 Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents: 4569
diff changeset
   101
emptypath=`pwd`/empty.py
c41a404ac387 Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents: 4569
diff changeset
   102
echo "empty = $emptypath" >> $HGRCPATH
c41a404ac387 Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents: 4569
diff changeset
   103
hg help empty
5523
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4950
diff changeset
   104
echo 'empty = !' >> $HGRCPATH
4950
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   105
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   106
cat > debugextension.py <<EOF
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   107
'''only debugcommands
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   108
'''
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   109
def debugfoobar(ui, repo, *args, **opts):
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   110
    "yet another debug command"
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   111
    pass
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   112
9128
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   113
def foo(ui, repo, *args, **opts):
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   114
    """yet another foo command
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   115
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   116
    This command has been DEPRECATED since forever.
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   117
    """
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   118
    pass
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   119
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   120
cmdtable = {
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   121
    "debugfoobar": (debugfoobar, (), "hg debugfoobar"),
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   122
    "foo": (foo, (), "hg foo")
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   123
}
4950
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   124
EOF
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   125
debugpath=`pwd`/debugextension.py
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   126
echo "debugextension = $debugpath" >> $HGRCPATH
9128
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   127
echo "% hg help"
4950
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   128
hg help debugextension
9128
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   129
echo "% hg help --verbose"
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   130
hg --verbose help debugextension
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   131
echo "% hg help --debug"
4950
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   132
hg --debug help debugextension
5523
5db730475d6d tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4950
diff changeset
   133
echo 'debugextension = !' >> $HGRCPATH
7011
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   134
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   135
echo % issue811
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   136
debugpath=`pwd`/debugissue811.py
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   137
cat > debugissue811.py <<EOF
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   138
'''show all loaded extensions
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   139
'''
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   140
from mercurial import extensions, commands
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   141
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   142
def debugextensions(ui):
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   143
    "yet another debug command"
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   144
    ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   145
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   146
cmdtable = {"debugextensions": (debugextensions, (), "hg debugextensions")}
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   147
commands.norepo += " debugextensions"
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   148
EOF
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   149
echo "debugissue811 = $debugpath" >> $HGRCPATH
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   150
echo "mq=" >> $HGRCPATH
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   151
echo "hgext.mq=" >> $HGRCPATH
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   152
echo "hgext/mq=" >> $HGRCPATH
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   153
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   154
echo % show extensions
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   155
hg debugextensions
10364
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   156
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   157
echo '% disabled extension commands'
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   158
HGRCPATH=
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   159
hg help email
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   160
hg qdel
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   161
hg churn
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   162
echo '% disabled extensions'
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   163
hg help churn
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   164
hg help patchbomb
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   165
echo '% broken disabled extension and command'
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   166
mkdir hgext
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   167
echo > hgext/__init__.py
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   168
cat > hgext/broken.py <<EOF
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   169
"broken extension'
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   170
EOF
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   171
TMPPYTHONPATH="$PYTHONPATH"
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   172
PYTHONPATH="`pwd`:$PYTHONPATH"
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   173
export PYTHONPATH
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   174
hg help broken
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   175
hg help foo > /dev/null
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   176
PYTHONPATH="$TMPPYTHONPATH"
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   177
export PYTHONPATH
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   178
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   179
exit 0