diff --git a/tests/helpers-testrepo.sh b/tests/helpers-testrepo.sh --- a/tests/helpers-testrepo.sh +++ b/tests/helpers-testrepo.sh @@ -9,6 +9,13 @@ # The mercurial source repository was typically orignally cloned with the # system mercurial installation, and may require extensions or settings from # the system installation. + +if [ -n $HGTESTEXTRAEXTENSIONS ]; then + for extension in $HGTESTEXTRAEXTENSIONS; do + extraoptions="$extraoptions --config extensions.$extension=!" + done +fi + syshg () { ( syshgenv @@ -48,6 +55,6 @@ alias testrepohg=syshg alias testrepohgenv=syshgenv else - alias testrepohg=hg + alias testrepohg="hg $extraoptions" alias testrepohgenv=: fi diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -718,6 +718,10 @@ except (ImportError, AttributeError): return False +@check('extraextensions', 'whether tests are running with extra extensions') +def has_extraextensions(): + return 'HGTESTEXTRAEXTENSIONS' in os.environ + def getrepofeatures(): """Obtain set of repository features in use. diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1070,6 +1070,17 @@ env["HGENCODINGMODE"] = "strict" env['HGIPV6'] = str(int(self._useipv6)) + extraextensions = [] + for opt in self._extraconfigopts: + section, key = opt.encode('utf-8').split(b'.', 1) + if section != 'extensions': + continue + name = key.split(b'=', 1)[0] + extraextensions.append(name) + + if extraextensions: + env['HGTESTEXTRAEXTENSIONS'] = b' '.join(extraextensions) + # LOCALIP could be ::1 or 127.0.0.1. Useful for tests that require raw # IP addresses. env['LOCALIP'] = self._localip() diff --git a/tests/test-basic.t b/tests/test-basic.t --- a/tests/test-basic.t +++ b/tests/test-basic.t @@ -1,5 +1,6 @@ Create a repository: +#if no-extraextensions $ hg config devel.all-warnings=true devel.default-date=0 0 @@ -13,6 +14,8 @@ web.address=localhost web\.ipv6=(?:True|False) (re) web.server-header=testing stub value +#endif + $ hg init t $ cd t diff --git a/tests/test-debugextensions.t b/tests/test-debugextensions.t --- a/tests/test-debugextensions.t +++ b/tests/test-debugextensions.t @@ -1,4 +1,6 @@ +#if no-extraextensions $ hg debugextensions +#endif $ debugpath=`pwd`/extwithoutinfos.py @@ -19,6 +21,10 @@ > ext2 = `pwd`/extwithinfos.py > EOF + $ for extension in $HGTESTEXTRAEXTENSIONS; do + > echo "$extension=!" >> $HGRCPATH + > done + $ hg debugextensions ext1 (untested!) ext2 (3.2.1!) diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -867,9 +867,11 @@ Show extensions: (note that mq force load strip, also checking it's not loaded twice) +#if no-extraextensions $ hg debugextensions mq strip +#endif For extensions, which name matches one of its commands, help message should ask '-v -e' to get list of built-in aliases diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t --- a/tests/test-globalopts.t +++ b/tests/test-globalopts.t @@ -289,6 +289,8 @@ Testing -h/--help: +#if no-extraextensions + $ hg -h Mercurial Distributed SCM @@ -372,8 +374,6 @@ (use 'hg help -v' to show built-in aliases and global options) - - $ hg --help Mercurial Distributed SCM @@ -457,5 +457,7 @@ (use 'hg help -v' to show built-in aliases and global options) +#endif + Not tested: --debugger diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -44,6 +44,10 @@ summary summarize working directory state update update working directory (or switch revisions) +Extra extensions will be printed in help output in a non-reliable order since +the extension is unknown. +#if no-extraextensions + $ hg help Mercurial Distributed SCM @@ -283,6 +287,8 @@ win32mbcs allow the use of MBCS paths with problematic encodings zeroconf discover and advertise repositories on the local network +#endif + Verify that deprecated extensions are included if --verbose: $ hg -v help extensions | grep children @@ -816,6 +822,8 @@ Test that default list of commands omits extension commands +#if no-extraextensions + $ hg help Mercurial Distributed SCM @@ -903,6 +911,7 @@ (use 'hg help -v' to show built-in aliases and global options) +#endif Test list of internal help commands