typing: add a type hint to `mercurial/hg.py`
Somewhere between hg
3dbc7b1ecaba and hg
8e3f6b5bf720, the first value of the
tuple changed from bytes to str. Let's lock this in, so that pytype flags it
if someone mistakenly adds a tuple with bytes somewhere.
--- a/mercurial/hg.py Wed Jul 10 17:37:35 2024 -0400
+++ b/mercurial/hg.py Wed Jul 10 17:44:49 2024 -0400
@@ -11,6 +11,7 @@
import posixpath
import shutil
import stat
+import typing
import weakref
from .i18n import _
@@ -57,6 +58,11 @@
urlutil,
)
+if typing.TYPE_CHECKING:
+ from typing import (
+ List,
+ Tuple,
+ )
release = lock.release
@@ -1597,7 +1603,7 @@
# Files of interest
# Used to check if the repository has changed looking at mtime and size of
# these files.
-foi = [
+foi: "List[Tuple[str, bytes]]" = [
('spath', b'00changelog.i'),
('spath', b'phaseroots'), # ! phase can change content at the same size
('spath', b'obsstore'),