##// END OF EJS Templates
tests: use system hg only if changelog or dirstate can't be read...
Yuya Nishihara -
r33201:45d6e276 default
parent child Browse files
Show More
@@ -1,54 +1,53
1 # Invoke the system hg installation (rather than the local hg version being
1 # In most cases, the mercurial repository can be read by the bundled hg, but
2 # tested).
2 # that isn't always true because third-party extensions may change the store
3 # format, for example. In which case, the system hg installation is used.
3 #
4 #
4 # We want to use the hg version being tested when interacting with the test
5 # We want to use the hg version being tested when interacting with the test
5 # repository, and the system hg when interacting with the mercurial source code
6 # repository, and the system hg when interacting with the mercurial source code
6 # repository.
7 # repository.
7 #
8 #
8 # The mercurial source repository was typically orignally cloned with the
9 # The mercurial source repository was typically orignally cloned with the
9 # system mercurial installation, and may require extensions or settings from
10 # system mercurial installation, and may require extensions or settings from
10 # the system installation.
11 # the system installation.
11 syshg () {
12 syshg () {
12 (
13 (
13 syshgenv
14 syshgenv
14 exec hg "$@"
15 exec hg "$@"
15 )
16 )
16 }
17 }
17
18
18 # Revert the environment so that running "hg" runs the system hg
19 # Revert the environment so that running "hg" runs the system hg
19 # rather than the test hg installation.
20 # rather than the test hg installation.
20 syshgenv () {
21 syshgenv () {
21 . "$HGTEST_RESTOREENV"
22 . "$HGTEST_RESTOREENV"
22 HGPLAIN=1
23 HGPLAIN=1
23 export HGPLAIN
24 export HGPLAIN
24 }
25 }
25
26
26 # The test-repo is a live hg repository which may have evolution markers
27 # The test-repo is a live hg repository which may have evolution markers
27 # created, e.g. when a ~/.hgrc enabled evolution.
28 # created, e.g. when a ~/.hgrc enabled evolution.
28 #
29 #
29 # Tests may be run using a custom HGRCPATH, which do not enable evolution
30 # Tests may be run using a custom HGRCPATH, which do not enable evolution
30 # markers by default.
31 # markers by default.
31 #
32 #
32 # If test-repo includes evolution markers, and we do not enable evolution
33 # If test-repo includes evolution markers, and we do not enable evolution
33 # markers, hg will occasionally complain when it notices them, which disrupts
34 # markers, hg will occasionally complain when it notices them, which disrupts
34 # tests resulting in sporadic failures.
35 # tests resulting in sporadic failures.
35 #
36 #
36 # Since we aren't performing any write operations on the test-repo, there's
37 # Since we aren't performing any write operations on the test-repo, there's
37 # no harm in telling hg that we support evolution markers, which is what the
38 # no harm in telling hg that we support evolution markers, which is what the
38 # following lines for the hgrc file do:
39 # following lines for the hgrc file do:
39 cat >> "$HGRCPATH" << EOF
40 cat >> "$HGRCPATH" << EOF
40 [experimental]
41 [experimental]
41 evolution = createmarkers
42 evolution = createmarkers
42 EOF
43 EOF
43
44
44 # Most test-check-* sourcing this file run "hg files", which is not available
45 # Use the system hg command if the bundled hg can't read the repository with
45 # in ancient versions of hg. So we double check if "syshg files" works and
46 # no warning nor error.
46 # fallback to hg bundled in the repo.
47 if [ -n "`hg id -R "$TESTDIR/.." 2>&1 >/dev/null`" ]; then
47 syshg files -h >/dev/null 2>/dev/null
48 if [ $? -eq 0 ]; then
49 alias testrepohg=syshg
48 alias testrepohg=syshg
50 alias testrepohgenv=syshgenv
49 alias testrepohgenv=syshgenv
51 else
50 else
52 alias testrepohg=hg
51 alias testrepohg=hg
53 alias testrepohgenv=:
52 alias testrepohgenv=:
54 fi
53 fi
General Comments 0
You need to be logged in to leave comments. Login now