branching: merge stable into default
authorRaphaël Gomès <rgomes@octobus.net>
Wed, 08 Jun 2022 15:46:04 +0200
changeset 49279 127d33e63d1a
parent 49275 c6a3243567b6 (current diff)
parent 49278 234aaf0184f3 (diff)
child 49280 311fcc5a65f6
branching: merge stable into default
contrib/heptapod-ci.yml
hgdemandimport/__init__.py
mercurial/revset.py
mercurial/url.py
rust/hg-core/Cargo.toml
tests/hghave.py
tests/test-https.t
tests/tinyproxy.py
--- a/contrib/heptapod-ci.yml	Thu Jun 02 23:57:56 2022 +0200
+++ b/contrib/heptapod-ci.yml	Wed Jun 08 15:46:04 2022 +0200
@@ -1,6 +1,5 @@
 stages:
   - tests
-  - phabricator
 
 image: registry.heptapod.net/mercurial/ci-images/mercurial-core:$HG_CI_IMAGE_TAG
 
@@ -45,24 +44,6 @@
     variables:
         PYTHON: python3
 
-phabricator-refresh:
-    stage: phabricator
-    except:
-      refs:
-        - merge_requests
-      variables:
-        - $PHABRICATOR_TOKEN == "NO-PHAB"
-    variables:
-      DEFAULT_COMMENT: ":white_check_mark: refresh by Heptapod after a successful CI run (:octopus: :green_heart:)"
-      STABLE_COMMENT: ":white_check_mark: refresh by Heptapod after a successful CI run (:octopus: :green_heart:)\n⚠ This patch is intended for stable ⚠\n{image https://media.giphy.com/media/nYI8SmmChYXK0/source.gif}"
-    script:
-      - |
-        if [ `hg branch` == "stable" ]; then
-            ./contrib/phab-refresh-stack.sh --comment "$STABLE_COMMENT";
-        else
-            ./contrib/phab-refresh-stack.sh --comment "$DEFAULT_COMMENT";
-        fi
-
 test-c:
     <<: *runtests
     variables:
--- a/contrib/packaging/docker/rhel8	Thu Jun 02 23:57:56 2022 +0200
+++ b/contrib/packaging/docker/rhel8	Wed Jun 08 15:46:04 2022 +0200
@@ -16,3 +16,6 @@
 
 # For rust extensions
 RUN yum install -y cargo
+
+# avoid incorrect docker image permissions on /tmp preventing writes by non-root users
+RUN chmod 1777 /tmp
--- a/hgdemandimport/__init__.py	Thu Jun 02 23:57:56 2022 +0200
+++ b/hgdemandimport/__init__.py	Wed Jun 08 15:46:04 2022 +0200
@@ -62,6 +62,9 @@
 if _pypy:
     # _ctypes.pointer is shadowed by "from ... import pointer" (PyPy 5)
     IGNORES.add('_ctypes.pointer')
+    # pure Python module on PyPy, must be loaded to raise ModuleNotFoundError
+    # on non-Windows platforms
+    IGNORES.add('msvcrt')
 
 demandimport.init(IGNORES)
 
--- a/mercurial/revset.py	Thu Jun 02 23:57:56 2022 +0200
+++ b/mercurial/revset.py	Wed Jun 08 15:46:04 2022 +0200
@@ -1338,10 +1338,12 @@
 
 @predicate(b'nodefromfile(path)')
 def nodefromfile(repo, subset, x):
