Mercurial > hg-stable
changeset 51734:e8f58714bcf0
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.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 10 Jul 2024 17:44:49 -0400 |
parents | f70f61a8c5bc |
children | bc94cbb49b30 |
files | mercurial/hg.py |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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'),