cli: provide a nice error message when KeyError is encountered in a shallow clone
(before) $ ~/python/rpmautospec/run-rpmautospec.py generate-changelog
Traceback (most recent call last):
File "/home/zbyszek/python/rpmautospec/run-rpmautospec.py", line 6, in <module>
main()
File "/usr/lib64/python3.11/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/home/zbyszek/python/rpmautospec/rpmautospec/cli.py", line 141, in main
sys.exit(subcmd_module.main(args))
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zbyszek/python/rpmautospec/rpmautospec/subcommands/changelog.py", line 56, in main
changelog = produce_changelog(args.spec_or_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zbyszek/python/rpmautospec/rpmautospec/subcommands/changelog.py", line 50, in produce_changelog
result = processor.run(visitors=(processor.release_number_visitor, processor.changelog_visitor))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zbyszek/python/rpmautospec/rpmautospec/pkg_history.py", line 679, in run
visited_results = self._run_on_history(head, visitors=visitors, seed_info=seed_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zbyszek/python/rpmautospec/rpmautospec/pkg_history.py", line 556, in _run_on_history
commit_coroutines_info[commit] = [next(c) for c in coroutines]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zbyszek/python/rpmautospec/rpmautospec/pkg_history.py", line 556, in <listcomp>
commit_coroutines_info[commit] = [next(c) for c in coroutines]
^^^^^^^
File "/home/zbyszek/python/rpmautospec/rpmautospec/pkg_history.py", line 214, in release_number_visitor
for p in commit.parents:
^^^^^^^^^^^^^^
KeyError: '304b2551217f84f2e3e5f9e9347a12a0665c579b'
(after) $ ~/python/rpmautospec/run-rpmautospec.py generate-changelog
error: in a shallow clone and commit 304b2551217f84f2e3e5f9e9347a12a0665c579b not available
Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>