Mercurial > public > mercurial-scm > hg
diff mercurial/interfaces/dirstate.py @ 52754:a7dcb7c1ff5a
typing: add a transaction protocol
This allow us to remove the "external" import from
mercurial/interfaces/dirstate.py, cutting one of the circular import route.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 07 Feb 2025 13:48:50 +0100 |
parents | 5c48fd4c0e68 |
children |
line wrap: on
line diff
--- a/mercurial/interfaces/dirstate.py Fri Feb 07 16:40:49 2025 +0100 +++ b/mercurial/interfaces/dirstate.py Fri Feb 07 13:48:50 2025 +0100 @@ -20,13 +20,10 @@ if typing.TYPE_CHECKING: # Almost all mercurial modules are only imported in the type checking phase # to avoid circular imports - from .. import ( - transaction as txnmod, - ) - from . import ( matcher, status as istatus, + transaction, ) # TODO: finish adding type hints @@ -55,8 +52,7 @@ StatusReturnT = Tuple[Any, istatus.Status, Any] """The return type of dirstate.status().""" - # TODO: probably doesn't belong here. - TransactionT = txnmod.transaction + TransactionT = transaction.ITransaction """The type for a transaction used with dirstate. This is meant to help callers avoid having to remember to delay the import