-    """
-    An alias for ``::.`` (ancestors of the working directory's first parent).
-    If file pattern is specified, the histories of files matching given
-    pattern in the revision given by startrev are followed, including copies.
+    """Read a list of nodes from the file at `path`.
+
+    This applies `id(LINE)` to each line of the file.
+
+    This is useful when the amount of nodes you need to specify gets too large
+    for the command line.
     """
     path = getstring(x, _(b"nodefromfile require a file path"))
     listed_rev = set()
--- a/mercurial/url.py	Thu Jun 02 23:57:56 2022 +0200
+++ b/mercurial/url.py	Wed Jun 08 15:46:04 2022 +0200
@@ -12,7 +12,6 @@
 import socket
 
 from .i18n import _
-from .pycompat import getattr
 from . import (
     encoding,
     error,
@@ -198,15 +197,6 @@
     # must be able to send big bundle as stream.
     send = _gen_sendfile(keepalive.HTTPConnection.send)
 
-    def getresponse(self):
-        proxyres = getattr(self, 'proxyres', None)
-        if proxyres:
-            if proxyres.will_close:
-                self.close()
-            self.proxyres = None
-            return proxyres
-        return keepalive.HTTPConnection.getresponse(self)
-
 
 # Large parts of this function have their origin from before Python 2.6
 # and could potentially be removed.
@@ -255,77 +245,15 @@
             break
         # skip lines that are all whitespace
         list(iter(lambda: res.fp.readline().strip(), b''))
-    res.status = status
-    res.reason = reason.strip()
 
-    if res.status == 200:
+    if status == 200:
         # skip lines until we find a blank line
         list(iter(res.fp.readline, b'\r\n'))
-        return True
-
-    if version == b'HTTP/1.0':
-        res.version = 10
-    elif version.startswith(b'HTTP/1.'):
-        res.version = 11
-    elif version == b'HTTP/0.9':
-        res.version = 9
     else:
-        raise httplib.UnknownProtocol(version)
-
-    if res.version == 9:
-        res.length = None
-        res.chunked = 0
-        res.will_close = 1
-        res.msg = httplib.HTTPMessage(stringio())
-        return False
-
-    res.msg = httplib.HTTPMessage(res.fp)
-    res.msg.fp = None
-
-    # are we using the chunked-style of transfer encoding?
-    trenc = res.msg.getheader(b'transfer-encoding')
-    if trenc and trenc.lower() == b"chunked":
-        res.chunked = 1
-        res.chunk_left = None
-    else:
-        res.chunked = 0
-
-    # will the connection close at the end of the response?
-    res.will_close = res._check_close()
-
-    # do we have a Content-Length?
-    # NOTE: RFC 2616, section 4.4, #3 says we ignore this if
-    # transfer-encoding is "chunked"
-    length = res.msg.getheader(b'content-length')
-    if length and not res.chunked:
-        try:
-            res.length = int(length)
-        except ValueError:
-            res.length = None
-        else:
-            if res.length < 0:  # ignore nonsensical negative lengths
-                res.length = None
-    else:
-        res.length = None
-
-    # does the body have a fixed length? (of zero)
-    if (
-        status == httplib.NO_CONTENT
-        or status == httplib.NOT_MODIFIED
-        or 100 <= status < 200
-        or res._method == b'HEAD'  # 1xx codes
-    ):
-        res.length = 0
-
-    # if the connection remains open, and we aren't using chunked, and
-    # a content-length was not provided, then assume that the connection
-    # WILL close.
-    if not res.will_close and not res.chunked and res.length is None:
-        res.will_close = 1
-
-    self.proxyres = res
-
-    return False
+        self.close()
+        raise socket.error(
+            "Tunnel connection failed: %d %s" % (status, reason.strip())
+        )
 
 
 class httphandler(keepalive.HTTPHandler):
--- a/rust/hg-core/Cargo.toml	Thu Jun 02 23:57:56 2022 +0200
+++ b/rust/hg-core/Cargo.toml	Wed Jun 08 15:46:04 2022 +0200
@@ -15,7 +15,7 @@
 derive_more = "0.99.17"
 hashbrown = { version = "0.9.1", features = ["rayon"] }
 home = "0.5.3"
-im-rc = "15.0.0"
+im-rc = "15.0"
 itertools = "0.10.3"
 lazy_static = "1.4.0"
 libc = "0.2"
--- a/tests/hghave.py	Thu Jun 02 23:57:56 2022 +0200
+++ b/tests/hghave.py	Wed Jun 08 15:46:04 2022 +0200
@@ -1121,7 +1121,7 @@
 @check('black', 'the black formatter for python (>= 20.8b1)')
 def has_black():
     blackcmd = 'black --version'
-    version_regex = b'black, version ([0-9a-b.]+)'
+    version_regex = b'black, (?:version )?([0-9a-b.]+)'
     version = matchoutput(blackcmd, version_regex)
     sv = distutils.version.StrictVersion
     return version and sv(_bytes2sys(version.group(1))) >= sv('20.8b1')
--- a/tests/test-http-proxy.t	Thu Jun 02 23:57:56 2022 +0200
+++ b/tests/test-http-proxy.t	Wed Jun 08 15:46:04 2022 +0200
@@ -104,6 +104,13 @@
   new changesets 83180e7845de
   updating to branch default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+proxy can't connect to server
+
+  $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone http://localhost:$HGPORT2/ h
+  abort: HTTP Error 404: Connection refused
+  [100]
+
   $ cat proxy.log
   * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
   $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
@@ -120,3 +127,5 @@
   * - - [*] "GET http://localhost:$HGPORT/?cmd=capabilities HTTP/1.1" - - (glob)
   $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=batch HTTP/1.1" - - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
   $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT/?cmd=getbundle HTTP/1.1" - - x-hgarg-1:bookmarks=1&$USUAL_BUNDLE_CAPS$&cg=1&common=0000000000000000000000000000000000000000&heads=83180e7845de420a1bb46896fd5fe05294f8d629&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob)
+  * - - [*] code 404, message Connection refused (glob)
+  $LOCALIP - - [$LOGDATE$] "GET http://localhost:$HGPORT2/?cmd=capabilities HTTP/1.1" 404 - (glob)
--- a/tests/test-https.t	Thu Jun 02 23:57:56 2022 +0200
+++ b/tests/test-https.t	Wed Jun 08 15:46:04 2022 +0200
@@ -491,6 +491,13 @@
   abort: error: *certificate verify failed* (glob)
   [100]
 
+Test when proxy can't connect to server
+
+  $ http_proxy=http://localhost:$HGPORT1/ hg -R copy-pull pull --insecure https://localhost:0/
+  pulling from https://localhost:0/
+  abort: error: Tunnel connection failed: 404 Connection refused
+  [100]
+
 
   $ killdaemons.py hg0.pid
 
--- a/tests/tinyproxy.py	Thu Jun 02 23:57:56 2022 +0200
+++ b/tests/tinyproxy.py	Wed Jun 08 15:46:04 2022 +0200
@@ -73,12 +73,8 @@
         print("\t" "connect to %s:%d" % host_port)
         try:
             soc.connect(host_port)
-        except socket.error as arg:
-            try:
-                msg = arg[1]
-            except (IndexError, TypeError):
-                msg = arg
-            self.send_error(404, msg)
+        except socket.error as e:
+            self.send_error(404, e.strerror)
             return 0
         return 1