tests/test-extension.t
author Henri Wiechers <hwiechers@gmail.com>
Wed, 20 Jan 2010 20:24:20 +0200
changeset 14284 1f9e11f65cd7
parent 13191 1aea66b71f4f
child 14285 aa64a87b493d
permissions -rw-r--r--
help: add -e/--extension switch to display extension help text
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
     1
Test basic extension support
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     2
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
     3
  $ "$TESTDIR/hghave" no-outer-repo || exit 80
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
     4
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
     5
  $ cat > foobar.py <<EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
     6
  > import os
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
     7
  > from mercurial import commands
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
     8
  > 
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
     9
  > def uisetup(ui):
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    10
  >     ui.write("uisetup called\\n")
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    11
  > 
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    12
  > def reposetup(ui, repo):
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    13
  >     ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    14
  >     ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    15
  > 
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    16
  > def foo(ui, *args, **kwargs):
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    17
  >     ui.write("Foo\\n")
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    18
  > 
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    19
  > def bar(ui, *args, **kwargs):
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    20
  >     ui.write("Bar\\n")
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    21
  > 
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    22
  > cmdtable = {
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    23
  >    "foo": (foo, [], "hg foo"),
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    24
  >    "bar": (bar, [], "hg bar"),
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    25
  > }
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    26
  > 
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    27
  > commands.norepo += ' bar'
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    28
  > EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    29
  $ abspath=`pwd`/foobar.py
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    30
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    31
  $ mkdir barfoo
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    32
  $ cp foobar.py barfoo/__init__.py
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    33
  $ barfoopath=`pwd`/barfoo
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    34
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    35
  $ hg init a
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    36
  $ cd a
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    37
  $ echo foo > file
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    38
  $ hg add file
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    39
  $ hg commit -m 'add file'
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    40
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    41
  $ echo '[extensions]' >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    42
  $ echo "foobar = $abspath" >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    43
  $ hg foo
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    44
  uisetup called
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    45
  reposetup called for a
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    46
  ui == repo.ui
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    47
  Foo
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    48
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    49
  $ cd ..
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    50
  $ hg clone a b
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    51
  uisetup called
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    52
  reposetup called for a
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    53
  ui == repo.ui
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    54
  reposetup called for b
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    55
  ui == repo.ui
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    56
  updating to branch default
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    57
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
4569
622d8ed78b47 extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents: 4074
diff changeset
    58
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    59
  $ hg bar
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    60
  uisetup called
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    61
  Bar
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    62
  $ echo 'foobar = !' >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    63
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    64
module/__init__.py-style
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    65
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    66
  $ echo "barfoo = $barfoopath" >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    67
  $ cd a
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    68
  $ hg foo
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    69
  uisetup called
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    70
  reposetup called for a
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    71
  ui == repo.ui
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    72
  Foo
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    73
  $ echo 'barfoo = !' >> $HGRCPATH
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    74
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    75
Check that extensions are loaded in phases:
4064
5d9ede002453 install reposetup hook right after loading the extension
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
diff changeset
    76
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    77
  $ cat > foo.py <<EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    78
  > import os
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    79
  > name = os.path.basename(__file__).rsplit('.', 1)[0]
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    80
  > print "1) %s imported" % name
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    81
  > def uisetup(ui):
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    82
  >     print "2) %s uisetup" % name
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    83
  > def extsetup():
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    84
  >     print "3) %s extsetup" % name
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    85
  > def reposetup(ui, repo):
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    86
  >    print "4) %s reposetup" % name
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    87
  > EOF
4569
622d8ed78b47 extensions: load modules in module/__init__.py form.
Brendan Cully <brendan@kublai.com>
parents: 4074
diff changeset
    88
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    89
  $ cp foo.py bar.py
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    90
  $ echo 'foo = foo.py' >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    91
  $ echo 'bar = bar.py' >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    92
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    93
Command with no output, we just want to see the extensions loaded:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    94
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    95
  $ hg paths
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    96
  1) foo imported
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    97
  1) bar imported
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    98
  2) foo uisetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
    99
  2) bar uisetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   100
  3) foo extsetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   101
  3) bar extsetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   102
  4) foo reposetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   103
  4) bar reposetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   104
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   105
Check hgweb's load order:
4738
c41a404ac387 Handle extensions with defined but empty cmdtable
Brendan Cully <brendan@kublai.com>
parents: 4569
diff changeset
   106
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   107
  $ cat > hgweb.cgi <<EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   108
  > #!/usr/bin/env python
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   109
  > from mercurial import demandimport; demandimport.enable()
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   110
  > from mercurial.hgweb import hgweb
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   111
  > from mercurial.hgweb import wsgicgi
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   112
  > 
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   113
  > application = hgweb('.', 'test repo')
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   114
  > wsgicgi.launch(application)
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   115
  > EOF
