On this page
Shared git tag-glob resolution for monorepo projects and releasables, deriving tag match patterns from releasable tag_format or detected target.
#rlsbl.tag_glob
#rlsbl.tag_glob
Shared git tag-glob resolution for monorepo projects and releasables.
A single source of truth for deriving the git tag match pattern of a monorepo project. Two code paths previously derived this independently (rlsbl monorepo status and rlsbl status), and one of them ignored the releasable's tag_format -- so releasable members reported no tag. Both now call :func:resolve_monorepo_tag_glob.
#TagMode
Whether :func:parse_version_tag accepts prerelease tags.
FINAL_ONLY rejects any tag carrying a prerelease suffix (v1.2.3-rc.1) -- used by call sites that count or match final releases only. PRERELEASE_INCLUSIVE accepts both final and prerelease tags. There is no default: every call site must state its semantics explicitly so the mode can never silently flip.
#TagVersion
Result of parsing a git tag into a version.
Attributes:
version: thex.y.z(optionally-prerelease) string, nov.scheme: which tag scheme matched --"standalone"(v1.2.3),
"monorepo" ([email protected]), or "path" (path/v1.2.3).
#parse_version_tag
def parse_version_tag(tag: str, *, mode: 'TagMode') -> 'TagVersion | None'Parse a git tag into a :class:TagVersion, or None if it is not a version tag under any known scheme.
Recognizes three schemes, matched against the whole tag (strict):
- standalone:
v1.2.3 - monorepo:
[email protected] - Go path-style:
some/path/v1.2.3
The version core must be strict semver (x.y.z); milestone-like tags (latest, milestone-3), partial versions (v1.2), and tags with no scheme separator before v are rejected. mode is required and controls whether a prerelease suffix is accepted:
- :attr:
TagMode.FINAL_ONLY--v1.2.3-rc.1is rejected (returnsNone). - :attr:
TagMode.PRERELEASE_INCLUSIVE--v1.2.3-rc.1yields1.2.3-rc.1.
#releasable_tag_glob
def releasable_tag_glob(tag_format: str, releasable_name: str) -> strDerive a glob from a releasable's tag_format.
Replaces {version} with * and fills in {name} with the literal releasable name so git tag -l matches all versions (e.g. "{name}@v{version}" -> "www@v*").
#_target_tag_scheme
def _target_tag_scheme(target, name, path)Classify a target's monorepo tag scheme.
Returns "at" for the {name}@v* scheme (base default, used by all targets except Go) or "path" for the {path}/v* scheme (Go's path-based module-proxy tags). Classification is derived from the target's own monorepo_tag_glob output so it stays correct if new targets adopt a path-based scheme.
#_mixed_tag_schemes
def _mixed_tag_schemes(target_entries, name, path)Group a member's targets by tag scheme.
Returns a dict {scheme: [target_name, ...]} when the member's targets span more than one tag scheme (the mixed-scheme hazard), otherwise None. Only targets present in TARGETS are considered.
#_mixed_scheme_error
def _mixed_scheme_error(project_path, mixed)Build the hard-error message for a mixed-tag-scheme member dir.
#resolve_monorepo_tag_glob
def resolve_monorepo_tag_glob(project, workspace_root, releasable=None) -> strReturn the git tag glob for a monorepo project.
When the project belongs to a releasable (explicit mode), the glob is derived from the releasable's tag_format -- this is the fix for releasable members previously falling back to the per-member target glob and reporting no tag. Otherwise the glob comes from the project's first detected target's monorepo_tag_glob, or "{name}@v*" when no target is detected.
Args:
project: a WorkspaceProject or dict withname/path.workspace_root: path to the monorepo root (str or Path).releasable: optional Releasable the project belongs to; when provided,
its tag_format drives the glob.