comparison mercurial/hg.py @ 51670: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 c1b6b8b03e48
children f4733654f144
comparison
equal deleted inserted replaced
51669:f70f61a8c5bc 51670:e8f58714bcf0
9 9
10 import os 10 import os
11 import posixpath 11 import posixpath
12 import shutil 12 import shutil
13 import stat 13 import stat
14 import typing
14 import weakref 15 import weakref
15 16
16 from .i18n import _ 17 from .i18n import _
17 from .node import ( 18 from .node import (
18 hex, 19 hex,
55 hashutil, 56 hashutil,
56 stringutil, 57 stringutil,
57 urlutil, 58 urlutil,
58 ) 59 )
59 60
61 if typing.TYPE_CHECKING:
62 from typing import (
63 List,
64 Tuple,
65 )
60 66
61 release = lock.release 67 release = lock.release
62 68
63 # shared features 69 # shared features
64 sharedbookmarks = b'bookmarks' 70 sharedbookmarks = b'bookmarks'
1595 1601
1596 1602
1597 # Files of interest 1603 # Files of interest
1598 # Used to check if the repository has changed looking at mtime and size of 1604 # Used to check if the repository has changed looking at mtime and size of
1599 # these files. 1605 # these files.
1600 foi = [ 1606 foi: "List[Tuple[str, bytes]]" = [
1601 ('spath', b'00changelog.i'), 1607 ('spath', b'00changelog.i'),
1602 ('spath', b'phaseroots'), # ! phase can change content at the same size 1608 ('spath', b'phaseroots'), # ! phase can change content at the same size
1603 ('spath', b'obsstore'), 1609 ('spath', b'obsstore'),
1604 ('path', b'bookmarks'), # ! bookmark can change content at the same size 1610 ('path', b'bookmarks'), # ! bookmark can change content at the same size
1605 ] 1611 ]