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