Mercurial > hg-stable
annotate tests/helpers-testrepo.sh @ 33128:6c113a7dec52
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.
author | Adam Simpkins <simpkins@fb.com> |
---|---|
date | Tue, 27 Jun 2017 17:24:31 -0700 |
parents | 3c9066ed557c |
children | acfce52518c4 |
rev | line source |
---|---|
33128
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
1 # Invoke the system hg installation (rather than the local hg version being |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
2 # tested). |
29219
3c9066ed557c
tests: silence test-repo obsolete warning
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
3 # |
33128
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
4 # We want to use the hg version being tested when interacting with the test |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
5 # repository, and the system hg when interacting with the mercurial source code |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
6 # repository. |
29219
3c9066ed557c
tests: silence test-repo obsolete warning
timeless <timeless@mozdev.org>
parents:
diff
changeset
|
7 # |
33128
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
8 # The mercurial source repository was typically orignally cloned with the |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
9 # system mercurial installation, and may require extensions or settings from |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
10 # the system installation. |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
11 syshg () { |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
12 ( |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
13 syshgenv |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
14 exec hg "$@" |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
15 ) |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
16 } |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
17 |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
18 # Revert the environment so that running "hg" runs the system hg |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
19 # rather than the test hg installation. |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
20 syshgenv () { |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
21 PATH="$ORIG_PATH" |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
22 PYTHONPATH="$ORIG_PYTHONPATH" |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
23 JYTHONPATH="$ORIG_JYTHONPATH" |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
24 unset HGRCPATH |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
25 HGPLAIN=1 |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
26 export HGPLAIN |
6c113a7dec52
tests: use the system hg for examining the local repository
Adam Simpkins <simpkins@fb.com>
parents:
29219
diff
changeset
|
27 } |