git-changelog icon indicating copy to clipboard operation
git-changelog copied to clipboard

Trying to generate a change log results in an AttributeError.

Open dsully opened this issue 5 years ago • 10 comments

$ 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'

dsully avatar May 03 '19 09:05 dsully

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 avatar May 06 '19 20:05 pawamoy

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:

pawamoy avatar May 07 '19 11:05 pawamoy

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.

dsully avatar May 07 '19 12:05 dsully

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.

pawamoy avatar May 07 '19 12:05 pawamoy

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

dsully avatar May 07 '19 12:05 dsully

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:?

pawamoy avatar May 07 '19 12:05 pawamoy

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

dsully avatar May 07 '19 12:05 dsully

Thank you, I'll try this!

pawamoy avatar May 07 '19 12:05 pawamoy

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

pipozzz avatar Feb 03 '20 14:02 pipozzz

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 avatar Feb 10 '20 09:02 pawamoy