Mercurial > public > mercurial-scm > hg-stable
diff mercurial/merge.py @ 52710:45dc0f874b8c
typing: lock in the type annotations that were lost with the pyupgrade changes
For some reason, these reverted from a specific type to something less useful
after the changes that culminated in 70a75d379daf. (e.g. the `remotefilectx`
method went from `Generator[remotefilectx, Any, None]` to
`Generator[nothing, Any, None]`.) The previous typing for `merge.filemap` was
`Generator[Tuple[Any, Tuple[Any, Any, Any]], Any, None]`, and decayed to
`Generator[nothing, Any, None]`. I don't feel like unravelling the specific
types here, so restore the equivalent of that.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sun, 12 Jan 2025 21:35:30 -0500 |
parents | e627cc25b6f3 |
children | f3762eafed66 |
line wrap: on
line diff
--- a/mercurial/merge.py Mon Jan 06 20:02:17 2025 -0500 +++ b/mercurial/merge.py Sun Jan 12 21:35:30 2025 -0500 @@ -11,7 +11,7 @@ import os import struct import typing -from typing import Dict, Optional, Tuple +from typing import Dict, Iterator, Optional, Tuple from .i18n import _ from .node import nullrev @@ -673,7 +673,7 @@ return sum(len(self._actionmapping[a]) for a in actions) - def filemap(self, sort=False): + def filemap(self, sort=False) -> Iterator[tuple]: # TODO: fill out tuple if sort: yield from sorted(self._filemapping.items()) else: