Patchwork [3,of,3] tests: use system hg only if changelog or dirstate can't be read

login
register
mail settings
Submitter Yuya Nishihara
Date July 2, 2017, 7:12 a.m.
Message ID <a36d466ffd600fa710fc.1498979526@mimosa>
Download mbox | patch
Permalink /patch/21917/
State Accepted
Headers show

Comments

Yuya Nishihara - July 2, 2017, 7:12 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1498969463 -32400
#      Sun Jul 02 13:24:23 2017 +0900
# Node ID a36d466ffd600fa710fcd7444a7a5d4311e71a46
# Parent  cd11e4cb52da6e5ab6cd73249b81e25e98e46009
tests: use system hg only if changelog or dirstate can't be read

The bundled hg should work flawlessly in most cases. Make it depend on
the external installation only if necessary since we can't control the
whole environment.

This patch doesn't implement the "exit 80" idea proposed by Jun. I don't
want to keep the capability checking sync with the actual tests.
Matt Harbison - July 2, 2017, 5:51 p.m.
On Sun, 02 Jul 2017 03:12:06 -0400, Yuya Nishihara <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1498969463 -32400
> #      Sun Jul 02 13:24:23 2017 +0900
> # Node ID a36d466ffd600fa710fcd7444a7a5d4311e71a46
> # Parent  cd11e4cb52da6e5ab6cd73249b81e25e98e46009
> tests: use system hg only if changelog or dirstate can't be read

This series cleared up the errors for me, thanks.
Augie Fackler - July 3, 2017, 7:15 p.m.
On Sun, Jul 02, 2017 at 04:12:06PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1498969463 -32400
> #      Sun Jul 02 13:24:23 2017 +0900
> # Node ID a36d466ffd600fa710fcd7444a7a5d4311e71a46
> # Parent  cd11e4cb52da6e5ab6cd73249b81e25e98e46009
> tests: use system hg only if changelog or dirstate can't be read

queued, thanks

Patch

diff --git a/tests/helpers-testrepo.sh b/tests/helpers-testrepo.sh
--- a/tests/helpers-testrepo.sh
+++ b/tests/helpers-testrepo.sh
@@ -1,5 +1,6 @@ 
-# Invoke the system hg installation (rather than the local hg version being
-# tested).
+# In most cases, the mercurial repository can be read by the bundled hg, but
+# that isn't always true because third-party extensions may change the store
+# format, for example. In which case, the system hg installation is used.
 #
 # 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
@@ -41,11 +42,9 @@  cat >> "$HGRCPATH" << EOF
 evolution = createmarkers
 EOF
 
-# Most test-check-* sourcing this file run "hg files", which is not available
-# in ancient versions of hg. So we double check if "syshg files" works and
-# fallback to hg bundled in the repo.
-syshg files -h >/dev/null 2>/dev/null
-if [ $? -eq 0 ]; then
+# Use the system hg command if the bundled hg can't read the repository with
+# no warning nor error.
+if [ -n "`hg id -R "$TESTDIR/.." 2>&1 >/dev/null`" ]; then
     alias testrepohg=syshg
     alias testrepohgenv=syshgenv
 else