changeset 33125:acfce52518c4

tests: do not use system hg if it does not have "files" command Ancient hg does not have "hg files" so test-check-*.t will fail with "unknown command 'files'": $ hg files hg: unknown command 'files' $ hg --version Mercurial Distributed SCM (version 2.6.2) Test "hg files" and give up using syshg if it does not have "files" command.
author Jun Wu <quark@fb.com>
date Wed, 28 Jun 2017 13:45:51 -0700
parents 176030f695ca
children 98e2c78e309c
files tests/helpers-testrepo.sh
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/helpers-testrepo.sh	Wed Jun 28 10:50:37 2017 -0700
+++ b/tests/helpers-testrepo.sh	Wed Jun 28 13:45:51 2017 -0700
@@ -25,3 +25,16 @@
     HGPLAIN=1
     export HGPLAIN
 }
+
+# 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 [ $? -ne 0 ]; then
+    syshg() {
+        hg "$@"
+    }
+    syshgenv() {
+        :
+    }
+fi