tests/helpers-testrepo.sh
author Adam Simpkins <simpkins@fb.com>
Tue, 27 Jun 2017 17:24:31 -0700
changeset 33116 6c113a7dec52
parent 29219 3c9066ed557c
child 33125 acfce52518c4
permissions -rw-r--r--
tests: use the system hg for examining the local repository Most test scripts use "hg" to interact with a temporary test repository. However a few tests also want to run hg commands to interact with the local repository containing the mercurial source code. Notably, many of the test-check-* tests want to check local files and commit messages. These tests were previously using the version of hg being tested to query the source repository. However, this will fail if the source repository requires extensions or other settings not supported by the version of mercurial being tested. The source repository was typically initially cloned using the system hg installation, so we should use the system hg installation to query it. There was already a helpers-testrepo.sh script designed to help cope with different requirements for the source repository versus the test repositories. However, it only handled the evolve extension. This new behavior works with any extensions that are different between the system installation and the test installation.

# Invoke the system hg installation (rather than the local hg version being
# tested).
#
# We want to use the hg version being tested when interacting with the test
# repository, and the system hg when interacting with the mercurial source code
# repository.
#
# The mercurial source repository was typically orignally cloned with the
# system mercurial installation, and may require extensions or settings from
# the system installation.
syshg () {
    (
        syshgenv
        exec hg "$@"
    )
}

# Revert the environment so that running "hg" runs the system hg
# rather than the test hg installation.
syshgenv () {
    PATH="$ORIG_PATH"
    PYTHONPATH="$ORIG_PYTHONPATH"
    JYTHONPATH="$ORIG_JYTHONPATH"
    unset HGRCPATH
    HGPLAIN=1
    export HGPLAIN
}