# HG changeset patch # User Pierre-Yves David # Date 1675161719 -3600 # Node ID 1bd33932713d6284dd4d87c36e7f5c4841d8b535 # Parent 5698c5eee12b5bfc5e08e9c8ba3a3c96616c6c1a# Parent ac93876ea2dff400ab05097ee5c32da210b7c395 branching: merge with stable diff -r 5698c5eee12b -r 1bd33932713d contrib/heptapod-ci.yml --- a/contrib/heptapod-ci.yml Thu Apr 29 22:01:04 2021 +0200 +++ b/contrib/heptapod-ci.yml Tue Jan 31 11:41:59 2023 +0100 @@ -34,6 +34,7 @@ variables: RUNTEST_ARGS: "--time --test-list /tmp/check-tests.txt" PYTHON: python3 + CI_CLEVER_CLOUD_FLAVOR: S rust-cargo-test: <<: *all @@ -44,6 +45,7 @@ - make cargo-clippy variables: PYTHON: python3 + CI_CLEVER_CLOUD_FLAVOR: S test-c: <<: *runtests diff -r 5698c5eee12b -r 1bd33932713d hgext/convert/bzr.py --- a/hgext/convert/bzr.py Thu Apr 29 22:01:04 2021 +0200 +++ b/hgext/convert/bzr.py Tue Jan 31 11:41:59 2023 +0100 @@ -44,6 +44,12 @@ revision = breezy.revision revisionspec = breezy.revisionspec revisionspec.RevisionSpec + + try: + # brz 3.3.0 (revno: 7614.2.2) + from breezy.transport import NoSuchFile + except ImportError: + from breezy.errors import NoSuchFile except ImportError: pass @@ -153,7 +159,7 @@ try: kind = revtree.kind(name) - except breezy.errors.NoSuchFile: + except NoSuchFile: return None, None if kind not in supportedkinds: # the file is not available anymore - was deleted diff -r 5698c5eee12b -r 1bd33932713d hgext/convert/cvs.py --- a/hgext/convert/cvs.py Thu Apr 29 22:01:04 2021 +0200 +++ b/hgext/convert/cvs.py Tue Jan 31 11:41:59 2023 +0100 @@ -142,7 +142,9 @@ if root.startswith(b":pserver:"): root = root[9:] - m = re.match(r'(?:(.*?)(?::(.*?))?@)?([^:/]*)(?::(\d*))?(.*)', root) + m = re.match( + br'(?:(.*?)(?::(.*?))?@)?([^:/]*)(?::(\d*))?(.*)', root + ) if m: conntype = b"pserver" user, passw, serv, port, root = m.groups() @@ -197,7 +199,7 @@ if sck.recv(128) != b"I LOVE YOU\n": raise error.Abort(_(b"CVS pserver authentication failed")) - self.writep = self.readp = sck.makefile(b'r+') + self.writep = self.readp = sck.makefile('rwb') if not conntype and root.startswith(b":local:"): conntype = b"local" diff -r 5698c5eee12b -r 1bd33932713d hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py Thu Apr 29 22:01:04 2021 +0200 +++ b/hgext/convert/cvsps.py Tue Jan 31 11:41:59 2023 +0100 @@ -686,7 +686,10 @@ files = set() if len(changesets) % 100 == 0: - t = b'%d %s' % (len(changesets), repr(e.comment)[1:-1]) + t = b'%d %s' % ( + len(changesets), + pycompat.byterepr(e.comment)[2:-1], + ) ui.status(stringutil.ellipsis(t, 80) + b'\n') c.entries.append(e) diff -r 5698c5eee12b -r 1bd33932713d hgext/histedit.py diff -r 5698c5eee12b -r 1bd33932713d mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py Thu Apr 29 22:01:04 2021 +0200 +++ b/mercurial/bundlerepo.py Tue Jan 31 11:41:59 2023 +0100 @@ -533,6 +533,8 @@ try: repo = localrepo.instance(ui, repopath, create=False) tempparent = None + except error.RequirementError: + raise # no fallback if the backing repo is unsupported except error.RepoError: tempparent = pycompat.mkdtemp() try: diff -r 5698c5eee12b -r 1bd33932713d mercurial/revset.py --- a/mercurial/revset.py Thu Apr 29 22:01:04 2021 +0200 +++ b/mercurial/revset.py Tue Jan 31 11:41:59 2023 +0100 @@ -10,7 +10,6 @@ import functools import random import re -import sys from .i18n import _ from .pycompat import getattr @@ -2352,7 +2351,7 @@ return subset & s.filter(filter, condrepr=b'') -MAXINT = sys.maxsize +MAXINT = (1 << 31) - 1 MININT = -MAXINT - 1 diff -r 5698c5eee12b -r 1bd33932713d mercurial/scmutil.py --- a/mercurial/scmutil.py Thu Apr 29 22:01:04 2021 +0200 +++ b/mercurial/scmutil.py Tue Jan 31 11:41:59 2023 +0100 @@ -278,6 +278,11 @@ ) try: int(lbl) + if b'_' in lbl: + # If label contains underscores, Python might consider it an + # integer (with "_" as visual separators), but we do not. + # See PEP 515 - Underscores in Numeric Literals. + raise ValueError raise error.InputError(_(b"cannot use an integer as a name")) except ValueError: pass diff -r 5698c5eee12b -r 1bd33932713d mercurial/utils/resourceutil.py --- a/mercurial/utils/resourceutil.py Thu Apr 29 22:01:04 2021 +0200 +++ b/mercurial/utils/resourceutil.py Tue Jan 31 11:41:59 2023 +0100 @@ -59,7 +59,10 @@ from importlib import resources # pytype: disable=import-error # Force loading of the resources module - resources.open_binary # pytype: disable=module-attr + if pycompat.safehasattr(resources, 'files'): + resources.files # pytype: disable=module-attr + else: + resources.open_binary # pytype: disable=module-attr # py2exe raises an AssertionError if uses importlib.resources if getattr(sys, "frozen", None) in ("console_exe", "windows_exe"): @@ -92,9 +95,18 @@ from .. import encoding def open_resource(package, name): - return resources.open_binary( # pytype: disable=module-attr - pycompat.sysstr(package), pycompat.sysstr(name) - ) + if pycompat.safehasattr(resources, 'files'): + return ( + resources.files( # pytype: disable=module-attr + pycompat.sysstr(package) + ) + .joinpath(pycompat.sysstr(name)) + .open('rb') + ) + else: + return resources.open_binary( # pytype: disable=module-attr + pycompat.sysstr(package), pycompat.sysstr(name) + ) def is_resource(package, name): return resources.is_resource( # pytype: disable=module-attr diff -r 5698c5eee12b -r 1bd33932713d setup.py --- a/setup.py Thu Apr 29 22:01:04 2021 +0200 +++ b/setup.py Tue Jan 31 11:41:59 2023 +0100 @@ -217,9 +217,10 @@ cmd = self.cmd + args returncode, out, err = runcmd(cmd, self.env) err = filterhgerr(err) - if err or returncode != 0: + if err: print("stderr from '%s':" % (' '.join(cmd)), file=sys.stderr) print(err, file=sys.stderr) + if returncode != 0: return b'' return out @@ -333,8 +334,12 @@ else: # no tag found ltagcmd = ['parents', '--template', '{latesttag}'] ltag = sysstr(hg.run(ltagcmd)) + if not ltag: + ltag = 'null' changessincecmd = ['log', '-T', 'x\n', '-r', "only(.,'%s')" % ltag] changessince = len(hg.run(changessincecmd).splitlines()) + if ltag == 'null': + ltag = '0.0' version = '%s+hg%s.%s' % (ltag, changessince, hgid) if version.endswith('+'): version = version[:-1] + 'local' + time.strftime('%Y%m%d') diff -r 5698c5eee12b -r 1bd33932713d tests/filtertraceback.py --- a/tests/filtertraceback.py Thu Apr 29 22:01:04 2021 +0200 +++ b/tests/filtertraceback.py Tue Jan 31 11:41:59 2023 +0100 @@ -31,6 +31,11 @@ elif not line.startswith(' '): state = 'none' + elif not line.replace('^', '').replace('~', '').strip(): + # PEP 657: Fine-grained error locations in tracebacks + # ~~~~~~^^^^^^^^^ + continue + elif state == 'file': # Ignore lines after " File " state = 'tb' diff -r 5698c5eee12b -r 1bd33932713d tests/hghave.py --- a/tests/hghave.py Thu Apr 29 22:01:04 2021 +0200 +++ b/tests/hghave.py Tue Jan 31 11:41:59 2023 +0100 @@ -206,7 +206,7 @@ "pyoxidizer-in-memory", "running with pyoxidizer build as 'hg' with embedded resources", ) -def has_pyoxidizer(): +def has_pyoxidizer_mem(): return 'PYOXIDIZED_IN_MEMORY_RSRC' in os.environ @@ -214,7 +214,7 @@ "pyoxidizer-in-filesystem", "running with pyoxidizer build as 'hg' with external resources", ) -def has_pyoxidizer(): +def has_pyoxidizer_fs(): return 'PYOXIDIZED_FILESYSTEM_RSRC' in os.environ @@ -661,36 +661,22 @@ return False -@check("pygments25", "Pygments version >= 2.5") -def pygments25(): +def getpygmentsversion(): try: import pygments v = pygments.__version__ + + parts = v.split(".") + return (int(parts[0]), int(parts[1])) except ImportError: - return False - - parts = v.split(".") - major = int(parts[0]) - minor = int(parts[1]) - - return (major, minor) >= (2, 5) + return (0, 0) -@check("pygments211", "Pygments version >= 2.11") -def pygments211(): - try: - import pygments - - v = pygments.__version__ - except ImportError: - return False - - parts = v.split(".") - major = int(parts[0]) - minor = int(parts[1]) - - return (major, minor) >= (2, 11) +@checkvers("pygments", "Pygments version >= %s", (2.5, 2.11, 2.14)) +def has_pygments_range(v): + major, minor = v.split('.')[0:2] + return getpygmentsversion() >= (int(major), int(minor)) @check("outer-repo", "outer repo") diff -r 5698c5eee12b -r 1bd33932713d tests/test-branches.t --- a/tests/test-branches.t Thu Apr 29 22:01:04 2021 +0200 +++ b/tests/test-branches.t Tue Jan 31 11:41:59 2023 +0100 @@ -82,6 +82,11 @@ (use 'hg update' to switch to it) [10] +underscores in numeric branch names (issue6737) + + $ hg branch 2700_210 + marked working directory as branch 2700_210 + verify update will accept invalid legacy branch names $ hg init test-invalid-branch-name diff -r 5698c5eee12b -r 1bd33932713d tests/test-check-shbang.t --- a/tests/test-check-shbang.t Thu Apr 29 22:01:04 2021 +0200 +++ b/tests/test-check-shbang.t Tue Jan 31 11:41:59 2023 +0100 @@ -14,7 +14,8 @@ > -X tests/test-check-format.t \ > -X tests/test-check-module-imports.t \ > -X tests/test-check-pyflakes.t \ - > -X tests/test-check-shbang.t + > -X tests/test-check-shbang.t \ + > -X tests/test-highlight.t [1] The above exclusions are because they're looking for files that diff -r 5698c5eee12b -r 1bd33932713d tests/test-demandimport.py --- a/tests/test-demandimport.py Thu Apr 29 22:01:04 2021 +0200 +++ b/tests/test-demandimport.py Tue Jan 31 11:41:59 2023 +0100 @@ -8,6 +8,7 @@ import types # Don't import pycompat because it has too many side-effects. +ispy311 = (sys.version_info.major, sys.version_info.minor) >= (3, 11) # Only run if demandimport is allowed if subprocess.call( @@ -73,8 +74,7 @@ assert 'mercurial.error' not in sys.modules from mercurial import error as errorproxy -# unsure why this isn't lazy. -assert not isinstance(f, _LazyModule) +assert isinstance(errorproxy, _LazyModule) assert f(errorproxy) == "", f(errorproxy) doc = ' '.join(errorproxy.__doc__.split()[:3]) @@ -92,10 +92,16 @@ import os assert not isinstance(os, _LazyModule) -assert f(os) == "", f(os) +if ispy311: + assert f(os) == "", f(os) +else: + assert f(os) == "", f(os) assert f(os.system) == '', f(os.system) -assert f(os) == "", f(os) +if ispy311: + assert f(os) == "", f(os) +else: + assert f(os) == "", f(os) assert 'mercurial.utils.procutil' not in sys.modules from mercurial.utils import procutil diff -r 5698c5eee12b -r 1bd33932713d tests/test-extension.t --- a/tests/test-extension.t Thu Apr 29 22:01:04 2021 +0200 +++ b/tests/test-extension.t Tue Jan 31 11:41:59 2023 +0100 @@ -598,6 +598,7 @@ uisetup(ui) File "$TESTTMP/baduisetup.py", line 2, in uisetup 1 / 0 + ~~^~~ (py311 !) ZeroDivisionError: * by zero (glob) *** failed to set up extension baduisetup: * by zero (glob) Mercurial Distributed SCM (version *) (glob) diff -r 5698c5eee12b -r 1bd33932713d tests/test-highlight.t --- a/tests/test-highlight.t Thu Apr 29 22:01:04 2021 +0200 +++ b/tests/test-highlight.t Tue Jan 31 11:41:59 2023 +0100 @@ -163,7 +163,8 @@ import itertools def primes(): - """Generate all primes.""" + """Generate all primes.""" (pygments214 !) + """Generate all primes.""" (no-pygments214 !) def sieve(ns): p = ns.next() # It is important to yield *here* in order to stop the @@ -489,7 +490,8 @@ changeset - 10 """Generate all primes.""" + 10 """Generate all primes.""" (pygments214 !) + 10 """Generate all primes.""" (no-pygments214 !) @@ -1008,7 +1010,7 @@ > EOF $ cat > unknownfile << EOF - > #!$PYTHON + > #!/this/helps/pygments/detect/python > def foo(): > pass > EOF diff -r 5698c5eee12b -r 1bd33932713d tests/test-lfs-serve-access.t --- a/tests/test-lfs-serve-access.t Thu Apr 29 22:01:04 2021 +0200 +++ b/tests/test-lfs-serve-access.t Tue Jan 31 11:41:59 2023 +0100 @@ -340,12 +340,14 @@ $LOCALIP - - [$ERRDATE$] HG error: Exception happened while processing request '/.git/info/lfs/objects/batch': (glob) $LOCALIP - - [$ERRDATE$] HG error: Traceback (most recent call last): (glob) $LOCALIP - - [$ERRDATE$] HG error: verifies = store.verify(oid) (glob) + $LOCALIP - - [$ERRDATE$] HG error: ^^^^^^^^^^^^^^^^^ (glob) (py311 !) $LOCALIP - - [$ERRDATE$] HG error: raise IOError(errno.EIO, r'%s: I/O error' % oid.decode("utf-8")) (glob) $LOCALIP - - [$ERRDATE$] HG error: *Error: [Errno *] f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e: I/O error (glob) $LOCALIP - - [$ERRDATE$] HG error: (glob) $LOCALIP - - [$ERRDATE$] HG error: Exception happened while processing request '/.git/info/lfs/objects/batch': (glob) $LOCALIP - - [$ERRDATE$] HG error: Traceback (most recent call last): (glob) $LOCALIP - - [$ERRDATE$] HG error: verifies = store.verify(oid) (glob) + $LOCALIP - - [$ERRDATE$] HG error: ^^^^^^^^^^^^^^^^^ (glob) (py311 !) $LOCALIP - - [$ERRDATE$] HG error: raise IOError(errno.EIO, r'%s: I/O error' % oid.decode("utf-8")) (glob) $LOCALIP - - [$ERRDATE$] HG error: *Error: [Errno *] b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c: I/O error (glob) $LOCALIP - - [$ERRDATE$] HG error: (glob) @@ -363,19 +365,26 @@ self.do_hgweb() for chunk in self.server.application(env, self._start_response): for r in self._runwsgi(req, res, repo): + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (py311 !) handled = wireprotoserver.handlewsgirequest( (py38 !) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (py311 !) return _processbasictransfer( (py38 !) + ^^^^^^^^^^^^^^^^^^^^^^ (py311 !) rctx, req, res, self.check_perm (no-py38 !) rctx.repo, req, res, lambda perm: checkperm(rctx, req, perm) (no-py38 !) res.setbodybytes(localstore.read(oid)) + ^^^^^^^^^^^^^^^^^^^^ (py311 !) blob = self._read(self.vfs, oid, verify) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (py311 !) raise IOError(errno.EIO, r'%s: I/O error' % oid.decode("utf-8")) *Error: [Errno *] 276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d: I/O error (glob) $LOCALIP - - [$ERRDATE$] HG error: Exception happened while processing request '/.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d': (glob) $LOCALIP - - [$ERRDATE$] HG error: Traceback (most recent call last): (glob) $LOCALIP - - [$ERRDATE$] HG error: res.setbodybytes(localstore.read(oid)) (glob) + $LOCALIP - - [$ERRDATE$] HG error: ^^^^^^^^^^^^^^^^^^^^ (glob) (py311 !) $LOCALIP - - [$ERRDATE$] HG error: blob = self._read(self.vfs, oid, verify) (glob) + $LOCALIP - - [$ERRDATE$] HG error: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (glob) (py311 !) $LOCALIP - - [$ERRDATE$] HG error: blobstore._verify(oid, b'dummy content') (glob) $LOCALIP - - [$ERRDATE$] HG error: raise LfsCorruptionError( (glob) (py38 !) $LOCALIP - - [$ERRDATE$] HG error: hint=_(b'run hg verify'), (glob) (no-py38 !) diff -r 5698c5eee12b -r 1bd33932713d tests/test-requires.t --- a/tests/test-requires.t Thu Apr 29 22:01:04 2021 +0200 +++ b/tests/test-requires.t Tue Jan 31 11:41:59 2023 +0100 @@ -81,4 +81,14 @@ abort: required features are not supported in the destination: featuresetup-test [255] +Bundlerepo also enforces the underlying repo requirements + + $ hg --cwd supported bundle --all ../bundle.hg + 1 changesets found + $ echo outdoor-pool > push-dst/.hg/requires + $ hg --cwd push-dst log -R ../bundle.hg -T phases + abort: repository requires features unknown to this Mercurial: outdoor-pool + (see https://mercurial-scm.org/wiki/MissingRequirement for more information) + [255] + $ cd .. diff -r 5698c5eee12b -r 1bd33932713d tests/test-revset.t --- a/tests/test-revset.t Thu Apr 29 22:01:04 2021 +0200 +++ b/tests/test-revset.t Tue Jan 31 11:41:59 2023 +0100 @@ -2981,16 +2981,16 @@ $ hg log --rev 'sort(all(), "-random")' | wc -l \s*8 (re) $ hg log --rev 'sort(all(), "random", random.seed=celeste)' + 0 b12 m111 u112 111 10800 + 4 b111 m112 u111 110 14400 + 2 b111 m11 u12 111 3600 6 b111 t2 tu 130 0 + 1 b11 m12 u111 112 7200 7 b111 t3 tu 130 0 - 4 b111 m112 u111 110 14400 - 3 b112 m111 u11 120 0 5 b111 t1 tu 130 0 + 3 b112 m111 u11 120 0 + $ hg log --rev 'first(sort(all(), "random", random.seed=celeste))' 0 b12 m111 u112 111 10800 - 1 b11 m12 u111 112 7200 - 2 b111 m11 u12 111 3600 - $ hg log --rev 'first(sort(all(), "random", random.seed=celeste))' - 6 b111 t2 tu 130 0 topographical sorting can't be combined with other sort keys, and you can't