# HG changeset patch # User Matt Harbison # Date 2024-07-10 21:44:49 # Node ID e8f58714bcf0483e1c78476c7d31c0b0c29e6a20 # Parent f70f61a8c5bc75687fe96aad7fe391d91045e25e 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. diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -11,6 +11,7 @@ import os import posixpath import shutil import stat +import typing import weakref from .i18n import _ @@ -57,6 +58,11 @@ from .utils import ( urlutil, ) +if typing.TYPE_CHECKING: + from typing import ( + List, + Tuple, + ) release = lock.release @@ -1597,7 +1603,7 @@ def remoteui(src, opts): # 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'),