changeset 51963:5e2f0fec0a47

branching: merge stable into default
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 08 Oct 2024 21:46:22 +0200
parents 3b46e8e6a401 (current diff) 7b8769cca23d (diff)
children d7f17819ae9e
files contrib/heptapod-ci.yml mercurial/policy.py tests/helpers-testrepo.sh tests/run-tests.py tests/test-doctest.py
diffstat 7 files changed, 29 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Fri Oct 04 13:26:29 2024 -0400
+++ b/contrib/check-code.py	Tue Oct 08 21:46:22 2024 +0200
@@ -161,7 +161,11 @@
         (r'(\[|\btest\b).*-e ', "don't use 'test -e', use 'test -f'"),
         (r'\[\[\s+[^\]]*\]\]', "don't use '[[ ]]', use '[ ]'"),
         (r'^alias\b.*=', "don't use alias, use a function"),
-        (r'if\s*!', "don't use '!' to negate exit status"),
+        # Solaris sh can not negate exit status with '!'
+        (
+            r'if\s*!',
+            "don't use '!' to negate exit status (use `||` or if/else)",
+        ),
         (r'/dev/u?random', "don't use entropy, use /dev/zero"),
         (r'do\s*true;\s*done', "don't use true as loop body, use sleep 0"),
         (
--- a/contrib/heptapod-ci.yml	Fri Oct 04 13:26:29 2024 -0400
+++ b/contrib/heptapod-ci.yml	Tue Oct 08 21:46:22 2024 +0200
@@ -26,7 +26,6 @@
 
 variables:
     PYTHON: python
-    TEST_HGMODULEPOLICY: "allow"
     HG_CI_IMAGE_TAG: "v2.1"
     TEST_HGTESTS_ALLOW_NETIO: "0"
 
@@ -49,7 +48,7 @@
       - ls -1 tests/test-check-*.* > /tmp/check-tests.txt
     script:
         - echo "$RUNTEST_ARGS"
-        - HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" HGMODULEPOLICY="$TEST_HGMODULEPOLICY" "$PYTHON" tests/run-tests.py --color=always $RUNTEST_ARGS
+        - HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" "$PYTHON" tests/run-tests.py --color=always $RUNTEST_ARGS
 
 checks:
     <<: *runtests
@@ -70,34 +69,29 @@
     <<: *runtests
     variables:
         RUNTEST_ARGS: " --no-rust --blacklist /tmp/check-tests.txt"
-        TEST_HGMODULEPOLICY: "c"
         TEST_HGTESTS_ALLOW_NETIO: "1"
 
 test-pure:
     <<: *runtests
     variables:
         RUNTEST_ARGS: "--pure --blacklist /tmp/check-tests.txt"
-        TEST_HGMODULEPOLICY: "py"
 
 test-rust: &test_rust
     <<: *runtests
     variables:
         HGWITHRUSTEXT: cpython
         RUNTEST_ARGS: "--rust --blacklist /tmp/check-tests.txt"
-        TEST_HGMODULEPOLICY: "rust+c"
 
 test-rhg:
     <<: *runtests
     variables:
         HGWITHRUSTEXT: cpython
         RUNTEST_ARGS: "--rust --rhg --blacklist /tmp/check-tests.txt"
-        TEST_HGMODULEPOLICY: "rust+c"
 
 test-chg:
     <<: *runtests
     variables:
         RUNTEST_ARGS: "--blacklist /tmp/check-tests.txt --chg"
-        TEST_HGMODULEPOLICY: "c"
 
 # note: we should probably get a full matrix for flavor × py-version, but this
 # is a simple start to be able to check if we break the lowest supported
@@ -156,14 +150,13 @@
         - echo "$Env:TMP"
         - echo "$Env:TEMP"
 
-        - C:/MinGW/msys/1.0/bin/sh.exe --login -c 'cd "$OLDPWD" && HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" HGMODULEPOLICY="$TEST_HGMODULEPOLICY" $PYTHON tests/run-tests.py --color=always $RUNTEST_ARGS'
+        - C:/MinGW/msys/1.0/bin/sh.exe --login -c 'cd "$OLDPWD" && HGTESTS_ALLOW_NETIO="$TEST_HGTESTS_ALLOW_NETIO" $PYTHON tests/run-tests.py --color=always $RUNTEST_ARGS'
 
 windows:
     <<: *windows_runtests
     tags:
       - windows
     variables:
-        TEST_HGMODULEPOLICY: "c"
         RUNTEST_ARGS: "--blacklist C:/Temp/check-tests.txt"
         PYTHON: py -3
 
@@ -172,6 +165,5 @@
     tags:
       - windows
     variables:
-        TEST_HGMODULEPOLICY: "c"
         RUNTEST_ARGS: "--blacklist C:/Temp/check-tests.txt --pyoxidized"
         PYTHON: py -3
--- a/mercurial/policy.py	Fri Oct 04 13:26:29 2024 -0400
+++ b/mercurial/policy.py	Tue Oct 08 21:46:22 2024 +0200
@@ -60,7 +60,7 @@
     policy: bytes = b'cffi'
 
 # Environment variable can always force settings.
-if 'HGMODULEPOLICY' in os.environ:
+if os.environ.get('HGMODULEPOLICY'):  # ignore None and Empty
     policy: bytes = os.environ['HGMODULEPOLICY'].encode('utf-8')
 
 
--- a/rust/hg-cpython/Cargo.toml	Fri Oct 04 13:26:29 2024 -0400
+++ b/rust/hg-cpython/Cargo.toml	Tue Oct 08 21:46:22 2024 +0200
@@ -9,7 +9,7 @@
 crate-type = ["cdylib"]
 
 [dependencies]
-cpython = { version = "0.7.1", features = ["extension-module"] }
+cpython = { version = "0.7.2", features = ["extension-module"] }
 crossbeam-channel = "0.5.6"
 hg-core = { path = "../hg-core"}
 libc = "0.2.137"
--- a/tests/helpers-testrepo.sh	Fri Oct 04 13:26:29 2024 -0400
+++ b/tests/helpers-testrepo.sh	Tue Oct 08 21:46:22 2024 +0200
@@ -29,6 +29,12 @@
     . "$HGTEST_RESTOREENV"
     HGPLAIN=1
     export HGPLAIN
+    if [ -n "$HGTEST_BASE_HGMODULEPOLICY" ]; then
+        HGMODULEPOLICY="$HGTEST_BASE_HGMODULEPOLICY"
+    else
+        unset HGMODULEPOLICY
+    fi
+    export HGMODULEPOLICY
 }
 
 # The test-repo is a live hg repository which may have evolution markers
