changeset 53157:a514b0697596

branching: merge stable into default
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 16 Apr 2025 19:13:19 +0200
parents a4b423f655a9 (current diff) 643e7525cb07 (diff)
children bbab51e521a5
files contrib/heptapod-ci.yml rust/hg-core/src/dirstate/on_disk.rs
diffstat 7 files changed, 61 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/heptapod-ci.yml	Wed Mar 19 10:28:37 2025 +0100
+++ b/contrib/heptapod-ci.yml	Wed Apr 16 19:13:19 2025 +0200
@@ -410,6 +410,7 @@
     before_script:
       - export PATH="/home/ci-runner/vendor/pyenv/pyenv-2.4.7-adf3c2bccf09cdb81febcfd15b186711a33ac7a8/shims:/home/ci-runner/vendor/pyenv/pyenv-2.4.7-adf3c2bccf09cdb81febcfd15b186711a33ac7a8/bin:$PATH"
       - echo "PATH, $PATH"
+      - rm -rf "${TMP_WORK_DIR}"/mercurial-ci/  # Clean slate if not using containers
       - hg clone . "${TMP_WORK_DIR}"/mercurial-ci/ --noupdate --config phases.publish=no
       - hg -R "${TMP_WORK_DIR}"/mercurial-ci/ update `hg log --rev '.' --template '{node}'`
       - cd "${TMP_WORK_DIR}"/mercurial-ci/
--- a/hgext/hooklib/reject_new_heads.py	Wed Mar 19 10:28:37 2025 +0100
+++ b/hgext/hooklib/reject_new_heads.py	Wed Apr 16 19:13:19 2025 +0200
@@ -28,6 +28,9 @@
         raise error.Abort(
             _(b'Unsupported hook type %r') % pycompat.bytestr(hooktype)
         )
+    if node is None:
+        return
+
     ctx = repo.unfiltered()[node]
     branches = set()
     for rev in repo.changelog.revs(start=ctx.rev()):
--- a/mercurial/helptext/rust.txt	Wed Mar 19 10:28:37 2025 +0100
+++ b/mercurial/helptext/rust.txt	Wed Apr 16 19:13:19 2025 +0200
@@ -80,6 +80,19 @@
 
 See the "Checking for Rust" section to see if the install succeeded.
 
+Using pipx
+----------
+
+Using pipx is an efficient way to get an isolated installation of mercurial
+available for a user or globally.
+
+  $ pipx install mercurial \
+        --pip-args '--no-cache-dir --config-settings --global-option=--rust --no-binary=mercurial'
+
+You can then add extensions to that install using
+
+  $ pipx inject mercurial hg-foo
+
 From your distribution
 ----------------------
 
--- a/mercurial/httppeer.py	Wed Mar 19 10:28:37 2025 +0100
+++ b/mercurial/httppeer.py	Wed Apr 16 19:13:19 2025 +0200
@@ -160,7 +160,7 @@
             argsio = io.BytesIO(strargs)
             argsio.length = len(strargs)
             data = _multifile(argsio, data)
-        headers['X-HgArgs-Post'] = len(strargs)
+        headers['X-HgArgs-Post'] = b'%d' % len(strargs)
     elif args:
         # Calling self.capable() can infinite loop if we are calling
         # "capabilities". But that command should never accept wire
--- a/mercurial/keepalive.py	Wed Mar 19 10:28:37 2025 +0100
+++ b/mercurial/keepalive.py	Wed Apr 16 19:13:19 2025 +0200
@@ -216,11 +216,15 @@
         host = urllibcompat.gethost(req)
         if not host:
             raise urlerr.urlerror(b'no host given')
+        if req._tunnel_host:  # proxy
+            realhost = req._tunnel_host
+        else:
+            realhost = host
 
         try:
-            h = self._cm.get_ready_conn(host)
+            h = self._cm.get_ready_conn(realhost)
             while h:
-                r = self._reuse_connection(h, req, host)
+                r = self._reuse_connection(h, req, realhost)
 
                 # if this response is non-None, then it worked and we're
                 # done.  Break out, skipping the else block.
@@ -231,7 +235,7 @@
                 # discard it and ask for the next free connection
                 h.close()
                 self._cm.remove(h)
-                h = self._cm.get_ready_conn(host)
+                h = self._cm.get_ready_conn(realhost)
             else:
                 # no (working) free connections were found.  Create a new one.
                 h = http_class(host, timeout=self._timeout)
@@ -239,7 +243,7 @@
                     DEBUG.info(
                         b"creating new connection to %s (%d)", host, id(h)
                     )
-                self._cm.add(host, h, False)
+                self._cm.add(realhost, h, False)
                 self._start_transaction(h, req)
                 r = h.getresponse()
         # The string form of BadStatusLine is the status line. Add some context
--- a/rust/hg-core/src/dirstate/on_disk.rs	Wed Mar 19 10:28:37 2025 +0100
+++ b/rust/hg-core/src/dirstate/on_disk.rs	Wed Apr 16 19:13:19 2025 +0200
@@ -805,13 +805,13 @@
 
             let prefix_length = child_full_path.len()
                 // remove the filename
-                - child.base_name(self.dirstate_map.on_disk)?.len()
-                // remove the slash
-                - 1;
+                - child.base_name(self.dirstate_map.on_disk)?.len();
 
             let child_prefix = &child_full_path.as_bytes()[..prefix_length];
-
-            if child_prefix != full_path.as_bytes() {
+            if child_prefix.last() != Some(&b'/')
+                || &child_prefix[0..child_prefix.len() - 1]
+                    != full_path.as_bytes()
+            {
                 let explanation = format!(
                     "dirstate child node's path '{}' \
                         does not start with its parent's path '{}'",
--- a/tests/test-hooklib-reject_new_heads.t	Wed Mar 19 10:28:37 2025 +0100
+++ b/tests/test-hooklib-reject_new_heads.t	Wed Apr 16 19:13:19 2025 +0200
@@ -51,3 +51,33 @@
   added 1 changesets with 0 changes to 0 files
   new changesets 1ea73414a91b (1 drafts)
   (run 'hg update' to get a working copy)
+
+Test pushing zero changesets
+
+  $ hg init c
+  $ hg --cwd c debugbuilddag '.'
+  $ hg --cwd c log -G
+  o  changeset:   0:1ea73414a91b
+     tag:         tip
+     user:        debugbuilddag
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     r0
+  
+  $ cat <<EOF >> c/.hg/hgrc
+  > [hooks]
+  > pretxnclose.reject_new_heads = \
+  >   python:hgext.hooklib.reject_new_heads.hook
+  > EOF
+  $ hg init d
+  $ hg --cwd c push ../d
+  pushing to ../d
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 0 changes to 0 files
+  $ hg --cwd c push ../d
+  pushing to ../d
+  searching for changes
+  no changes found
+  [1]