nedbat/scriv

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

Closed this issue · 3 comments

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

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.
$ scriv --version
scriv, version 1.3.1

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