[Metrics] Add --show-hidden-metrics-for-version CLI arg (#13295)

This commit is contained in:
Mark McLoughlin
2025-02-22 08:20:45 +00:00
committed by GitHub
parent 1cd981da4f
commit 2cb8c1540e
7 changed files with 95 additions and 1 deletions

View File

@@ -11,3 +11,21 @@ except Exception as e:
__version__ = "dev"
__version_tuple__ = (0, 0, __version__)
def _prev_minor_version_was(version_str):
"""Check whether a given version matches the previous minor version.
Return True if version_str matches the previous minor version.
For example - return True if the current version if 0.7.4 and the
supplied version_str is '0.6'.
Used for --show-hidden-metrics-for-version.
"""
# Match anything if this is a dev tree
if __version_tuple__[0:2] == (0, 0):
return True
# Note - this won't do the right thing when we release 1.0!
return version_str == f"{__version_tuple__[0]}.{__version_tuple__[1] - 1}"