pawamoy / git-changelog

Automatic Changelog generator using Jinja2 templates.
https://pawamoy.github.io/git-changelog
ISC License
140 stars 34 forks source link

Trying to generate a change log results in an AttributeError. #4

Closed dsully closed 2 weeks ago

dsully commented 5 years ago
$ git-changelog -t keepachangelog .
Traceback (most recent call last):
  File "/Users/dsully/.local/bin/git-changelog", line 10, in <module>
    sys.exit(main())
  File "/Users/dsully/.local/lib/python3.7/site-packages/git_changelog/cli.py", line 91, in main
    changelog = Changelog(args.repository, style=args.style)
  File "/Users/dsully/.local/lib/python3.7/site-packages/git_changelog/build.py", line 179, in __init__
    versions = self.group_commits_by_version(dates)
  File "/Users/dsully/.local/lib/python3.7/site-packages/git_changelog/build.py", line 284, in group_commits_by_version
    version.url = self.provider.get_tag_url(tag=commit.version)
AttributeError: 'NoneType' object has no attribute 'get_tag_url'
pawamoy commented 5 years ago

Thank you @dsully for taking the time to report this. Hopefully I'll finally have some time tomorrow to fix that :slightly_smiling_face:

pawamoy commented 5 years ago

Can you link to the project causing this issue? I'm particularly interested in the output of this comand: git config --get remote.origin.url which is used to get the provider URL (github.com, gitlab.com, etc.). Also currently it will only work for GitHub and GitLab :sweat_smile:

dsully commented 5 years ago

It points to an internally hosted URL at my company, that happens to be Gerrit.

So it sounds like another provider would need to be implemented.

pawamoy commented 5 years ago

Yep, exactly. This project is still very young, I'm not sure what would be the best way to quickly give users the ability to use it with other providers. Either we add support directly in the code, or we make a plugin architecture.

dsully commented 5 years ago

I would suggest a plugin architecture. With Python 3's __init_subclass__ it's pretty easy to do.

pawamoy commented 5 years ago

I didn't know about __init_subclass__. Would you happen by chance to have an example/tutorial on how to use __init_subclass__ to builld a plugin architecture :sweat_smile:?

dsully commented 5 years ago

http://musings.tinbrain.net/blog/2019/mar/20/plugins-and-auto-discovery-python/ is pretty good.

pawamoy commented 5 years ago

Thank you, I'll try this!

pipozzz commented 4 years ago

Hello, I have the same issue, I use self-hosted gitlab-ce. Any suggestions ? Thanks

pawamoy commented 4 years ago

Hello 🙂

I don't have much time to implement this plugin structure, but maybe you'd like to contribute and send a PR for it? If so, I'll be available to review it of course. The linked tutorial above seems to be a great starting point.

pawamoy commented 2 weeks ago

Closing for now, please comment if still relevant and I'll reopen.