Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No versions appear in the output #96

Open
miroswan opened this issue Dec 7, 2017 · 9 comments
Open

No versions appear in the output #96

miroswan opened this issue Dec 7, 2017 · 9 comments
Labels

Comments

@miroswan
Copy link

miroswan commented Dec 7, 2017

env/bin/gitchangelog

Changelog
=========


(unreleased)
------------
- Changelog. [Demitri Swan]
- Wip version bump. [Demitri Swan]
- Initial patch release. [Demitri Swan]
- Initial commit. [Demitri Swan]

git tag
v0.0.1
@miroswan
Copy link
Author

miroswan commented Dec 7, 2017

>>> for item in gitchangelog.gitchangelog.versions_data_iter(gitchangelog.gitchangelog.GitRepos('.')):
...     pprint(item)
...
{'commit': <GitCommit 'HEAD'>,
 'commit_date': '2017-12-07',
 'date': '2017-12-07',
 'sections': [{'commits': [{'author': u'Demitri Swan',
                            'authors': [u'Demitri Swan'],
                            'body': u'',
                            'commit': <GitCommit u'4151a85116011f9f5e18487e91774b9b6f8d2d3b'>,
                            'subject': u'changelog'},
                           {'author': u'Demitri Swan',
                            'authors': [u'Demitri Swan],
                            'body': u'',
                            'commit': <GitCommit u'f0b294e6b71d40ed4c16c5a058dc319b79898d64'>,
                            'subject': u'wip version bump'},
                           {'author': u'Demitri Swan',
                            'authors': [u'Demitri Swan'],
                            'body': u'',
                            'commit': <GitCommit u'036dae89f0da6cfb3a04fc78b336c018fd683625'>,
                            'subject': u'initial patch release'},
                           {'author': u'Demitri Swan',
                            'authors': [u'Demitri Swan'],
                            'body': u'',
                            'commit': <GitCommit u'6eab5c54cd48c573ed0d01070cbb9bab35911483'>,
                            'subject': u'initial commit'}],
               'label': None}],
 'tag': None,
 'tagger_date': None}

tags are empty

@miroswan
Copy link
Author

miroswan commented Dec 7, 2017

Tags present here:

>>> gitchangelog.gitchangelog.GitRepos('.').tags()[0]
<GitCommit u'v0.0.1'>

@miroswan
Copy link
Author

miroswan commented Dec 7, 2017

>>> tags = [tag for tag in repository.tags(contains=revs[-1] if revs else None) if re.match(tag_filter_regexp, tag.identifier)]
>>> tags
[]

This is the list comprehension that is failing to generate tags:
https://github.com/vaab/gitchangelog/blob/master/src/gitchangelog/gitchangelog.py#L1548-L1550

@miroswan
Copy link
Author

miroswan commented Dec 7, 2017

Removing the condition fixes the bug. Works in my fork:

env/bin/gitchangelog
Changelog
=========


(unreleased)
------------
- Changelog. [Demitri Swan]


v0.0.1 (2017-12-07)
-------------------
- Wip version bump. [Demitri Swan]
- Initial patch release. [Demitri Swan]
- Initial commit. [Demitri Swan]

@miroswan
Copy link
Author

miroswan commented Dec 7, 2017

With .gitchangelog.rc in place:

env/bin/gitchangelog
Changelog
=========


v0.0.1 (2017-12-07)
-------------------
- Initial patch release. [Demitri Swan]
- Initial commit. [Demitri Swan]

@miroswan
Copy link
Author

miroswan commented Dec 7, 2017

Do you want me to open a PR for this? Any reason why we need that extra code in the list comprehension?

@vaab
Copy link
Owner

vaab commented Dec 8, 2017

Hum, you probably just forgot to tune your .gitchangelog.rc to set the tag_filter_regex.

https://github.com/vaab/gitchangelog/blob/master/src/gitchangelog/gitchangelog.rc.reference#L153

By default, the regexp does not match vXX.XX tags, but only the XX.XX (without the V).
Tell me if this solves your problem, and if yes, I would be interested to know how you missed that and if you have any suggestion to where or how I could document it, I would be happy to move forward on that point.

@miroswan
Copy link
Author

A few issues:

  • I didn't forget. I didn't see it at all. I personally find it odd that you would have to configure something like this in order to get what I would consider to be desirable default behavior
  • Many projects prefix their tags with v. I won't be the only person to try out gitchangelog, wonder why this isn't working, then have to figure out how to get behavior as advertised in the README
  • It looks like you're trying to set the default behavior to enforce a subset of the semantic versioning spec. If it's not going to be spec compliant, why have a default at all?

Anyway, those are my thoughts. I will try configuring this in the config file. Thanks for the tip.

@QuentinN42
Copy link

Create a .gitchangelog.rc in your repo based on this repo .gitchangelog.rc.
And just repace around line 150:

tag_filter_regexp = r'^[0-9]+\.[0-9]+(\.[0-9]+)?$'

By :

tag_filter_regexp = r'^v[0-9]+\.[0-9]+(\.[0-9]+)?$'

Done !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants