filter-traceback: simplify handling
With all the recent change in Python, the best we need and can do is "ignore all
line starting with a space after a line starting with "Traceback ".
So let us simplify the script.
filter-traceback: minimal change to make 3.13 happy
Python3.13 is including more context in the traceback for multi lines statement,
so we need to extend the filtering. This is the minimal change, but the next
changeset will do a larger change to convey where we effectively land
interfaces: make `dirstate` Protocol class methods abstract
Now all known Protocol methods that should be implemented by the subclass are
abstract. See cdd4bc69bfc1 for details.
Note that this will break the `git` extension more, because there are a bunch of
methods that aren't implemented that should be, in favor of some very old
methods that won't be called (like `add()` and `drop()`). It's already broken,
so I'm not taking the time to figure out how to modernize it right now. It's
not detected by pytype because the only instantiation of `gitdirstate` is in
`git/__init__.py`, which was already excluded from pytype checking for some
other reason. AT least with this, it 1) doesn't get forgotten about, and 2)
will require changing the interface if/when the core dirstate class evolves.
interfaces: drop `_ignorefiles()` from `dirstate` Protocol
I didn't look back at the state of things when this was introduced as a zope
interface, but the method is only called inside of `mercurial.dirstate.dirstate`
now.
In general, private methods shouldn't be in the Protocol class, but some of
these are called from outside `dirstate` by debug commands.
interfaces: make the `peer` mixin not a Protocol to fix Python 3.10 failures
I can't find any documentation on this, but it appears that Protocol class
attributes don't get inherited in subclasses that explicitly subclass a Protocol
until Python 3.11, which caused a ton of failures in CI on macOS and Windows
(which both test using Python 3.9). The problem started with 1df97507c6b8, and
typically manifested as most tests failing to access `ui` on various `peer`
classes.
Here's a short proof of concept:
from __future__ import annotations
from typing import (
Protocol,
)
class peer(Protocol):
limitedarguments: bool = False
def __init__(self, arg1, arg2, remotehidden: bool = False) -> None:
self.arg1 = arg1
self.arg2 = arg2
class subclass(peer):
def __init__(self, arg1, arg2):
super(subclass, self).__init__(arg1, arg2, False)
sub = subclass(1, 2)
print("sub.arg1 is %r" % sub.arg1)
When run with Python 3.8.10, 3.9.13, and 3.10.11, the result is:
$ py -3.8 prot-test.py
Traceback (most recent call last):
File "prot-test.py", line 20, in <module>
print("sub.arg1 is %r" % sub.arg1)
AttributeError: 'subclass' object has no attribute 'arg1'
On Python 3.11.9, 3.12.7, and 3.13.0, the result is:
$ py -3.11 ../prot-test.py
sub.arg1 is 1
Explicitly adding annotations to `peer` like `limitedarguments` didn't help.
ci: automatically starts platform and py-version test for scheduled build
The point of these nightly build is to catch error on case we do not
systematically test. So we better test them.