[PATCH 3 of 5] python3.13: address deprecation of re.sub positional argument 'count'
# HG changeset patch # User Mads Kiilerich # Date 1705006735 -3600 # Thu Jan 11 21:58:55 2024 +0100 # Branch stable # Node ID 8e16bc622b04e2eabb3a47138aa3bdffba03e142 # Parent a06a7677696d8fa4fc3e33923425ef3fadd6f441 python3.13: address deprecation of re.sub positional argument 'count' Python 3.13 introduced: DeprecationWarning: 'count' is passed as positional argument Making it mandatory to pass 'count' as named argument reduces the risk of passing 'flags' to it. That is exactly what happened in test-doctest.py . diff --git a/mercurial/subrepoutil.py b/mercurial/subrepoutil.py --- a/mercurial/subrepoutil.py +++ b/mercurial/subrepoutil.py @@ -112,7 +112,7 @@ def state(ctx, ui): # extra escapes are needed because re.sub string decodes. repl = re.sub(br'([0-9]+)', br'\\\1', repl) try: -src = re.sub(pattern, repl, src, 1) +src = re.sub(pattern, repl, src, count=1) except re.error as e: raise error.Abort( _(b"bad subrepository pattern in %s: %s") diff --git a/tests/test-doctest.py b/tests/test-doctest.py --- a/tests/test-doctest.py +++ b/tests/test-doctest.py @@ -21,9 +21,9 @@ class py3docchecker(doctest.OutputChecke r'''^mercurial\.\w+\.(\w+): (['"])(.*?)\2''', r'\1: \3', got2, -re.MULTILINE, +flags=re.MULTILINE, ) -got2 = re.sub(r'^mercurial\.\w+\.(\w+): ', r'\1: ', got2, re.MULTILINE) +got2 = re.sub(r'^mercurial\.\w+\.(\w+): ', r'\1: ', got2, flags=re.MULTILINE) return any( doctest.OutputChecker.check_output(self, w, g, optionflags) for w, g in [(want, got), (want2, got2)] ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 5 of 5] rust: update to toml 0.8
# HG changeset patch # User Mads Kiilerich # Date 1704999033 -3600 # Thu Jan 11 19:50:33 2024 +0100 # Branch stable # Node ID 646c00200241229c23dad41b1d086a610aff08b2 # Parent f2e61759ac0e0125e275acc72bda8a00258762b9 rust: update to toml 0.8 This is needed for Fedora packaging. diff --git a/rust/hg-core/Cargo.toml b/rust/hg-core/Cargo.toml --- a/rust/hg-core/Cargo.toml +++ b/rust/hg-core/Cargo.toml @@ -31,7 +31,7 @@ sha-1 = "0.10.0" twox-hash = "1.6.3" same-file = "1.0.6" tempfile = "3.3.0" -toml = "0.6" +toml = "0.8" thread_local = "1.1.4" crossbeam-channel = "0.5.6" log = "0.4.17" ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 5] python3.13: fix resourceutil for removed deprecated importlib.resources
# HG changeset patch # User Mads Kiilerich # Date 1705001574 -3600 # Thu Jan 11 20:32:54 2024 +0100 # Branch stable # Node ID a06a7677696d8fa4fc3e33923425ef3fadd6f441 # Parent ab3021e9b0012db64e5bdc70e3f5a36324925d8c python3.13: fix resourceutil for removed deprecated importlib.resources The old functionality was deprecated in 3.11 and is on track to be removed in 3.13 . The documentation on https://docs.python.org/3.12/library/importlib.resources.html recommends using the new .files() that was introduced in 3.9. The pytype annotation is probably not preserved correctly. diff --git a/mercurial/utils/resourceutil.py b/mercurial/utils/resourceutil.py --- a/mercurial/utils/resourceutil.py +++ b/mercurial/utils/resourceutil.py @@ -60,8 +60,10 @@ try: # Force loading of the resources module if hasattr(resources, 'files'): +# New in Python 3.9 resources.files # pytype: disable=module-attr else: +# Deprecated in Python 3.11 resources.open_binary # pytype: disable=module-attr # py2exe raises an AssertionError if uses importlib.resources @@ -109,12 +111,20 @@ else: ) def is_resource(package, name): -return resources.is_resource( # pytype: disable=module-attr -pycompat.sysstr(package), encoding.strfromlocal(name) -) +if hasattr(resources, 'files'): +return resources.files(pycompat.sysstr(package)).joinpath(encoding.strfromlocal(name)).is_file() +else: +return resources.is_resource( # pytype: disable=module-attr +pycompat.sysstr(package), encoding.strfromlocal(name) +) def contents(package): # pytype: disable=module-attr -for r in resources.contents(pycompat.sysstr(package)): -# pytype: enable=module-attr -yield encoding.strtolocal(r) +if hasattr(resources, 'files'): +for resource in resources.files(pycompat.sysstr(package)).iterdir(): +if resource.is_file(): +yield encoding.strtolocal(path.name) +else: +for r in resources.contents(pycompat.sysstr(package)): +# pytype: enable=module-attr +yield encoding.strtolocal(r) ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 5] python3.13: use sys.executable instead of removed Py_GetProgramFullPath
# HG changeset patch # User Mads Kiilerich # Date 1705001527 -3600 # Thu Jan 11 20:32:07 2024 +0100 # Branch stable # Node ID ab3021e9b0012db64e5bdc70e3f5a36324925d8c # Parent 3f87e0d305cda6e66139a1969cd2cedd45477139 python3.13: use sys.executable instead of removed Py_GetProgramFullPath I could not make it work with the PyConfig API from the extension. But fetching sys.executable seems to work fine and isn't that verbose. diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c --- a/mercurial/cext/parsers.c +++ b/mercurial/cext/parsers.c @@ -1232,6 +1232,15 @@ static int check_python_version(void) * should only occur in unusual circumstances (e.g. if sys.hexversion * is manually set to an invalid value). */ if ((hexversion == -1) || (hexversion >> 16 != PY_VERSION_HEX >> 16)) { + PyObject *sys = PyImport_ImportModule("sys"), *executable; + if (!sys) { + return -1; + } + executable = PyObject_GetAttrString(sys, "executable"); + Py_DECREF(sys); + if (!executable) { + return -1; + } PyErr_Format(PyExc_ImportError, "%s: The Mercurial extension " "modules were compiled with Python " PY_VERSION @@ -1240,7 +1249,8 @@ static int check_python_version(void) "sys.hexversion=%ld: " "Python %s\n at: %s", versionerrortext, hexversion, Py_GetVersion(), -Py_GetProgramFullPath()); +PyUnicode_AsUTF8(executable)); + Py_DECREF(executable); return -1; } return 0; ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 6] utils: stop using datetime.utcfromtimestamp() deprecated in Python 3.12
On 28/06/2023 16:43, Mads Kiilerich wrote: # HG changeset patch # User Mads Kiilerich # Date 1687866710 -7200 # Tue Jun 27 13:51:50 2023 +0200 # Branch stable # Node ID ec46e9b39b2a6f5d0c59aa803e2eb5d9dfc44cc3 # Parent 2b0598121a71fa19c2174e4eee3400ec3a3b1c26 utils: stop using datetime.utcfromtimestamp() deprecated in Python 3.12 Python3.12 made tests fail with warnings: DeprecationWarning: datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.fromtimestamp(timestamp, datetime.UTC). Computing the diff while in timestamp seconds seems to preserve to the original intent from ae04af1ce78d. It would be nice to have some doctest coverage of this, with the problematic corner cases that has popped up over time... Some potential test coverage that verified that the change preserve the fix from ae04af1ce78d: """Return a unix timestamp (or the current time) as a (unixtime, offset) tuple based off the local timezone. >>> import os, time >>> os.environ['TZ'] = 'Asia/Novokuznetsk' >>> time.tzset() >>> def dtu(*a): ... return datetime.datetime(*a, tzinfo=datetime.timezone.utc) # Old winter timezone, +7 >>> makedate(dtu(2010, 1, 1, 5, 0, 0).timestamp()) (1262322000.0, -25200) # Same timezone in summer, +7, so no DST >>> makedate(dtu(2010, 7, 1, 5, 0, 0).timestamp()) (1277960400.0, -25200) # Changing to new winter timezone, from +7 to +6 (ae04af1ce78d testcase) >>> makedate(dtu(2010, 10, 30, 20, 0, 0).timestamp() - 1) (1288468799.0, -25200) >>> makedate(dtu(2010, 10, 30, 20, 0, 0).timestamp()) (1288468800.0, -21600) >>> makedate(dtu(2011, 1, 1, 5, 0, 0).timestamp()) (1293858000.0, -21600) # Introducing DST, changing +6 to +7 >>> makedate(dtu(2011, 3, 26, 20, 0, 0).timestamp() - 1) (1301169599.0, -21600) >>> makedate(dtu(2011, 3, 26, 20, 0, 0).timestamp()) (1301169600.0, -25200) """ but it relies heavily on a corner case in the time database and setting the timezone globally, so it might be fragile and not a good candidate for adding to the test suite. The functions are already accidentally covered by the suite. /Mads ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 6 of 6] extensions: imp module is removed in Python 3.12 - use importlib to load files
# HG changeset patch # User Mads Kiilerich # Date 1687954993 -7200 # Wed Jun 28 14:23:13 2023 +0200 # Branch stable # Node ID 24d8509e44785f94047efebbcbb38986323913cd # Parent f45267a4d61f7687727efa7fe571d4f2522a3bb6 extensions: imp module is removed in Python 3.12 - use importlib to load files imp has been deprecated for a long time, and has finally been removed in Python 3.12 . imp was only used for loading extensions that has been specified with direct .py path or path to a package directory. The same use cases can be achieved quite simple with importlib, , possiby with small changes in corner cases with undefined behaviour, such as extensions without .py source. There might also be corner cases and undefined behaviour around use of sys.modules and reloading. diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -9,9 +9,10 @@ import ast import collections import functools -import imp +import importlib import inspect import os +import sys from .i18n import ( _, @@ -89,20 +90,17 @@ def loadpath(path, module_name): path = pycompat.fsdecode(path) if os.path.isdir(path): # module/__init__.py style -d, f = os.path.split(path) -fd, fpath, desc = imp.find_module(f, [d]) -# When https://github.com/python/typeshed/issues/3466 is fixed -# and in a pytype release we can drop this disable. -return imp.load_module( -module_name, fd, fpath, desc # pytype: disable=wrong-arg-types -) -else: -try: -return imp.load_source(module_name, path) -except IOError as exc: -if not exc.filename: -exc.filename = path # python does not fill this -raise +init_py_path = os.path.join(path, '__init__.py') +if not os.path.exists(init_py_path): +raise ImportError("No module named '%s'" % os.path.basename(path)) +path = init_py_path + +loader = importlib.machinery.SourceFileLoader(module_name, path) +spec = importlib.util.spec_from_file_location(module_name, loader=loader) +module = importlib.util.module_from_spec(spec) +sys.modules[module_name] = module +spec.loader.exec_module(module) +return module def _importh(name): ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 5 of 6] utils: imp module is removed in Python 3.12 - get is_frozen() from _imp
# HG changeset patch # User Mads Kiilerich # Date 1687863903 -7200 # Tue Jun 27 13:05:03 2023 +0200 # Branch stable # Node ID f45267a4d61f7687727efa7fe571d4f2522a3bb6 # Parent 85a1bdb7d945c647670761676c97ce716fe3796d utils: imp module is removed in Python 3.12 - get is_frozen() from _imp imp has been deprecated for a long time, and has finally been removed in Python 3.12 . The successor importlib is using the same internal _imp module as imp, but doesn't expose it's is_frozen. Using the internal function directly seems like the cleanest solution. Another alternative to imp.is_frozen("__main__") is sys.modules['__main__'].__spec__.origin == 'frozen' but that seems even more internal and fragile. diff --git a/mercurial/utils/resourceutil.py b/mercurial/utils/resourceutil.py --- a/mercurial/utils/resourceutil.py +++ b/mercurial/utils/resourceutil.py @@ -8,7 +8,7 @@ # GNU General Public License version 2 or any later version. -import imp +import _imp import os import sys @@ -24,7 +24,7 @@ def mainfrozen(): return ( pycompat.safehasattr(sys, "frozen") # new py2exe or pycompat.safehasattr(sys, "importers") # old py2exe -or imp.is_frozen("__main__") # tools/freeze +or _imp.is_frozen("__main__") # tools/freeze ) ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 6] extensions: address ast deprecations introduced in Python 3.12
# HG changeset patch # User Mads Kiilerich # Date 1687897904 -7200 # Tue Jun 27 22:31:44 2023 +0200 # Branch stable # Node ID 85a1bdb7d945c647670761676c97ce716fe3796d # Parent b6633799949e428d27f7704636da0da31a599e6b extensions: address ast deprecations introduced in Python 3.12 Tests would fail with: .../mercurial/extensions.py:910: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead if isinstance(a, ast.Str): .../mercurial/extensions.py:912: DeprecationWarning: ast.Bytes is deprecated and will be removed in Python 3.14; use ast.Constant instead elif isinstance(a, ast.Bytes): .../mercurial/extensions.py:913: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead name = a.s diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -885,16 +885,31 @@ def _disabledcmdtable(path): with open(path, b'rb') as src: root = ast.parse(src.read(), path) cmdtable = {} + +# Python 3.12 started removing Bytes and Str and deprecate harder +use_constant = 'Bytes' not in vars(ast) + for node in _walkcommand(root): if not node.args: continue a = node.args[0] -if isinstance(a, ast.Str): -name = pycompat.sysbytes(a.s) -elif isinstance(a, ast.Bytes): -name = a.s -else: -continue +if use_constant: # Valid since Python 3.8 +if isinstance(a, ast.Constant): +if isinstance(a.value, str): +name = pycompat.sysbytes(a.value) +elif isinstance(a.value, bytes): +name = a.value +else: +continue +else: +continue +else: # Valid until 3.11 +if isinstance(a, ast.Str): +name = pycompat.sysbytes(a.s) +elif isinstance(a, ast.Bytes): +name = a.s +else: +continue cmdtable[name] = (None, [], b'') return cmdtable ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 6] vfs: handle shutil.rmtree deprecation of onerror in Python 3.12
# HG changeset patch # User Mads Kiilerich # Date 1687847952 -7200 # Tue Jun 27 08:39:12 2023 +0200 # Branch stable # Node ID b6633799949e428d27f7704636da0da31a599e6b # Parent 27c7a6d21b9dae4d465a569480331d2467b423f2 vfs: handle shutil.rmtree deprecation of onerror in Python 3.12 Tests would fail with warnings: .../mercurial/vfs.py:289: DeprecationWarning: onerror argument is deprecated, use onexc instead The excinfo changed slightly, but we don't use it anyway. diff --git a/mercurial/vfs.py b/mercurial/vfs.py --- a/mercurial/vfs.py +++ b/mercurial/vfs.py @@ -274,7 +274,7 @@ class abstractvfs: """ if forcibly: -def onerror(function, path, excinfo): +def onexc(function, path, excinfo): if function is not os.remove: raise # read-only files cannot be unlinked under Windows @@ -285,10 +285,15 @@ class abstractvfs: os.remove(path) else: -onerror = None -return shutil.rmtree( -self.join(path), ignore_errors=ignore_errors, onerror=onerror -) +onexc = None +try: +return shutil.rmtree( +self.join(path), ignore_errors=ignore_errors, onexc=onexc +) +except TypeError: # onexc was introduced in Python 3.12 +return shutil.rmtree( +self.join(path), ignore_errors=ignore_errors, onerror=onexc +) def setflags(self, path: bytes, l: bool, x: bool): return util.setflags(self.join(path), l, x) ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 6] tests: fix sortdict doctest with Python 3.12
# HG changeset patch # User Mads Kiilerich # Date 1687853351 -7200 # Tue Jun 27 10:09:11 2023 +0200 # Branch stable # Node ID 27c7a6d21b9dae4d465a569480331d2467b423f2 # Parent ec46e9b39b2a6f5d0c59aa803e2eb5d9dfc44cc3 tests: fix sortdict doctest with Python 3.12 The output of OrderedDict changed to use plain dict syntax: $ python3.11 -c "import collections;print(collections.OrderedDict([('a', 0), ('b', 1)]))" OrderedDict([('a', 0), ('b', 1)]) $ python3.12 -c "import collections;print(collections.OrderedDict([('a', 0), ('b', 1)]))" OrderedDict({'a': 0, 'b': 1}) diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1277,14 +1277,14 @@ class sortdict(collections.OrderedDict): >>> d1 = sortdict([(b'a', 0), (b'b', 1)]) >>> d2 = d1.copy() ->>> d2 -sortdict([('a', 0), ('b', 1)]) +>>> list(d2.items()) +[('a', 0), ('b', 1)] >>> d2.update([(b'a', 2)]) >>> list(d2.keys()) # should still be in last-set order ['b', 'a'] >>> d1.insert(1, b'a.5', 0.5) ->>> d1 -sortdict([('a', 0), ('a.5', 0.5), ('b', 1)]) +>>> list(d1.items()) +[('a', 0), ('a.5', 0.5), ('b', 1)] """ def __setitem__(self, key, value): ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 6] utils: stop using datetime.utcfromtimestamp() deprecated in Python 3.12
# HG changeset patch # User Mads Kiilerich # Date 1687866710 -7200 # Tue Jun 27 13:51:50 2023 +0200 # Branch stable # Node ID ec46e9b39b2a6f5d0c59aa803e2eb5d9dfc44cc3 # Parent 2b0598121a71fa19c2174e4eee3400ec3a3b1c26 utils: stop using datetime.utcfromtimestamp() deprecated in Python 3.12 Python3.12 made tests fail with warnings: DeprecationWarning: datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.fromtimestamp(timestamp, datetime.UTC). Computing the diff while in timestamp seconds seems to preserve to the original intent from ae04af1ce78d. It would be nice to have some doctest coverage of this, with the problematic corner cases that has popped up over time... diff --git a/hgext/convert/common.py b/hgext/convert/common.py --- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -567,8 +567,10 @@ class mapfile(dict): def makedatetimestamp(t): """Like dateutil.makedate() but for time t instead of current time""" -delta = datetime.datetime.utcfromtimestamp( +tz = round( t -) - datetime.datetime.fromtimestamp(t) -tz = delta.days * 86400 + delta.seconds +- datetime.datetime.fromtimestamp(t) +.replace(tzinfo=datetime.timezone.utc) +.timestamp() +) return t, tz diff --git a/mercurial/utils/dateutil.py b/mercurial/utils/dateutil.py --- a/mercurial/utils/dateutil.py +++ b/mercurial/utils/dateutil.py @@ -83,10 +83,14 @@ def makedate(timestamp=None): raise error.InputError( _(b"negative timestamp: %d") % timestamp, hint=hint ) -delta = datetime.datetime.utcfromtimestamp( +tz = round( timestamp -) - datetime.datetime.fromtimestamp(timestamp) -tz = delta.days * 86400 + delta.seconds +- datetime.datetime.fromtimestamp( +timestamp, +) +.replace(tzinfo=datetime.timezone.utc) +.timestamp() +) return timestamp, tz ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 10 of 10] hgweb: drop references to deprecated cgitb
# HG changeset patch # User Mads Kiilerich # Date 1687795228 -7200 # Mon Jun 26 18:00:28 2023 +0200 # Branch stable # Node ID 6ca3c985d3fe233bde88057e1a04f6c2c5ab71fd # Parent 5a32d6ab784657d51dc02c9e86ad92d4efd21ee8 hgweb: drop references to deprecated cgitb cgitb is going away and gives warnings when importing, and that make tests fail: $TESTTMP/hgweb.cgi:5: DeprecationWarning: 'cgitb' is deprecated and slated for removal in Python 3.13 The lack of a "nice" high level error handler is not a huge problem, neither for users (where it is disabled anyway) or for tests (where we don't use a browser and the plain tracebacks often are more readable). It is inevitable that it is going away, and there is no obvious alternative. Remove it and move on. diff --git a/contrib/hgweb.fcgi b/contrib/hgweb.fcgi --- a/contrib/hgweb.fcgi +++ b/contrib/hgweb.fcgi @@ -9,9 +9,6 @@ config = b"/path/to/repo/or/config" # (consult "installed modules" path from 'hg debuginstall'): # import sys; sys.path.insert(0, "/path/to/python/lib") -# Uncomment to send python tracebacks to the browser if an error occurs: -# import cgitb; cgitb.enable() - from mercurial import demandimport demandimport.enable() diff --git a/contrib/hgweb.wsgi b/contrib/hgweb.wsgi --- a/contrib/hgweb.wsgi +++ b/contrib/hgweb.wsgi @@ -8,9 +8,6 @@ config = b"/path/to/repo/or/config" # (consult "installed modules" path from 'hg debuginstall'): #import sys; sys.path.insert(0, "/path/to/python/lib") -# Uncomment to send python tracebacks to the browser if an error occurs: -#import cgitb; cgitb.enable() - # enable demandloading to reduce startup time from mercurial import demandimport; demandimport.enable() diff --git a/hgweb.cgi b/hgweb.cgi --- a/hgweb.cgi +++ b/hgweb.cgi @@ -10,9 +10,6 @@ config = b"/path/to/repo/or/config" # (consult "installed modules" path from 'hg debuginstall'): # import sys; sys.path.insert(0, "/path/to/python/lib") -# Uncomment to send python tracebacks to the browser if an error occurs: -# import cgitb; cgitb.enable() - from mercurial import demandimport demandimport.enable() diff --git a/tests/test-clone-cgi.t b/tests/test-clone-cgi.t --- a/tests/test-clone-cgi.t +++ b/tests/test-clone-cgi.t @@ -12,8 +12,6 @@ initialize repository $ cat >hgweb.cgi < # > # An example CGI script to use hgweb, edit as necessary - > import cgitb - > cgitb.enable() > from mercurial import demandimport; demandimport.enable() > from mercurial.hgweb import hgweb > from mercurial.hgweb import wsgicgi diff --git a/tests/test-mq.t b/tests/test-mq.t --- a/tests/test-mq.t +++ b/tests/test-mq.t @@ -1581,8 +1581,6 @@ Test that secret mq patch does not break > from mercurial import demandimport; demandimport.enable() > from mercurial.hgweb import hgweb > from mercurial.hgweb import wsgicgi - > import cgitb - > cgitb.enable() > app = hgweb(b'.', b'test') > wsgicgi.launch(app) > HGWEB diff --git a/tests/test-newcgi.t b/tests/test-newcgi.t --- a/tests/test-newcgi.t +++ b/tests/test-newcgi.t @@ -9,9 +9,6 @@ before d74fc8dec2b4 still work. > # > # An example CGI script to use hgweb, edit as necessary > - > import cgitb - > cgitb.enable() - > > from mercurial import demandimport; demandimport.enable() > from mercurial.hgweb import hgweb > from mercurial.hgweb import wsgicgi @@ -35,9 +32,6 @@ before d74fc8dec2b4 still work. > # > # An example CGI script to export multiple hgweb repos, edit as necessary > - > import cgitb - > cgitb.enable() - > > from mercurial import demandimport; demandimport.enable() > from mercurial.hgweb import hgwebdir > from mercurial.hgweb import wsgicgi diff --git a/tests/test-newercgi.t b/tests/test-newercgi.t --- a/tests/test-newercgi.t +++ b/tests/test-newercgi.t @@ -9,9 +9,6 @@ This is a rudimentary test of the CGI fi > # > # An example CGI script to use hgweb, edit as necessary > - > import cgitb - > cgitb.enable() - > > from mercurial import demandimport; demandimport.enable() > from mercurial.hgweb import hgweb > from mercurial.hgweb import wsgicgi @@ -32,9 +29,6 @@ This is a rudimentary test of the CGI fi > # > # An example CGI script to export multiple hgweb repos, edit as necessary > - > import cgitb - > cgitb.enable() - > > from mercurial import demandimport; demandimport.enable() > from mercurial.hgweb import hgwebdir > from mercurial.hgweb import wsgicgi diff --git a/tests/test-oldcgi.t b/tests/test-oldcgi.t --- a/tests/test-oldcgi.t +++ b/tests/test-oldcgi.t @@ -8,8 +8,7 @@ This tests if CGI files from before d0db > # > # An example CGI script to use hgweb, edit as necessary > - > import cgitb, os,
[PATCH 09 of 10] setup: fall back to setuptools setup if distutils isn't available
# HG changeset patch # User Mads Kiilerich # Date 1687860557 -7200 # Tue Jun 27 12:09:17 2023 +0200 # Branch stable # Node ID 5a32d6ab784657d51dc02c9e86ad92d4efd21ee8 # Parent 7d0800b9c059349f6ad373215e718ddc7455ee91 setup: fall back to setuptools setup if distutils isn't available The setuptools comments around this seems slightly outdated. Setuptools is improving and distutils is being deprecated, so it should perhaps be the default. But at least, it is a fair fallback. diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -112,7 +112,10 @@ issetuptools = os.name == 'nt' or 'FORCE if issetuptools: from setuptools import setup else: -from distutils.core import setup +try: +from distutils.core import setup +except ModuleNotFoundError: +from setuptools import setup from distutils.ccompiler import new_compiler from distutils.core import Command, Extension from distutils.dist import Distribution ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 07 of 10] tests: fix dummysmtpd argument check
# HG changeset patch # User Mads Kiilerich # Date 1687790713 -7200 # Mon Jun 26 16:45:13 2023 +0200 # Branch stable # Node ID 0fc04b7dda3c22b6eda5385e59be8307f883a88e # Parent 22a8aa225c38766ddd29c51348dd4484b5e58f59 tests: fix dummysmtpd argument check diff --git a/tests/dummysmtpd.py b/tests/dummysmtpd.py --- a/tests/dummysmtpd.py +++ b/tests/dummysmtpd.py @@ -99,8 +99,8 @@ def main(): op.add_option('--logfile', metavar='FILE') opts, args = op.parse_args() -if opts.tls == 'smtps' and not opts.certificate: -op.error('--certificate must be specified') +if (opts.tls == 'smtps') != bool(opts.certificate): +op.error('--certificate must be specified with --tls=smtps') addr = (opts.address, opts.port) ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 08 of 10] tests: use simple mock smtp server instead of deprecated asyncore smtpd
# HG changeset patch # User Mads Kiilerich # Date 1679586312 -3600 # Thu Mar 23 16:45:12 2023 +0100 # Branch stable # Node ID 7d0800b9c059349f6ad373215e718ddc7455ee91 # Parent 0fc04b7dda3c22b6eda5385e59be8307f883a88e tests: use simple mock smtp server instead of deprecated asyncore smtpd test-patchbomb-tls.t would fail with: .../hg/tests/dummysmtpd.py:6: DeprecationWarning: The asyncore module is deprecated and will be removed in Python 3.12. The recommended replacement is asyncio import asyncore .../hg/tests/dummysmtpd.py:8: DeprecationWarning: The smtpd module is deprecated and unmaintained and will be removed in Python 3.12. Please see aiosmtpd (https://aiosmtpd.readthedocs.io/) for the recommended replacement. import smtpd The recommended migration path to the standalone asiosmtpd would be overkill. The tests do not need a full smtp server - we can just use a very simple mock hack to preserve the existing test coverage. diff --git a/tests/dummysmtpd.py b/tests/dummysmtpd.py --- a/tests/dummysmtpd.py +++ b/tests/dummysmtpd.py @@ -3,12 +3,11 @@ """dummy SMTP server for use in tests""" -import asyncore import optparse -import smtpd +import os +import socket import ssl import sys -import traceback from mercurial import ( pycompat, @@ -18,57 +17,97 @@ from mercurial import ( ) +if os.environ.get('HGIPV6', '0') == '1': +family = socket.AF_INET6 +else: +family = socket.AF_INET + + def log(msg): sys.stdout.write(msg) sys.stdout.flush() -class dummysmtpserver(smtpd.SMTPServer): -def __init__(self, localaddr): -smtpd.SMTPServer.__init__(self, localaddr, remoteaddr=None) +def mocksmtpserversession(conn, addr): +conn.send(b'220 smtp.example.com ESMTP\r\n') + +line = conn.recv(1024) +if not line.lower().startswith(b'ehlo '): +log('no hello: %s\n' % line) +return + +conn.send(b'250 Hello\r\n') + +line = conn.recv(1024) +if not line.lower().startswith(b'mail from:'): +log('no mail from: %s\n' % line) +return +mailfrom = line[10:].decode().rstrip() +if mailfrom.startswith('<') and mailfrom.endswith('>'): +mailfrom = mailfrom[1:-1] + +conn.send(b'250 Ok\r\n') -def process_message(self, peer, mailfrom, rcpttos, data, **kwargs): -log( -'%s from=%s to=%s\n%s\n' -% (peer[0], mailfrom, ', '.join(rcpttos), data.decode()) -) +rcpttos = [] +while True: +line = conn.recv(1024) +if not line.lower().startswith(b'rcpt to:'): +break +rcptto = line[8:].decode().rstrip() +if rcptto.startswith('<') and rcptto.endswith('>'): +rcptto = rcptto[1:-1] +rcpttos.append(rcptto) + +conn.send(b'250 Ok\r\n') + +if not line.lower().strip() == b'data': +log('no rcpt to or data: %s' % line) + +conn.send(b'354 Go ahead\r\n') -def handle_error(self): -# On Windows, a bad SSL connection sometimes generates a WSAECONNRESET. -# The default handler will shutdown this server, and then both the -# current connection and subsequent ones fail on the client side with -# "No connection could be made because the target machine actively -# refused it". If we eat the error, then the client properly aborts in -# the expected way, and the server is available for subsequent requests. -traceback.print_exc() +data = b'' +while True: +line = conn.recv(1024) +if not line: +log('connection closed before end of data') +break +data += line +if data.endswith(b'\r\n.\r\n'): +data = data[:-5] +break + +conn.send(b'250 Ok\r\n') + +log( +'%s from=%s to=%s\n%s\n' +% (addr[0], mailfrom, ', '.join(rcpttos), data.decode()) +) -class dummysmtpsecureserver(dummysmtpserver): -def __init__(self, localaddr, certfile): -dummysmtpserver.__init__(self, localaddr) -self._certfile = certfile - -def handle_accept(self): -pair = self.accept() -if not pair: -return -conn, addr = pair -ui = uimod.ui.load() +def run(host, port, certificate): +ui = uimod.ui.load() +with socket.socket(family, socket.SOCK_STREAM) as s: +s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) +s.bind((host, port)) +# log('listening at %s:%d\n' % (host, port)) +s.listen(1) try: -# wrap_socket() would block, but we don't care -conn = sslutil.wrapserversocket(conn, ui, certfile=self._certfile) -except ssl.SSLError as e: -log('%s ssl error: %s\n' % (addr[0], e)) -conn.close() -return -smtpd.SMTPChannel(self, conn, addr) - - -def run(): -try: -asyncore.loop() -except Keyb
[PATCH 05 of 10] tests: show test-patchbomb-tls.t smtp server log
# HG changeset patch # User Mads Kiilerich # Date 1679586524 -3600 # Thu Mar 23 16:48:44 2023 +0100 # Branch stable # Node ID 54a4e277ff2c32c7fd67bebfb04cac25034cc2b2 # Parent 8687d17528a1fe764572c402f2d0198d5a6c8fbc tests: show test-patchbomb-tls.t smtp server log Improve test coverage by exposing what the smtp server actually receives. Make dummystmtpd redirect stderr to a log file. diff --git a/tests/dummysmtpd.py b/tests/dummysmtpd.py --- a/tests/dummysmtpd.py +++ b/tests/dummysmtpd.py @@ -93,6 +93,7 @@ def main(): op.add_option('--pid-file', metavar='FILE') op.add_option('--tls', choices=['none', 'smtps'], default='none') op.add_option('--certificate', metavar='FILE') +op.add_option('--logfile', metavar='FILE') opts, args = op.parse_args() if opts.tls == 'smtps' and not opts.certificate: @@ -113,6 +114,7 @@ def main(): runfn=run, runargs=[pycompat.sysexecutable, pycompat.fsencode(__file__)] + pycompat.sysargv[1:], +logfile=opts.logfile, ) diff --git a/tests/test-patchbomb-tls.t b/tests/test-patchbomb-tls.t --- a/tests/test-patchbomb-tls.t +++ b/tests/test-patchbomb-tls.t @@ -5,7 +5,7 @@ Set up SMTP server: $ CERTSDIR="$TESTDIR/sslcerts" $ cat "$CERTSDIR/priv.pem" "$CERTSDIR/pub.pem" >> server.pem - $ "$PYTHON" "$TESTDIR/dummysmtpd.py" -p $HGPORT --pid-file a.pid -d \ + $ "$PYTHON" "$TESTDIR/dummysmtpd.py" -p $HGPORT --pid-file a.pid --logfile log -d \ > --tls smtps --certificate `pwd`/server.pem listening at localhost:$HGPORT (?) $ cat a.pid >> $DAEMON_PIDS @@ -75,6 +75,10 @@ Without certificates: (see https://mercurial-scm.org/wiki/SecureConnections for how to configure Mercurial to avoid this error or set hostsecurity.localhost:fingerprints=sha256:20:de:b3:ad:b4:cd:a5:42:f0:74:41:1c:a2:70:1e:da:6e:c0:5c:16:9e:e7:22:0f:f1:b7:e5:6e:e4:92:af:7e to trust this server) [150] + $ cat ../log + * ssl error (glob) + $ : > ../log + With global certificates: $ try --debug --config web.cacerts="$CERTSDIR/pub.pem" @@ -86,6 +90,10 @@ With global certificates: (verifying remote certificate) sending [PATCH] a ... + $ cat ../log + * from=quux to=foo, bar (glob) + $ : > ../log + With invalid certificates: $ try --config web.cacerts="$CERTSDIR/pub-other.pem" @@ -96,4 +104,8 @@ With invalid certificates: (?i)abort: .*?certificate.verify.failed.* (re) [255] + $ cat ../log + * ssl error (glob) + $ : > ../log + $ cd .. ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 06 of 10] tests: improve test-patchbomb-tls.t by by logging errors and data
# HG changeset patch # User Mads Kiilerich # Date 1687787499 -7200 # Mon Jun 26 15:51:39 2023 +0200 # Branch stable # Node ID 22a8aa225c38766ddd29c51348dd4484b5e58f59 # Parent 54a4e277ff2c32c7fd67bebfb04cac25034cc2b2 tests: improve test-patchbomb-tls.t by by logging errors and data The actual SSL error might be like: ::1 ssl error: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:1002) and will probably vary so much that it can't be checked in the test. It is however very useful when debugging failures. diff --git a/tests/dummysmtpd.py b/tests/dummysmtpd.py --- a/tests/dummysmtpd.py +++ b/tests/dummysmtpd.py @@ -28,7 +28,10 @@ class dummysmtpserver(smtpd.SMTPServer): smtpd.SMTPServer.__init__(self, localaddr, remoteaddr=None) def process_message(self, peer, mailfrom, rcpttos, data, **kwargs): -log('%s from=%s to=%s\n' % (peer[0], mailfrom, ', '.join(rcpttos))) +log( +'%s from=%s to=%s\n%s\n' +% (peer[0], mailfrom, ', '.join(rcpttos), data.decode()) +) def handle_error(self): # On Windows, a bad SSL connection sometimes generates a WSAECONNRESET. @@ -54,8 +57,8 @@ class dummysmtpsecureserver(dummysmtpser try: # wrap_socket() would block, but we don't care conn = sslutil.wrapserversocket(conn, ui, certfile=self._certfile) -except ssl.SSLError: -log('%s ssl error\n' % addr[0]) +except ssl.SSLError as e: +log('%s ssl error: %s\n' % (addr[0], e)) conn.close() return smtpd.SMTPChannel(self, conn, addr) diff --git a/tests/test-patchbomb-tls.t b/tests/test-patchbomb-tls.t --- a/tests/test-patchbomb-tls.t +++ b/tests/test-patchbomb-tls.t @@ -76,7 +76,7 @@ Without certificates: [150] $ cat ../log - * ssl error (glob) + * ssl error: * (glob) $ : > ../log With global certificates: @@ -92,6 +92,35 @@ With global certificates: $ cat ../log * from=quux to=foo, bar (glob) + MIME-Version: 1.0 + Content-Type: text/plain; charset="us-ascii" + Content-Transfer-Encoding: 7bit + Subject: [PATCH] a + X-Mercurial-Node: 8580ff50825a50c8f716709acdf8de0deddcd6ab + X-Mercurial-Series-Index: 1 + X-Mercurial-Series-Total: 1 + Message-Id: <*@test-hostname> (glob) + X-Mercurial-Series-Id: <*@test-hostname> (glob) + User-Agent: Mercurial-patchbomb* (glob) + Date: * (glob) + From: quux + To: foo + Cc: bar + + # HG changeset patch + # User test + # Date 1 0 + # Thu Jan 01 00:00:01 1970 + + # Node ID 8580ff50825a50c8f716709acdf8de0deddcd6ab + # Parent + a + + diff -r -r 8580ff50825a50c8f716709acdf8de0deddcd6ab a + --- /dev/nullThu Jan 01 00:00:00 1970 + + +++ b/a Thu Jan 01 00:00:01 1970 + + @@ -0,0 +1,1 @@ + +a + $ : > ../log With invalid certificates: @@ -105,7 +134,7 @@ With invalid certificates: [255] $ cat ../log - * ssl error (glob) + * ssl error: * (glob) $ : > ../log $ cd .. ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 04 of 10] demandimport: don't delay _distutils_hack import
# HG changeset patch # User Mads Kiilerich # Date 1687908670 -7200 # Wed Jun 28 01:31:10 2023 +0200 # Branch stable # Node ID 8687d17528a1fe764572c402f2d0198d5a6c8fbc # Parent deb45f7a7f7bdc36c36f7bfb63c36701b44972ab demandimport: don't delay _distutils_hack import test-demandimport.py would fail on 'import distutils.msvc9compiler' because warnings: /usr/lib/python3.11/site-packages/_distutils_hack/__init__.py:18: UserWarning: Distutils was imported before Setuptools, but importing Setuptools also replaces the `distutils` module in `sys.modules`. This may lead to undesirable behaviors or errors. To avoid these issues, avoid using distutils directly, ensure that setuptools is installed in the traditional way (e.g. not an editable install), and/or make sure that setuptools is always imported before distutils. warnings.warn( /usr/lib/python3.11/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") Telling demandimport to ignore this module will allow the hack to work as intended. Note: The test for distutils.msvc9compiler comes from 2205d00b6d2b. But since then, distutils is going away, and setuptools has moved forward and is replacing it. It is unclear exactly what is being tested here and how setuptools should depended on msvc9compiler. The test might no longer be relevant. diff --git a/hgdemandimport/__init__.py b/hgdemandimport/__init__.py --- a/hgdemandimport/__init__.py +++ b/hgdemandimport/__init__.py @@ -55,6 +55,9 @@ IGNORES = { 'builtins', 'urwid.command_map', # for pudb 'lzma', +# setuptools uses this hack to inject it's own distutils at import time +'setuptools', +'_distutils_hack.override', } _pypy = '__pypy__' in sys.builtin_module_names ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 02 of 10] tests: use grep -F instead of obsolescent fgrep
# HG changeset patch # User Mads Kiilerich # Date 1687784040 -7200 # Mon Jun 26 14:54:00 2023 +0200 # Branch stable # Node ID 141a32ae6e30dc9bdf0e742f240734afa37f3054 # Parent 2790b07cd5da2be40fd5299ae114a49eb6196e55 tests: use grep -F instead of obsolescent fgrep Testing on Fedora 38 failed with: fgrep: warning: fgrep is obsolescent; using grep -F The warning comes from https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d480e3142fd959bccd1c9372d1 . For further anecdotal evidence of the change, see https://www.phoronix.com/news/GNU-Grep-3.8-Stop-egrep-fgrep . grep -F is POSIX, but there is a risk that it doesn't work the same on all platforms - especially older Unix versions. It should however always be possible to put a GNU grep in $PATH before running the tests. diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -147,6 +147,7 @@ testpats = [ '[ foo == bar ] is a bashism, use [ foo = bar ] instead', ), (r'(^|\|\s*)egrep', "use grep -E for extended grep syntax"), +(r'(^|\|\s*)fgrep', "use grep -F for fixed string grepping"), (r'(^|\|\s*)e?grep .*\\S', "don't use \\S in regular expression"), (r'(?> test - $ hg pull -u 2>&1 | fgrep -v TESTTMP| fgrep -v "searching for changes" | fgrep -v adding + $ hg pull -u 2>&1 | grep -F -v TESTTMP| grep -F -v "searching for changes" | grep -F -v adding pulling from $TESTTMP/a updating bookmark X added 1 changesets with 0 changes to 0 files (+1 heads) ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 03 of 10] tests: update test-remotefilelog-gc.t for Python 3.11
# HG changeset patch # User Mads Kiilerich # Date 1679497559 -3600 # Wed Mar 22 16:05:59 2023 +0100 # Branch stable # Node ID deb45f7a7f7bdc36c36f7bfb63c36701b44972ab # Parent 141a32ae6e30dc9bdf0e742f240734afa37f3054 tests: update test-remotefilelog-gc.t for Python 3.11 The test output changed because test coverage changed because normpath changed: $ python3.10 -c 'import os; print(repr(os.path.normpath("asdas\0das")))' 'asdas\x00das' $ python3.11 -c 'import os; print(repr(os.path.normpath("asdas\0das")))' 'asdas' diff --git a/tests/test-remotefilelog-gc.t b/tests/test-remotefilelog-gc.t --- a/tests/test-remotefilelog-gc.t +++ b/tests/test-remotefilelog-gc.t @@ -106,6 +106,11 @@ # Test that warning is displayed when the repo path is malformed $ printf "asdas\0das" >> $CACHEDIR/repos +#if py311 + $ hg gc + finished: removed 0 of 4 files (0.00 GB to 0.00 GB) +#else $ hg gc abort: invalid path asdas\x00da: .*(null|NULL).* (re) [255] +#endif ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 5 of 5 stable] tests: update test-remotefilelog-gc.t for Python 3.11
# HG changeset patch # User Mads Kiilerich # Date 1679497559 -3600 # Wed Mar 22 16:05:59 2023 +0100 # Branch stable # Node ID 2ba2e699e4c38398ab4d408e7cd3d3f148ea11c1 # Parent 7c544bc71aaca594998649ae02d35fb4dd7606b4 tests: update test-remotefilelog-gc.t for Python 3.11 The test output changed because test coverage changed because normpath changed: $ python3.10 -c 'import os; print(repr(os.path.normpath("asdas\0das")))' 'asdas\x00das' $ python3.11 -c 'import os; print(repr(os.path.normpath("asdas\0das")))' 'asdas' diff --git a/tests/test-remotefilelog-gc.t b/tests/test-remotefilelog-gc.t --- a/tests/test-remotefilelog-gc.t +++ b/tests/test-remotefilelog-gc.t @@ -106,6 +106,11 @@ # Test that warning is displayed when the repo path is malformed $ printf "asdas\0das" >> $CACHEDIR/repos +#if py311 + $ hg gc + finished: removed 0 of 4 files (0.00 GB to 0.00 GB) +#else $ hg gc abort: invalid path asdas\x00da: .*(null|NULL).* (re) [255] +#endif ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 5 stable] tests: skip test-https.t TLSv1 testing when system doesn't support it
# HG changeset patch # User Mads Kiilerich # Date 1679500739 -3600 # Wed Mar 22 16:58:59 2023 +0100 # Branch stable # Node ID 7c544bc71aaca594998649ae02d35fb4dd7606b4 # Parent d641581ee136281971555adc05049b826e995fed tests: skip test-https.t TLSv1 testing when system doesn't support it The test failed on Fedora with the default security policy, unless degrading system with: # update-crypto-policies --set LEGACY diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -701,6 +701,14 @@ def has_defaultcacertsloaded(): return len(ctx.get_ca_certs()) > 0 +@check("tls1.0", "TLS 1 protocol support") +def has_tls1_0(): +import ssl + +ctx = ssl.create_default_context() +return ctx.minimum_version <= ssl.TLSVersion.TLSv1 + + @check("tls1.2", "TLS 1.2 protocol support") def has_tls1_2(): from mercurial import sslutil diff --git a/tests/test-https.t b/tests/test-https.t --- a/tests/test-https.t +++ b/tests/test-https.t @@ -356,10 +356,12 @@ Start servers running supported TLS vers Clients talking same TLS versions work +#if tls1.0 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.0 --config hostsecurity.ciphers=DEFAULT id https://localhost:$HGPORT/ 5fed3813f7f5 $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.1 --config hostsecurity.ciphers=DEFAULT id https://localhost:$HGPORT1/ 5fed3813f7f5 +#endif $ P="$CERTSDIR" hg --config hostsecurity.minimumprotocol=tls1.2 id https://localhost:$HGPORT2/ 5fed3813f7f5 @@ -391,6 +393,8 @@ Clients requiring newer TLS version than abort: error: .*(unsupported protocol|wrong ssl version|alert protocol version).* (re) [100] +#if tls1.0 + --insecure will allow TLS 1.0 connections and override configs $ hg --config hostsecurity.minimumprotocol=tls1.2 id --insecure https://localhost:$HGPORT1/ @@ -405,6 +409,8 @@ The per-host config option overrides the > --config hostsecurity.localhost:minimumprotocol=tls1.0 5fed3813f7f5 +#endif + The per-host config option by itself works $ P="$CERTSDIR" hg id https://localhost:$HGPORT/ \ ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 5 stable] tests: update test-serve.t to use $EACCES$
# HG changeset patch # User Mads Kiilerich # Date 1679494603 -3600 # Wed Mar 22 15:16:43 2023 +0100 # Branch stable # Node ID d641581ee136281971555adc05049b826e995fed # Parent 0a2a580319267132acd4ab558b0bfcd4f995a50f tests: update test-serve.t to use $EACCES$ diff --git a/tests/test-serve.t b/tests/test-serve.t --- a/tests/test-serve.t +++ b/tests/test-serve.t @@ -55,7 +55,7 @@ With -v and -p daytime #if no-windows $ KILLQUIETLY=Y $ hgserve -p daytime - abort: cannot start server at 'localhost:13': Permission denied (?) + abort: cannot start server at 'localhost:13': $EACCES$ (?) abort: child process failed to start (?) abort: no port number associated with service 'daytime' (?) listening at http://localhost/ (bound to $LOCALIP:13) (?) ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 5 stable] tests: update test-transaction-rollback-on-revlog-split.t after e2ba2234bf1c
# HG changeset patch # User Mads Kiilerich # Date 1679494192 -3600 # Wed Mar 22 15:09:52 2023 +0100 # Branch stable # Node ID 0a2a580319267132acd4ab558b0bfcd4f995a50f # Parent 34c33da95b1aede3c9e63d1508570e2d8c620d9c tests: update test-transaction-rollback-on-revlog-split.t after e2ba2234bf1c Do like e9d92faa08f8 diff --git a/tests/test-transaction-rollback-on-revlog-split.t b/tests/test-transaction-rollback-on-revlog-split.t --- a/tests/test-transaction-rollback-on-revlog-split.t +++ b/tests/test-transaction-rollback-on-revlog-split.t @@ -130,7 +130,7 @@ Reference size: #else $ hg pull ../troffset-computation pulling from ../troffset-computation - Killed + *Killed* (glob) (?) [137] #endif @@ -210,7 +210,7 @@ Reference size: adding changesets adding manifests adding file changes - Killed + *Killed* (glob) (?) [137] #endif @@ -275,7 +275,7 @@ Reference size: adding changesets adding manifests adding file changes - Killed + *Killed* (glob) (?) [137] #endif ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 5 stable] tests: avoid using black >= 21
# HG changeset patch # User Mads Kiilerich # Date 1679416596 -3600 # Tue Mar 21 17:36:36 2023 +0100 # Branch stable # Node ID 34c33da95b1aede3c9e63d1508570e2d8c620d9c # Parent 4be9ecc982e19362747497276fa0841941787d08 tests: avoid using black >= 21 Different formatting will make test-check-format.t fail. diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -1115,7 +1115,9 @@ def has_black(): 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') +return version and ( +sv('20.8b1') <= sv(_bytes2sys(version.group(1))) < sv('21.0') +) @check('pytype', 'the pytype type checker') ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] py3: fix for Python 3.12 emitting SyntaxWarning on invalid escape sequences
Thanks for landing the previous 3.12 fixes. But I missed one fix ... The remaining test failures on 3.12 are mostly from the removal (asyncore, smtpd and distutils) and deprecation (cgitb) in standard library. /Mads ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] tests: avoid using black >= 21
# HG changeset patch # User Mads Kiilerich # Date 1679416596 -3600 # Tue Mar 21 17:36:36 2023 +0100 # Branch stable # Node ID c6a1fc106a05b608983caced38a1849b2f4b476f # Parent 812482250f8d49159bb3024f08e0db38d0bad565 tests: avoid using black >= 21 Different formatting will make test-check-format.t fail. diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -1115,7 +1115,7 @@ def has_black(): 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') +return version and sv('20.8b1') <= sv(_bytes2sys(version.group(1))) < sv('21') @check('pytype', 'the pytype type checker') ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] py3: fix for Python 3.12 emitting SyntaxWarning on invalid escape sequences
# HG changeset patch # User Mads Kiilerich # Date 1679414842 -3600 # Tue Mar 21 17:07:22 2023 +0100 # Branch stable # Node ID 812482250f8d49159bb3024f08e0db38d0bad565 # Parent 87f0155d68aa56dcba2326692fff893c283cca96 py3: fix for Python 3.12 emitting SyntaxWarning on invalid escape sequences Missed in 805d4a462abb: $ python3.12 mercurial/store.py mercurial/store.py:406: SyntaxWarning: invalid escape sequence '\.' EXCLUDED = re.compile(b'.*undo\.[^/]+\.(nd?|i)$') diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -403,7 +403,7 @@ REVLOG_FILES_VOLATILE_EXT = (b'.n', b'.n # some exception to the above matching # # XXX This is currently not in use because of issue6542 -EXCLUDED = re.compile(b'.*undo\.[^/]+\.(nd?|i)$') +EXCLUDED = re.compile(br'.*undo\.[^/]+\.(nd?|i)$') def is_revlog(f, kind, st): ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 4 of 4 stable] hg-core: upgrade `zstd` dependency to 0.12
On 13/03/2023 15:44, Raphaël Gomès wrote: The idea is to have everything run through the CI. Contributions going through the repo and thus Heptapod makes it much easier for reviewers. Email remains as the lowest bar of entry (since you don't need an account and two out-of-core extensions) and for people truly allergic to the new workflow. I get so few email patches I forget how to queue patches that need amending, heh. Maybe the mbox extension would help, but it's pretty low priority for me ATM. I agree that email patches are the simplest way to contribute - especially when you already have it setup and working. Also, I consider it important that Mercurial is fully self hosted when using email patches, and it support all client side workflows. It seems like contributing through heptapod depends on using the evolve extension and changing the development workflow. Thanks, but no thanks. https://www.mercurial-scm.org/wiki/ContributingChanges still mentions email as a valid option. I will rely on that. And figure out what to do if it is removed without a good alternative. I hope you the patches can land for 6.4 . There will still be many test failures for Python 3.12 , but it will be possible to get far enough to see and fix them individually. /Mads ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 4 of 4 stable] hg-core: upgrade `zstd` dependency to 0.12
Thanks. I still maintain my local copy of https://www.mercurial-scm.org/wiki/MboxExtension . Something like that could be perhaps be patched into heptapod if the goal is to have everything running through the web interface. /Mads On 09/03/2023 18:33, Augie Fackler wrote: Series LGTM for stable, but last time I queued something from the ML I think I angered the heptapod gods, so I’ll tag a couple of people that can hopefully push this on our behalf. AF On Mar 7, 2023, at 13:23, Mads Kiilerich wrote: # HG changeset patch # User Mads Kiilerich # Date 1678212582 -3600 # Tue Mar 07 19:09:42 2023 +0100 # Branch stable # Node ID 98085f80f5b0c786dad342ad1eb9335dda653496 # Parent 6ab12a75c936e0f1bf4305b9fdf9960219d1a39c hg-core: upgrade `zstd` dependency to 0.12 zstd was recently upgraded from 0.5 to 0.11 . Now, take it one step further to 0.12 . There is no need to stay in the past. And 0.12 is available in Fedora - 0.11 isn't. diff --git a/rust/Cargo.lock b/rust/Cargo.lock --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1425,18 +1425,18 @@ checksum = "09041cd90cf85f7f8b2df60c646f [[package]] name = "zstd" -version = "0.11.2+zstd.1.5.2" +version = "0.12.3+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index; -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "6.0.4+zstd.1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index; -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "7afb4b54b8910cf5447638cb54bf4e8a65cbedd783af98b98c62ffe91f185543" dependencies = [ "libc", "zstd-sys", @@ -1444,10 +1444,11 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.1+zstd.1.5.2" +version = "2.0.7+zstd.1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index; -checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" +checksum = "94509c3ba2fe55294d752b79842c530ccfab760192521df74a081a78d2b3c7f5" dependencies = [ "cc", "libc", + "pkg-config", ] diff --git a/rust/hg-core/Cargo.toml b/rust/hg-core/Cargo.toml --- a/rust/hg-core/Cargo.toml +++ b/rust/hg-core/Cargo.toml @@ -34,7 +34,7 @@ thread_local = "1.1.4" crossbeam-channel = "0.5.6" log = "0.4.17" memmap2 = { version = "0.5.8", features = ["stable_deref_trait"] } -zstd = "0.11.2" +zstd = "0.12" format-bytes = "0.3.0" # once_cell 1.15 uses edition 2021, while the heptapod CI # uses an old version of Cargo that doesn't support it. ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 4 stable] hg-core: upgrade `zstd` dependency to 0.12
# HG changeset patch # User Mads Kiilerich # Date 1678212582 -3600 # Tue Mar 07 19:09:42 2023 +0100 # Branch stable # Node ID 98085f80f5b0c786dad342ad1eb9335dda653496 # Parent 6ab12a75c936e0f1bf4305b9fdf9960219d1a39c hg-core: upgrade `zstd` dependency to 0.12 zstd was recently upgraded from 0.5 to 0.11 . Now, take it one step further to 0.12 . There is no need to stay in the past. And 0.12 is available in Fedora - 0.11 isn't. diff --git a/rust/Cargo.lock b/rust/Cargo.lock --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1425,18 +1425,18 @@ checksum = "09041cd90cf85f7f8b2df60c646f [[package]] name = "zstd" -version = "0.11.2+zstd.1.5.2" +version = "0.12.3+zstd.1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index; -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "6.0.4+zstd.1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index; -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "7afb4b54b8910cf5447638cb54bf4e8a65cbedd783af98b98c62ffe91f185543" dependencies = [ "libc", "zstd-sys", @@ -1444,10 +1444,11 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.1+zstd.1.5.2" +version = "2.0.7+zstd.1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index; -checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" +checksum = "94509c3ba2fe55294d752b79842c530ccfab760192521df74a081a78d2b3c7f5" dependencies = [ "cc", "libc", + "pkg-config", ] diff --git a/rust/hg-core/Cargo.toml b/rust/hg-core/Cargo.toml --- a/rust/hg-core/Cargo.toml +++ b/rust/hg-core/Cargo.toml @@ -34,7 +34,7 @@ thread_local = "1.1.4" crossbeam-channel = "0.5.6" log = "0.4.17" memmap2 = { version = "0.5.8", features = ["stable_deref_trait"] } -zstd = "0.11.2" +zstd = "0.12" format-bytes = "0.3.0" # once_cell 1.15 uses edition 2021, while the heptapod CI # uses an old version of Cargo that doesn't support it. ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 4 stable] statprof: with Python 3.12, lineno is (more) often None
# HG changeset patch # User Mads Kiilerich # Date 1678205618 -3600 # Tue Mar 07 17:13:38 2023 +0100 # Branch stable # Node ID 6ab12a75c936e0f1bf4305b9fdf9960219d1a39c # Parent 72ba5a6dbb52570fbdfa07ce15ac6ad88e35f63c statprof: with Python 3.12, lineno is (more) often None test-profile.t failed with errors like: TypeError: %d format: a real number is required, not NoneType statprof.py already handled None values as -1 in some cases. Do the same in more cases. diff --git a/mercurial/statprof.py b/mercurial/statprof.py --- a/mercurial/statprof.py +++ b/mercurial/statprof.py @@ -540,7 +540,7 @@ def display_by_line(data, fp): for stat in stats: site = stat.site -sitelabel = b'%s:%d:%s' % (site.filename(), site.lineno, site.function) +sitelabel = b'%s:%d:%s' % (site.filename(), site.lineno or -1, site.function) fp.write( b'%6.2f %9.2f %9.2f %s\n' % ( @@ -613,7 +613,7 @@ def display_by_method(data, fp): stattuple = ( stat.selfpercent(), stat.selfseconds(), -stat.site.lineno, +stat.site.lineno or -1, source, ) ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 4 stable] py3: fix for Python 3.12 emitting SyntaxWarning on invalid escape sequences
# HG changeset patch # User Mads Kiilerich # Date 1678203954 -3600 # Tue Mar 07 16:45:54 2023 +0100 # Branch stable # Node ID 72ba5a6dbb52570fbdfa07ce15ac6ad88e35f63c # Parent 1efa4e96f6461bf071b28d66b13bdb67fdc91fc6 py3: fix for Python 3.12 emitting SyntaxWarning on invalid escape sequences Mercurial became very noisy after https://github.com/python/cpython/commit/a60ddd31be7ff96a8189e7483bf1eb2071d2bddf , for example: $ python3.12 mercurial/store.py mercurial/store.py:406: SyntaxWarning: invalid escape sequence '\.' EXCLUDED = re.compile(b'.*undo\.[^/]+\.(nd?|i)$') This verbosity made some tests fail. The problems were mostly insufficiently escaped regexps, relying on the Python parser/scanner preserving invalid escape sequences. diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -196,14 +196,14 @@ def match( ... return match(util.localpath(root), *args, **kwargs) Usually a patternmatcher is returned: ->>> _match(b'/foo', b'.', [b're:.*\.c$', b'path:foo/a', b'*.py']) +>>> _match(b'/foo', b'.', [br're:.*\.c$', b'path:foo/a', b'*.py']) Combining 'patterns' with 'include' (resp. 'exclude') gives an intersectionmatcher (resp. a differencematcher): ->>> type(_match(b'/foo', b'.', [b're:.*\.c$'], include=[b'path:lib'])) +>>> type(_match(b'/foo', b'.', [br're:.*\.c$'], include=[b'path:lib'])) ->>> type(_match(b'/foo', b'.', [b're:.*\.c$'], exclude=[b'path:build'])) +>>> type(_match(b'/foo', b'.', [br're:.*\.c$'], exclude=[b'path:build'])) Notice that, if 'patterns' is empty, an alwaysmatcher is returned: @@ -212,7 +212,7 @@ def match( The 'default' argument determines which kind of pattern is assumed if a pattern has no prefix: ->>> _match(b'/foo', b'.', [b'.*\.c$'], default=b're') +>>> _match(b'/foo', b'.', [br'.*\.c$'], default=b're') >>> _match(b'/foo', b'.', [b'main.py'], default=b'relpath') @@ -223,7 +223,7 @@ def match( name) matches againset one of the patterns given at initialization. There are two ways of doing this check. ->>> m = _match(b'/foo', b'', [b're:.*\.c$', b'relpath:a']) +>>> m = _match(b'/foo', b'', [br're:.*\.c$', b'relpath:a']) 1. Calling the matcher with a file name returns True if any pattern matches that file name: diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1988,7 +1988,7 @@ such str.lower(). $ "$PYTHON" < def escape(s): - > return b''.join(b'\\u%x' % ord(uc) for uc in s.decode('cp932')) + > return b''.join(br'\\u%x' % ord(uc) for uc in s.decode('cp932')) > # translation of "record" in ja_JP.cp932 > upper = b"\x8bL\x98^" > # str.lower()-ed section name should be treated as different one diff --git a/tests/test-minirst.py b/tests/test-minirst.py --- a/tests/test-minirst.py +++ b/tests/test-minirst.py @@ -154,7 +154,7 @@ marker after the option. It is treated a debugformats('options', options) -fields = b""" +fields = br""" :a: First item. :ab: Second item. Indentation and wrapping is handled automatically. diff --git a/tests/testlib/persistent-nodemap-race-ext.py b/tests/testlib/persistent-nodemap-race-ext.py --- a/tests/testlib/persistent-nodemap-race-ext.py +++ b/tests/testlib/persistent-nodemap-race-ext.py @@ -1,4 +1,4 @@ -"""Create the race condition for issue6554 +r"""Create the race condition for issue6554 The persistent nodemap issues had an issue where a second writer could overwrite the data that a previous write just wrote. The would break the append ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 4 stable] cext: fix for PyLong refactoring in CPython 3.12
# HG changeset patch # User Mads Kiilerich # Date 1678202751 -3600 # Tue Mar 07 16:25:51 2023 +0100 # Branch stable # Node ID 1efa4e96f6461bf071b28d66b13bdb67fdc91fc6 # Parent 8a65b43457aba02741bedabe100823d3041af0b5 cext: fix for PyLong refactoring in CPython 3.12 Compiling Mercurial with Python 3.12 a5 would fail with: mercurial/cext/dirs.c: In function '_addpath': mercurial/cext/dirs.c:19:44: error: 'PyLongObject' {aka 'struct _longobject'} has no member named 'ob_digit' 19 | #define PYLONG_VALUE(o) ((PyLongObject *)o)->ob_digit[0] |^~ mercurial/cext/dirs.c:97:25: note: in expansion of macro 'PYLONG_VALUE' 97 | PYLONG_VALUE(val) += 1; | ^~~~ mercurial/cext/dirs.c:19:44: error: 'PyLongObject' {aka 'struct _longobject'} has no member named 'ob_digit' 19 | #define PYLONG_VALUE(o) ((PyLongObject *)o)->ob_digit[0] |^~ mercurial/cext/dirs.c:108:17: note: in expansion of macro 'PYLONG_VALUE' 108 | PYLONG_VALUE(val) = 1; | ^~~~ mercurial/cext/dirs.c: In function '_delpath': mercurial/cext/dirs.c:19:44: error: 'PyLongObject' {aka 'struct _longobject'} has no member named 'ob_digit' 19 | #define PYLONG_VALUE(o) ((PyLongObject *)o)->ob_digit[0] |^~ mercurial/cext/dirs.c:145:23: note: in expansion of macro 'PYLONG_VALUE' 145 | if (--PYLONG_VALUE(val) <= 0) { | ^~~~ This was caused by https://github.com/python/cpython/commit/c1b1f51cd1632f0b77dacd43092fb44ed5e053a9 . diff --git a/mercurial/cext/dirs.c b/mercurial/cext/dirs.c --- a/mercurial/cext/dirs.c +++ b/mercurial/cext/dirs.c @@ -13,7 +13,11 @@ #include "util.h" +#if PY_VERSION_HEX >= 0x030C00A5 +#define PYLONG_VALUE(o) ((PyLongObject *)o)->long_value.ob_digit[0] +#else #define PYLONG_VALUE(o) ((PyLongObject *)o)->ob_digit[0] +#endif /* * This is a multiset of directory names, built from the files that ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH stable] rust: bump to memmap2 0.5.3, micro-timer 0.4.0, and crossbeam-channel 0.5.0
Raphaël, could you please have a look at this? /Mads On 7/11/22 23:03, Mads Kiilerich wrote: # HG changeset patch # User Mads Kiilerich # Date 1657572476 -7200 # Mon Jul 11 22:47:56 2022 +0200 # Branch stable # Node ID f1713e81437e894fab0658e4f410184e10d35e5e # Parent 55adff8105464f6247983940ba109684d36b689d rust: bump to memmap2 0.5.3, micro-timer 0.4.0, and crossbeam-channel 0.5.0 The merge in 12adf8c695ed had conflicts in rust/Cargo.lock and rust/hg-core/Cargo.toml . Let's ignore rust/Cargo.lock - it is regenerated. For rust/hg-core/Cargo.toml, stable had dd6b67d5c256 "rust: fix unsound `OwningDirstateMap`" which introduced ouroboros (and dropped stable_deref_trait). Default had ec8d9b5a5e7c "rust-hg-core: upgrade dependencies" which had a lot of churn bumping minimum versions - also patch versions. It is indeed a good idea to bump to *allow* use of latest package. That means that major versions should be bumped for packages after 1.0, and for packages below 1.0 minor versions should be bumped too. But it doesn't work to try enforce a policy of using latest patch by bumping versions at arbitrary times. For good or bad, the merge doesn't seem to have resolved the conflicts correctly, and many of the minor "upgrade dependencies" were lost again. Unfortunately, it also lost the bump of memmap2 to 0.5.3, which is needed for Fedora packaging where 0.4 isn't available. Same with micro-timer bump to 0.4 (which already is used in rhg). crossbeam-channel bump was also lost. This change fixes that regression by redoing these "important" lines of the merge "correctly". I propose this for stable, even though dependency changes on stable branches are annoying. diff --git a/rust/hg-core/Cargo.toml b/rust/hg-core/Cargo.toml --- a/rust/hg-core/Cargo.toml +++ b/rust/hg-core/Cargo.toml @@ -29,10 +29,10 @@ sha-1 = "0.10.0" twox-hash = "1.6.2" same-file = "1.0.6" tempfile = "3.1.0" -crossbeam-channel = "0.4" -micro-timer = "0.3.0" +crossbeam-channel = "0.5.0" +micro-timer = "0.4.0" log = "0.4.8" -memmap2 = {version = "0.4", features = ["stable_deref_trait"]} +memmap2 = { version = "0.5.3", features = ["stable_deref_trait"] } zstd = "0.5.3" format-bytes = "0.3.0" ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH stable] rust: bump to memmap2 0.5.3, micro-timer 0.4.0, and crossbeam-channel 0.5.0
# HG changeset patch # User Mads Kiilerich # Date 1657572476 -7200 # Mon Jul 11 22:47:56 2022 +0200 # Branch stable # Node ID f1713e81437e894fab0658e4f410184e10d35e5e # Parent 55adff8105464f6247983940ba109684d36b689d rust: bump to memmap2 0.5.3, micro-timer 0.4.0, and crossbeam-channel 0.5.0 The merge in 12adf8c695ed had conflicts in rust/Cargo.lock and rust/hg-core/Cargo.toml . Let's ignore rust/Cargo.lock - it is regenerated. For rust/hg-core/Cargo.toml, stable had dd6b67d5c256 "rust: fix unsound `OwningDirstateMap`" which introduced ouroboros (and dropped stable_deref_trait). Default had ec8d9b5a5e7c "rust-hg-core: upgrade dependencies" which had a lot of churn bumping minimum versions - also patch versions. It is indeed a good idea to bump to *allow* use of latest package. That means that major versions should be bumped for packages after 1.0, and for packages below 1.0 minor versions should be bumped too. But it doesn't work to try enforce a policy of using latest patch by bumping versions at arbitrary times. For good or bad, the merge doesn't seem to have resolved the conflicts correctly, and many of the minor "upgrade dependencies" were lost again. Unfortunately, it also lost the bump of memmap2 to 0.5.3, which is needed for Fedora packaging where 0.4 isn't available. Same with micro-timer bump to 0.4 (which already is used in rhg). crossbeam-channel bump was also lost. This change fixes that regression by redoing these "important" lines of the merge "correctly". I propose this for stable, even though dependency changes on stable branches are annoying. diff --git a/rust/hg-core/Cargo.toml b/rust/hg-core/Cargo.toml --- a/rust/hg-core/Cargo.toml +++ b/rust/hg-core/Cargo.toml @@ -29,10 +29,10 @@ sha-1 = "0.10.0" twox-hash = "1.6.2" same-file = "1.0.6" tempfile = "3.1.0" -crossbeam-channel = "0.4" -micro-timer = "0.3.0" +crossbeam-channel = "0.5.0" +micro-timer = "0.4.0" log = "0.4.8" -memmap2 = {version = "0.4", features = ["stable_deref_trait"]} +memmap2 = { version = "0.5.3", features = ["stable_deref_trait"] } zstd = "0.5.3" format-bytes = "0.3.0" ___ Mercurial-devel mailing list Mercurial-devel@lists.mercurial-scm.org https://lists.mercurial-scm.org/mailman/listinfo/mercurial-devel