[Commented On] D10096: tests: Add `rhg` and `no-rhg` for #require and #if in .t files

baymax (Baymax, Your Personal Patch-care Companion) phabricator at mercurial-scm.org
Thu Mar 4 13:01:43 UTC 2021


baymax added a comment.
baymax updated this revision to Diff 26070.


  ✅ refresh by Heptapod after a successful CI run (🐙 💚)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10096?vs=26051&id=26070

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10096/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D10096

AFFECTED FILES
  tests/hghave.py
  tests/run-tests.py
  tests/test-rhg.t

CHANGE DETAILS

diff --git a/tests/test-rhg.t b/tests/test-rhg.t
--- a/tests/test-rhg.t
+++ b/tests/test-rhg.t
@@ -1,15 +1,4 @@
-#require rust
-
-Define an rhg function that will only run if rhg exists
-  $ RHG="$RUNTESTDIR/../rust/target/release/rhg"
-  $ rhg() {
-  > if [ -f "$RHG" ]; then
-  >   "$RHG" "$@"
-  > else
-  >   echo "skipped: Cannot find rhg. Try to run cargo build in rust/rhg."
-  >   exit 80
-  > fi
-  > }
+#require rhg
 
   $ NO_FALLBACK="--config=rhg.on-unsupported=abort"
 
@@ -169,8 +158,8 @@
   unsupported feature: `rhg cat` without `--rev` / `-r`
   [252]
 
-  $ rhg cat original --config rhg.fallback-executable="$RHG"
-  Blocking recursive fallback. The 'rhg.fallback-executable = */rust/target/release/rhg' config points to `rhg` itself. (glob)
+  $ rhg cat original --config rhg.fallback-executable=rhg
+  Blocking recursive fallback. The 'rhg.fallback-executable = rhg' config points to `rhg` itself.
   unsupported feature: `rhg cat` without `--rev` / `-r`
   [252]
 
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3144,6 +3144,7 @@
         rhgbindir = self._bindir
         if self.options.rhg or self.options.with_rhg:
             self._rhg_fallback_exe = os.path.join(self._bindir, self._hgcommand)
+            osenvironb[b'RHG_INSTALLED_AS_HG'] = b'1'  # For hghave.py
         if self.options.rhg:
             self._hgcommand = b'rhg'
         elif self.options.with_rhg:
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -188,6 +188,11 @@
     return 'CHGHG' in os.environ
 
 
+ at check("rhg", "running with rhg as 'hg'")
+def has_rhg():
+    return 'RHG_INSTALLED_AS_HG' in os.environ
+
+
 @check("cvs", "cvs client/server")
 def has_cvs():
     re = br'Concurrent Versions System.*?server'



To: SimonSapin, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210304/54fedbc1/attachment-0002.html>


More information about the Mercurial-patches mailing list