--- a/tests/run-tests.py	Fri Oct 04 13:26:29 2024 -0400
+++ b/tests/run-tests.py	Tue Oct 08 21:46:22 2024 +0200
@@ -3372,6 +3372,10 @@
             pypath.append(oldpypath)
         osenvironb[IMPL_PATH] = sepb.join(pypath)
 
+        os.environ["HGTEST_BASE_HGMODULEPOLICY"] = os.environ.get(
+            "HGMODULEPOLICY", ""
+        )
+
         if self.options.pure:
             os.environ["HGTEST_RUN_TESTS_PURE"] = "--pure"
             os.environ["HGMODULEPOLICY"] = "py"
@@ -3781,15 +3785,18 @@
         vlog("# Performing temporary installation of HG")
         installerrs = os.path.join(self._hgtmp, b"install.err")
         compiler = ''
+        install_env = original_env.copy()
         if self.options.compiler:
             compiler = '--compiler ' + self.options.compiler
         setup_opts = b""
         if self.options.pure:
             setup_opts = b"--pure"
+            install_env.pop('HGWITHRUSTEXT', None)
         elif self.options.rust:
             setup_opts = b"--rust"
         elif self.options.no_rust:
             setup_opts = b"--no-rust"
+            install_env.pop('HGWITHRUSTEXT', None)
 
         # Run installer in hg root
         compiler = _sys2bytes(compiler)
@@ -3835,7 +3842,7 @@
         makedirs(self._bindir)
 
         vlog("# Running", cmd.decode("utf-8"))
-        if subprocess.call(_bytes2sys(cmd), shell=True, env=original_env) == 0:
+        if subprocess.call(_bytes2sys(cmd), shell=True, env=install_env) == 0:
             if not self.options.verbose:
                 try:
                     os.remove(installerrs)
--- a/tests/test-contrib-relnotes.t	Fri Oct 04 13:26:29 2024 -0400
+++ b/tests/test-contrib-relnotes.t	Tue Oct 08 21:46:22 2024 +0200
@@ -2,6 +2,12 @@
   $ . "$TESTDIR/helpers-testrepo.sh"
 
   $ cd $TESTDIR/..
+  $ if hg root 2> /dev/null >&2; then true;
+  > else
+  >   echo 'skipped: cannot read the source repository';
+  >   exit 80;
+  > fi
+
   $ python3 contrib/relnotes 4.4 --stoprev 4.5
   changeset 3398603c5621: unexpected block in release notes directive feature
   New Features