nedbat / scriv

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

Crash when there's an unexpected header in the changelog file #107

Closed SpecLad closed 1 year ago

SpecLad commented 1 year ago

Given CHANGELOG.rst:

Foobar
======

and changelog.d/fragment.rst:

Added
-----

- Something

Run:

$ scriv collect --version 1.0
Collecting from changelog.d
Reading changelog CHANGELOG.rst
Traceback (most recent call last):
  File "/home/dpb/.local/bin/scriv", line 8, in <module>
    sys.exit(cli())
  File "/home/dpb/.local/pipx/venvs/scriv/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/dpb/.local/pipx/venvs/scriv/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/dpb/.local/pipx/venvs/scriv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/dpb/.local/pipx/venvs/scriv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/dpb/.local/pipx/venvs/scriv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/home/dpb/.local/pipx/venvs/scriv/lib/python3.10/site-packages/scriv/collect.py", line 74, in collect
    if eversion == version:
  File "/home/dpb/.local/pipx/venvs/scriv/lib/python3.10/site-packages/scriv/util.py", line 96, in __eq__
    return this.lstrip("v") == that.lstrip("v")
AttributeError: 'NoneType' object has no attribute 'lstrip'
nedbat commented 1 year ago

What version of scriv are you using? I didn't get the same results as you:

% scriv collect --version 1.0
Collecting from changelog.d
Reading changelog CHANGELOG.rst
Entry 'Foobar' is not a valid version! If scriv should ignore this heading, add 'scriv-end-here' somewhere before it.
SpecLad commented 1 year ago
$ scriv --version
scriv, version 1.3.1
SpecLad commented 1 year ago

Oh, I see. It's a duplicate of #100. Sorry for the noise.