9410
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
   116
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   117
  $ SCRIPT_NAME='/' SERVER_PORT='80' SERVER_NAME='localhost' python hgweb.cgi \
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   118
  >    | grep '^[0-9]) ' # ignores HTML output
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   119
  1) foo imported
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   120
  1) bar imported
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   121
  2) foo uisetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   122
  2) bar uisetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   123
  3) foo extsetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   124
  3) bar extsetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   125
  4) foo reposetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   126
  4) bar reposetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   127
  4) foo reposetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   128
  4) bar reposetup
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   129
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   130
  $ echo 'foo = !' >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   131
  $ echo 'bar = !' >> $HGRCPATH
9410
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
   132
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   133
  $ cd ..
9661
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
   134
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   135
  $ cat > empty.py <<EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   136
  > '''empty cmdtable
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   137
  > '''
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   138
  > cmdtable = {}
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   139
  > EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   140
  $ emptypath=`pwd`/empty.py
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   141
  $ echo "empty = $emptypath" >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   142
  $ hg help empty
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   143
  empty extension - empty cmdtable
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   144
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   145
  no commands defined
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   146
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   147
  $ echo 'empty = !' >> $HGRCPATH
9661
c4f6c02e33c4 hgweb: added test case for extension loading phases (issue1824)
Yuya Nishihara <yuya@tcha.org>
parents: 9410
diff changeset
   148
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   149
  $ cat > debugextension.py <<EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   150
  > '''only debugcommands
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   151
  > '''
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   152
  > def debugfoobar(ui, repo, *args, **opts):
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   153
  >     "yet another debug command"
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   154
  >     pass
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   155
  > 
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   156
  > def foo(ui, repo, *args, **opts):
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   157
  >     """yet another foo command
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   158
  > 
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   159
  >     This command has been DEPRECATED since forever.
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   160
  >     """
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   161
  >     pass
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   162
  > 
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   163
  > cmdtable = {
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   164
  >    "debugfoobar": (debugfoobar, (), "hg debugfoobar"),
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   165
  >    "foo": (foo, (), "hg foo")
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   166
  > }
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   167
  > EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   168
  $ debugpath=`pwd`/debugextension.py
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   169
  $ echo "debugextension = $debugpath" >> $HGRCPATH
9410
1c83938b6a8e extensions: load and configure extensions in well-defined phases
Martin Geisler <mg@lazybytes.net>
parents: 9128
diff changeset
   170
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   171
  $ hg help debugextension
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   172
  debugextension extension - only debugcommands
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   173
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   174
  no commands defined
4950
93b7e2fa7ee3 help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents: 4738
diff changeset
   175
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   176
  $ hg --verbose help debugextension
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   177
  debugextension extension - only debugcommands
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   178
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   179
  list of commands:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   180
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   181
   foo:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   182
        yet another foo command
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   183
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   184
  global options:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   185
   -R --repository REPO    repository root directory or name of overlay bundle
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   186
                           file
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   187
      --cwd DIR            change working directory
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   188
   -y --noninteractive     do not prompt, assume 'yes' for any required answers
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   189
   -q --quiet              suppress output
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   190
   -v --verbose            enable additional output
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   191
      --config CONFIG [+]  set/override config option (use 'section.name=value')
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   192
      --debug              enable debugging output
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   193
      --debugger           start debugger
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   194
      --encoding ENCODE    set the charset encoding (default: ascii)
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   195
      --encodingmode MODE  set the charset encoding mode (default: strict)
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   196
      --traceback          always print a traceback on exception
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   197
      --time               time how long the command takes
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   198
      --profile            print command execution profile
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   199
      --version            output version information and exit
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   200
   -h --help               display help and exit
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   201
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   202
  [+] marked option can be specified multiple times
9128
98d90ad54749 commands: hide deprecated commands.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 8189
diff changeset
   203
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   204
  $ hg --debug help debugextension
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   205
  debugextension extension - only debugcommands
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   206
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   207
  list of commands:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   208
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   209
   debugfoobar:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   210
        yet another debug command
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   211
   foo:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   212
        yet another foo command
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   213
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   214
  global options:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   215
   -R --repository REPO    repository root directory or name of overlay bundle
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   216
                           file
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   217
      --cwd DIR            change working directory
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   218
   -y --noninteractive     do not prompt, assume 'yes' for any required answers
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   219
   -q --quiet              suppress output
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   220
   -v --verbose            enable additional output
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   221
      --config CONFIG [+]  set/override config option (use 'section.name=value')
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   222
      --debug              enable debugging output
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   223
      --debugger           start debugger
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   224
      --encoding ENCODE    set the charset encoding (default: ascii)
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   225
      --encodingmode MODE  set the charset encoding mode (default: strict)
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   226
      --traceback          always print a traceback on exception
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   227
      --time               time how long the command takes
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   228
      --profile            print command execution profile
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   229
      --version            output version information and exit
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   230
   -h --help               display help and exit
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   231
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   232
  [+] marked option can be specified multiple times
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   233
  $ echo 'debugextension = !' >> $HGRCPATH
