tests/test-extension.t
changeset 23624 861ddedfb402
parent 23172 e955549cd045
child 23869 d9967b82394a
equal deleted inserted replaced
23623:80a37f706011 23624:861ddedfb402
   460   
   460   
   461   list of commands:
   461   list of commands:
   462   
   462   
   463    extdiff       use external program to diff repository (or selected files)
   463    extdiff       use external program to diff repository (or selected files)
   464   
   464   
   465   (use "hg help -v extdiff" to show built-in aliases and global options)
   465   (use "hg help -v -e extdiff" to show built-in aliases and global options)
   466 
   466 
   467 
   467 
   468 
   468 
   469 
   469 
   470 
   470 
   570 
   570 
   571   $ hg debugextensions
   571   $ hg debugextensions
   572   debugissue811
   572   debugissue811
   573   strip
   573   strip
   574   mq
   574   mq
       
   575 
       
   576 For extensions, which name matches one of its commands, help
       
   577 message should ask '-v -e' to get list of built-in aliases
       
   578 along with extension help itself
       
   579 
       
   580   $ mkdir $TESTTMP/d
       
   581   $ cat > $TESTTMP/d/dodo.py <<EOF
       
   582   > """
       
   583   > This is an awesome 'dodo' extension. It does nothing and
       
   584   > writes 'Foo foo'
       
   585   > """
       
   586   > from mercurial import cmdutil, commands
       
   587   > cmdtable = {}
       
   588   > command = cmdutil.command(cmdtable)
       
   589   > @command('dodo', [], 'hg dodo')
       
   590   > def dodo(ui, *args, **kwargs):
       
   591   >     """Does nothing"""
       
   592   >     ui.write("I do nothing. Yay\\n")
       
   593   > @command('foofoo', [], 'hg foofoo')
       
   594   > def foofoo(ui, *args, **kwargs):
       
   595   >     """Writes 'Foo foo'"""
       
   596   >     ui.write("Foo foo\\n")
       
   597   > EOF
       
   598   $ dodopath=$TESTTMP/d/dodo.py
       
   599 
       
   600   $ echo "dodo = $dodopath" >> $HGRCPATH
       
   601 
       
   602 Make sure that user is asked to enter '-v -e' to get list of built-in aliases
       
   603   $ hg help -e dodo
       
   604   dodo extension -
       
   605   
       
   606   This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
       
   607   
       
   608   list of commands:
       
   609   
       
   610    dodo          Does nothing
       
   611    foofoo        Writes 'Foo foo'
       
   612   
       
   613   (use "hg help -v -e dodo" to show built-in aliases and global options)
       
   614 
       
   615 Make sure that '-v -e' prints list of built-in aliases along with
       
   616 extension help itself
       
   617   $ hg help -v -e dodo
       
   618   dodo extension -
       
   619   
       
   620   This is an awesome 'dodo' extension. It does nothing and writes 'Foo foo'
       
   621   
       
   622   list of commands:
       
   623   
       
   624    dodo          Does nothing
       
   625    foofoo        Writes 'Foo foo'
       
   626   
       
   627   global options ([+] can be repeated):
       
   628   
       
   629    -R --repository REPO   repository root directory or name of overlay bundle
       
   630                           file
       
   631       --cwd DIR           change working directory
       
   632    -y --noninteractive    do not prompt, automatically pick the first choice for
       
   633                           all prompts
       
   634    -q --quiet             suppress output
       
   635    -v --verbose           enable additional output
       
   636       --config CONFIG [+] set/override config option (use 'section.name=value')
       
   637       --debug             enable debugging output
       
   638       --debugger          start debugger
       
   639       --encoding ENCODE   set the charset encoding (default: ascii)
       
   640       --encodingmode MODE set the charset encoding mode (default: strict)
       
   641       --traceback         always print a traceback on exception
       
   642       --time              time how long the command takes
       
   643       --profile           print command execution profile
       
   644       --version           output version information and exit
       
   645    -h --help              display help and exit
       
   646       --hidden            consider hidden changesets
       
   647 
       
   648 Make sure that single '-v' option shows help and built-ins only for 'dodo' command
       
   649   $ hg help -v dodo
       
   650   hg dodo
       
   651   
       
   652   Does nothing
       
   653   
       
   654   (use "hg help -e dodo" to show help for the dodo extension)
       
   655   
       
   656   options:
       
   657   
       
   658     --mq operate on patch repository
       
   659   
       
   660   global options ([+] can be repeated):
       
   661   
       
   662    -R --repository REPO   repository root directory or name of overlay bundle
       
   663                           file
       
   664       --cwd DIR           change working directory
       
   665    -y --noninteractive    do not prompt, automatically pick the first choice for
       
   666                           all prompts
       
   667    -q --quiet             suppress output
       
   668    -v --verbose           enable additional output
       
   669       --config CONFIG [+] set/override config option (use 'section.name=value')
       
   670       --debug             enable debugging output
       
   671       --debugger          start debugger
       
   672       --encoding ENCODE   set the charset encoding (default: ascii)
       
   673       --encodingmode MODE set the charset encoding mode (default: strict)
       
   674       --traceback         always print a traceback on exception
       
   675       --time              time how long the command takes
       
   676       --profile           print command execution profile
       
   677       --version           output version information and exit
       
   678    -h --help              display help and exit
       
   679       --hidden            consider hidden changesets
       
   680 
       
   681 In case when extension name doesn't match any of its commands,
       
   682 help message should ask for '-v' to get list of built-in aliases
       
   683 along with extension help
       
   684   $ cat > $TESTTMP/d/dudu.py <<EOF
       
   685   > """
       
   686   > This is an awesome 'dudu' extension. It does something and
       
   687   > also writes 'Beep beep'
       
   688   > """
       
   689   > from mercurial import cmdutil, commands
       
   690   > cmdtable = {}
       
   691   > command = cmdutil.command(cmdtable)
       
   692   > @command('something', [], 'hg something')
       
   693   > def something(ui, *args, **kwargs):
       
   694   >     """Does something"""
       
   695   >     ui.write("I do something. Yaaay\\n")
       
   696   > @command('beep', [], 'hg beep')
       
   697   > def beep(ui, *args, **kwargs):
       
   698   >     """Writes 'Beep beep'"""
       
   699   >     ui.write("Beep beep\\n")
       
   700   > EOF
       
   701   $ dudupath=$TESTTMP/d/dudu.py
       
   702 
       
   703   $ echo "dudu = $dudupath" >> $HGRCPATH
       
   704 
       
   705   $ hg help -e dudu
       
   706   dudu extension -
       
   707   
       
   708   This is an awesome 'dudu' extension. It does something and also writes 'Beep
       
   709   beep'
       
   710   
       
   711   list of commands:
       
   712   
       
   713    beep          Writes 'Beep beep'
       
   714    something     Does something
       
   715   
       
   716   (use "hg help -v dudu" to show built-in aliases and global options)
       
   717 
       
   718 In case when extension name doesn't match any of its commands,
       
   719 help options '-v' and '-v -e' should be equivalent
       
   720   $ hg help -v dudu
       
   721   dudu extension -
       
   722   
       
   723   This is an awesome 'dudu' extension. It does something and also writes 'Beep
       
   724   beep'
       
   725   
       
   726   list of commands:
       
   727   
       
   728    beep          Writes 'Beep beep'
       
   729    something     Does something
       
   730   
       
   731   global options ([+] can be repeated):
       
   732   
       
   733    -R --repository REPO   repository root directory or name of overlay bundle
       
   734                           file
       
   735       --cwd DIR           change working directory
       
   736    -y --noninteractive    do not prompt, automatically pick the first choice for
       
   737                           all prompts
       
   738    -q --quiet             suppress output
       
   739    -v --verbose           enable additional output
       
   740       --config CONFIG [+] set/override config option (use 'section.name=value')
       
   741       --debug             enable debugging output
       
   742       --debugger          start debugger
       
   743       --encoding ENCODE   set the charset encoding (default: ascii)
       
   744       --encodingmode MODE set the charset encoding mode (default: strict)
       
   745       --traceback         always print a traceback on exception
       
   746       --time              time how long the command takes
       
   747       --profile           print command execution profile
       
   748       --version           output version information and exit
       
   749    -h --help              display help and exit
       
   750       --hidden            consider hidden changesets
       
   751 
       
   752   $ hg help -v -e dudu
       
   753   dudu extension -
       
   754   
       
   755   This is an awesome 'dudu' extension. It does something and also writes 'Beep
       
   756   beep'
       
   757   
       
   758   list of commands:
       
   759   
       
   760    beep          Writes 'Beep beep'
       
   761    something     Does something
       
   762   
       
   763   global options ([+] can be repeated):
       
   764   
       
   765    -R --repository REPO   repository root directory or name of overlay bundle
       
   766                           file
       
   767       --cwd DIR           change working directory
       
   768    -y --noninteractive    do not prompt, automatically pick the first choice for
       
   769                           all prompts
       
   770    -q --quiet             suppress output
       
   771    -v --verbose           enable additional output
       
   772       --config CONFIG [+] set/override config option (use 'section.name=value')
       
   773       --debug             enable debugging output
       
   774       --debugger          start debugger
       
   775       --encoding ENCODE   set the charset encoding (default: ascii)
       
   776       --encodingmode MODE set the charset encoding mode (default: strict)
       
   777       --traceback         always print a traceback on exception
       
   778       --time              time how long the command takes
       
   779       --profile           print command execution profile
       
   780       --version           output version information and exit
       
   781    -h --help              display help and exit
       
   782       --hidden            consider hidden changesets
   575 
   783 
   576 Disabled extension commands:
   784 Disabled extension commands:
   577 
   785 
   578   $ ORGHGRCPATH=$HGRCPATH
   786   $ ORGHGRCPATH=$HGRCPATH
   579   $ HGRCPATH=
   787   $ HGRCPATH=