nedbat / scriv

Changelog management tool
https://scriv.readthedocs.io
Apache License 2.0
256 stars 28 forks source link

Config resolved twice, resulting in not picking up MD fragment template #39

Closed brettcannon closed 3 years ago

brettcannon commented 3 years ago

With the following config in changelog.d/scriv.ini:

[tool.scriv]
format = md

I end up with fragments from the rst template. If I drop the following line: https://github.com/nedbat/scriv/blob/2e35bb99e9e8f52f39f125a0dc6eba6f12252a6d/src/scriv/config.py#L177

the issue goes away. It turns out that Config.resolve_all() is called twice: once with no settings read from the config file and again after reading the config. It looks like the first call sets config.new_fragment_template to the actual template and then subsequent resolve_all() don't update it since the file: new_fragment.${config:format}.j2 string has been replaced already.

brettcannon commented 3 years ago

This also affects the output file. I am working around it by explicitly specifying the settings that try to use format implicitly:

new_fragment_template = file: new_fragment.md.j2
output_file = CHANGELOG.md
nedbat commented 3 years ago

Fixed in 14d32e0.

nedbat commented 3 years ago

This is now available in version 0.12.0