Skip to content

Commit 0e89304

Browse files
Fix towncrier scheme to properly handle both monorepo and standard layouts
The scheme now correctly: - Uses relative_to (config file location) when set (for monorepo support) - Falls back to absolute_root (VCS root) when relative_to is not set This fixes the test failures where fallback_root (which defaults to ".") was being used instead of absolute_root, causing fragments to not be found.
1 parent be588eb commit 0e89304

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

vcs-versioning/src/vcs_versioning/_version_schemes_towncrier.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ def version_from_fragments(version: ScmVersion) -> str:
110110
return version.format_with("{tag}")
111111

112112
# Find where to look for changelog.d/ directory
113-
# Prefer relative_to (location of config file) over fallback_root
114-
# This allows monorepo support where changelog.d/ is in the project dir
113+
# Prefer relative_to (location of config file) for monorepo support
114+
# This allows changelog.d/ to be in the project dir rather than repo root
115115
if version.config.relative_to:
116116
# relative_to is typically the pyproject.toml file path
117117
# changelog.d/ should be in the same directory
@@ -122,8 +122,8 @@ def version_from_fragments(version: ScmVersion) -> str:
122122
else:
123123
root = Path(version.config.relative_to)
124124
else:
125-
# Fall back to using fallback_root if set, otherwise absolute_root
126-
root = Path(version.config.fallback_root or version.config.absolute_root)
125+
# When no relative_to is set, use absolute_root (the VCS root)
126+
root = Path(version.config.absolute_root)
127127

128128
log.debug("Analyzing fragments in %s", root)
129129

0 commit comments

Comments
 (0)