Patchwork D11051: run-tests: use more explicit signaling for `chg`

login
register
mail settings
Submitter phabricator
Date July 10, 2021, 12:38 a.m.
Message ID <differential-rev-PHID-DREV-cnpfcn3yttia2fgkwrwr-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49368/
State Superseded
Headers show

Comments

phabricator - July 10, 2021, 12:38 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Using a dedicated variable is clearer and less fragile. It cannot hurt.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/hghave.py
  tests/run-tests.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3177,9 +3177,11 @@ 
         # set CHGHG, then replace "hg" command by "chg"
         chgbindir = self._bindir
         if self.options.chg or self.options.with_chg:
+            osenvironb[b'CHG_INSTALLED_AS_HG'] = b'1'
             osenvironb[b'CHGHG'] = real_hg
         else:
-            osenvironb.pop(b'CHGHG', None)  # drop flag for hghave
+            # drop flag for hghave
+            osenvironb.pop(b'CHG_INSTALLED_AS_HG', None)
         if self.options.chg:
             self._hgcommand = b'chg'
         elif self.options.with_chg:
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -191,7 +191,7 @@ 
 
 @check("chg", "running with chg")
 def has_chg():
-    return 'CHGHG' in os.environ
+    return 'CHG_INSTALLED_AS_HG' in os.environ
 
 
 @check("rhg", "running with rhg as 'hg'")