7011
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   234
14284
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   235
Extension module help vs command help:
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   236
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   237
  $ echo 'extdiff =' >> $HGRCPATH
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   238
  $ hg help extdiff
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   239
  hg extdiff [OPT]... [FILE]...
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   240
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   241
  use external program to diff repository (or selected files)
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   242
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   243
      Show differences between revisions for the specified files, using an
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   244
      external program. The default program used is diff, with default options
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   245
      "-Npru".
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   246
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   247
      To select a different program, use the -p/--program option. The program
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   248
      will be passed the names of two directories to compare. To pass additional
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   249
      options to the program, use -o/--option. These will be passed before the
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   250
      names of the directories to compare.
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   251
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   252
      When two revision arguments are given, then changes are shown between
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   253
      those revisions. If only one revision is specified then that revision is
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   254
      compared to the working directory, and, when no revisions are specified,
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   255
      the working directory files are compared to its parent.
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   256
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   257
  options:
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   258
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   259
   -p --program CMD          comparison program to run
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   260
   -o --option OPT [+]       pass option to comparison program
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   261
   -r --rev REV [+]          revision
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   262
   -c --change REV           change made by revision
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   263
   -I --include PATTERN [+]  include names matching the given patterns
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   264
   -X --exclude PATTERN [+]  exclude names matching the given patterns
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   265
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   266
  [+] marked option can be specified multiple times
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   267
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   268
  use "hg -v help extdiff" to show global options
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   269
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   270
  $ hg help --extension extdiff
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   271
  extdiff extension - command to allow external programs to compare revisions
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   272
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   273
  The extdiff Mercurial extension allows you to use external programs to compare
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   274
  revisions, or revision with working directory. The external diff programs are
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   275
  called with a configurable set of options and two non-option arguments: paths
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   276
  to directories containing snapshots of files to compare.
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   277
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   278
  The extdiff extension also allows to configure new diff commands, so you do
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   279
  not need to type "hg extdiff -p kdiff3" always.
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   280
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   281
    [extdiff]
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   282
    # add new command that runs GNU diff(1) in 'context diff' mode
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   283
    cdiff = gdiff -Nprc5
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   284
    ## or the old way:
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   285
    #cmd.cdiff = gdiff
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   286
    #opts.cdiff = -Nprc5
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   287
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   288
    # add new command called vdiff, runs kdiff3
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   289
    vdiff = kdiff3
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   290
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   291
    # add new command called meld, runs meld (no need to name twice)
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   292
    meld =
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   293
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   294
    # add new command called vimdiff, runs gvimdiff with DirDiff plugin
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   295
    # (see http://www.vim.org/scripts/script.php?script_id=102) Non
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   296
    # English user, be sure to put "let g:DirDiffDynamicDiffText = 1" in
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   297
    # your .vimrc
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   298
    vimdiff = gvim -f '+next' '+execute "DirDiff" argv(0) argv(1)'
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   299
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   300
  Tool arguments can include variables that are expanded at runtime:
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   301
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   302
    $parent1, $plabel1 - filename, descriptive label of first parent
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   303
    $child,   $clabel  - filename, descriptive label of child revision
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   304
    $parent2, $plabel2 - filename, descriptive label of second parent
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   305
    $root              - repository root
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   306
    $parent is an alias for $parent1.
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   307
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   308
  The extdiff extension will look in your [diff-tools] and [merge-tools]
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   309
  sections for diff tool arguments, when none are specified in [extdiff].
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   310
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   311
    [extdiff]
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   312
    kdiff3 =
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   313
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   314
    [diff-tools]
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   315
    kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   316
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   317
  You can use -I/-X and list of file or directory names like normal "hg diff"
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   318
  command. The extdiff extension makes snapshots of only needed files, so
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   319
  running the external diff program will actually be pretty fast (at least
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   320
  faster than having to compare the entire tree).
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   321
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   322
  list of commands:
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   323
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   324
   extdiff   use external program to diff repository (or selected files)
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   325
  
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   326
  use "hg -v help extdiff" to show builtin aliases and global options
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   327
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   328
  $ echo 'extdiff = !' >> $HGRCPATH
1f9e11f65cd7 help: add -e/--extension switch to display extension help text
Henri Wiechers <hwiechers@gmail.com>
parents: 13191
diff changeset
   329
12399
4fee1fd3de9a tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents: 12327
diff changeset
   330
