Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions misc/diff-cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from librt import base64
from librt.internal import ReadBuffer, WriteBuffer

from mypy.cache import CacheMeta
from mypy.cache import CacheMeta, CacheMetaEx
from mypy.metastore import FilesystemMetadataStore, MetadataStore, SqliteMetadataStore
from mypy.util import json_dumps, json_loads

Expand Down Expand Up @@ -69,6 +69,7 @@ def normalize_meta(meta: CacheMeta) -> None:

Zero out mtimes and sort dependencies deterministically.
"""
# TODO: handle dep_hashes here and in relevant parts below.
meta.mtime = 0
meta.data_mtime = 0
meta.dependencies, meta.suppressed, meta.dep_prios, meta.dep_lines = sort_deps(
Expand Down Expand Up @@ -115,7 +116,18 @@ def load(cache: MetadataStore, s: str) -> Any:
return data
normalize_meta(meta)
return serialize_meta_ff(meta, version_prefix)
if s.endswith((".data.ff", ".err.ff")):
if s.endswith(".meta_ex.ff"):
buf = ReadBuffer(data)
meta = CacheMetaEx.read(buf)
if meta is None:
# Can't deserialize. Fall back to raw bytes as above
return data
meta.dependencies.sort()
meta.suppressed.sort()
outbuf = WriteBuffer()
meta.write(outbuf)
return outbuf.getvalue()
if s.endswith(".data.ff"):
return data
obj = json_loads(data)
if s.endswith(".meta.json"):
Expand Down
Loading
Loading