--- a/mercurial/patch.py Wed Jan 15 06:56:44 2025 +0100
+++ b/mercurial/patch.py Mon Jan 06 20:02:17 2025 -0500
@@ -14,6 +14,7 @@
import os
import re
import shutil
+import typing
import zlib
from .i18n import _
@@ -44,6 +45,12 @@
stringutil,
)
+if typing.TYPE_CHECKING:
+ from typing import (
+ Any,
+ Iterator,
+ )
+
stringio = util.stringio
gitre = re.compile(br'diff --git a/(.*) b/(.*)')
@@ -2792,7 +2799,9 @@
nextisnewline = True
-def difflabel(func, *args, **kw):
+# TODO: first tuple element is likely bytes, but was being detected as bytes|int
+# so it needs investigation/more typing here.
+def difflabel(func, *args, **kw) -> Iterator[tuple[Any, bytes]]:
'''yields 2-tuples of (output, label) based on the output of func()'''
if kw.get('opts') and kw['opts'].worddiff:
dodiffhunk = diffsinglehunkinline