Issue811: Problem loading extensions twice (by site and by user)
7011
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   331
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   332
  $ debugpath=`pwd`/debugissue811.py
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   333
  $ cat > debugissue811.py <<EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   334
  > '''show all loaded extensions
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   335
  > '''
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   336
  > from mercurial import extensions, commands
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   337
  > 
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   338
  > def debugextensions(ui):
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   339
  >     "yet another debug command"
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   340
  >     ui.write("%s\n" % '\n'.join([x for x, y in extensions.extensions()]))
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   341
  > 
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   342
  > cmdtable = {"debugextensions": (debugextensions, (), "hg debugextensions")}
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   343
  > commands.norepo += " debugextensions"
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   344
  > EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   345
  $ echo "debugissue811 = $debugpath" >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   346
  $ echo "mq=" >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   347
  $ echo "hgext.mq=" >> $HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   348
  $ echo "hgext/mq=" >> $HGRCPATH
7011
7da76778dbd7 Do not try to load extensions twice (issue811)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5523
diff changeset
   349
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   350
Show extensions:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   351
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   352
  $ hg debugextensions
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   353
  debugissue811
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   354
  mq
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   355
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   356
Disabled extension commands:
10364
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   357
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   358
  $ HGRCPATH=
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   359
  $ export HGRCPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   360
  $ hg help email
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   361
  'email' is provided by the following extension:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   362
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   363
      patchbomb  command to send changesets as (a series of) patch emails
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   364
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   365
  use "hg help extensions" for information on enabling extensions
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   366
  $ hg qdel
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   367
  hg: unknown command 'qdel'
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   368
  'qdelete' is provided by the following extension:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   369
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   370
      mq  manage a stack of patches
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   371
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   372
  use "hg help extensions" for information on enabling extensions
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12191
diff changeset
   373
  [255]
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   374
  $ hg churn
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   375
  hg: unknown command 'churn'
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   376
  'churn' is provided by the following extension:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   377
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   378
      churn  command to display statistics about repository history
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   379
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   380
  use "hg help extensions" for information on enabling extensions
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12191
diff changeset
   381
  [255]
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   382
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   383
Disabled extensions:
10364
de1e7099d100 dispatch: provide help for disabled extensions and commands
Brodie Rao <me+hg@dackz.net>
parents: 9802
diff changeset
   384
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   385
  $ hg help churn
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   386
  churn extension - command to display statistics about repository history
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   387
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   388
  use "hg help extensions" for information on enabling extensions
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   389
  $ hg help patchbomb
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   390
  patchbomb extension - command to send changesets as (a series of) patch emails
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   391
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   392
  use "hg help extensions" for information on enabling extensions
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   393
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   394
Broken disabled extension and command:
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   395
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   396
  $ mkdir hgext
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   397
  $ echo > hgext/__init__.py
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   398
  $ cat > hgext/broken.py <<EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   399
  > "broken extension'
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   400
  > EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   401
  $ cat > path.py <<EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   402
  > import os, sys
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   403
  > sys.path.insert(0, os.environ['HGEXTPATH'])
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   404
  > EOF
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   405
  $ HGEXTPATH=`pwd`
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   406
  $ export HGEXTPATH
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   407
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   408
  $ hg --config extensions.path=./path.py help broken
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   409
  broken extension - (no help text available)
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   410
  
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   411
  use "hg help extensions" for information on enabling extensions
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   412
13191
1aea66b71f4f extensions: warn about invalid extensions when listing disabled commands
Mads Kiilerich <mads@kiilerich.com>
parents: 12399
diff changeset
   413
  $ cat > hgext/forest.py <<EOF
1aea66b71f4f extensions: warn about invalid extensions when listing disabled commands
Mads Kiilerich <mads@kiilerich.com>
parents: 12399
diff changeset
   414
  > cmdtable = None
1aea66b71f4f extensions: warn about invalid extensions when listing disabled commands
Mads Kiilerich <mads@kiilerich.com>
parents: 12399
diff changeset
   415
  > EOF
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   416
  $ hg --config extensions.path=./path.py help foo > /dev/null
13191
1aea66b71f4f extensions: warn about invalid extensions when listing disabled commands
Mads Kiilerich <mads@kiilerich.com>
parents: 12399
diff changeset
   417
  warning: error finding commands in $TESTTMP/hgext/forest.py
12191
56c74b2df53d tests: unify test-extension
Adrian Buehlmann <adrian@cadifra.com>
parents: 11070
diff changeset
   418
  hg: unknown command 'foo'
13191
1aea66b71f4f extensions: warn about invalid extensions when listing disabled commands
Mads Kiilerich <mads@kiilerich.com>
parents: 12399
diff changeset
   419
  warning: error finding commands in $TESTTMP/hgext/forest.py
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12191
diff changeset
   420
  [255]