Mercurial > hg
diff mercurial/store.py @ 51728:2e9e62242451
typing: disable some pytype errors in `mercurial.store`
These seem to be legitimate errors, since one of the two callers
(`encodedstore.data_entries()`) was previously typed to generate
`BaseStoreEntry`. However, that and the other caller only pass
`RevlogStoreEntry` objects. I can't tell if this was a WIP or what, but don't
want to get side tracked on this. So flag as a TODO for later.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 23 Jul 2024 19:14:16 -0400 |
parents | ca7bde5dbafb |
children | 278af66e6595 |
line wrap: on
line diff
--- a/mercurial/store.py Tue Jul 23 19:05:26 2024 -0400 +++ b/mercurial/store.py Tue Jul 23 19:14:16 2024 -0400 @@ -40,7 +40,7 @@ fncache_chunksize = 10**6 -def _match_tracked_entry(entry, matcher): +def _match_tracked_entry(entry: "BaseStoreEntry", matcher): """parses a fncache entry and returns whether the entry is tracking a path matched by matcher or not. @@ -48,10 +48,16 @@ if matcher is None: return True + + # TODO: make this safe for other entry types. Currently, the various + # store.data_entry generators only yield RevlogStoreEntry, so the + # attributes do exist on `entry`. + # pytype: disable=attribute-error if entry.is_filelog: return matcher(entry.target_id) elif entry.is_manifestlog: return matcher.visitdir(entry.target_id.rstrip(b'/')) + # pytype: enable=attribute-error raise error.ProgrammingError(b"cannot process entry %r" % entry)