# HG changeset patch # User Matt Harbison # Date 2024-08-17 21:38:35 # Node ID 07086b3ad50256744fb71150ae741d7b1e00468f # Parent 45270e286bdc7c638d1e89eceb6b6ad34a67d0bd typing: declare the `_phasesets` member of `phasecache` to be `Optional` Something in this area got flagged while making the repository class visible to pytype (instead of being typed as `Any`). A None assignment to something not optional is wrong, and when I tried setting it to `{}` to keep it non-Optional, some tests failed. There are checks for the attr being None elsewhere, so this seems to have just been an oversight. diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -387,7 +387,7 @@ class phasecache: self._phaseroots: Phaseroots = loaded[0] self.dirty: bool = loaded[1] self._loadedrevslen = 0 - self._phasesets: PhaseSets = None + self._phasesets: Optional[PhaseSets] = None def hasnonpublicphases(self, repo: "localrepo.localrepository") -> bool: """detect if there are revisions with non-public phase"""