gitchangelog icon indicating copy to clipboard operation
gitchangelog copied to clipboard

No versions appear in the output

Open miroswan opened this issue 7 years ago • 9 comments

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 avatar Dec 07 '17 20:12 miroswan

>>> 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 avatar Dec 07 '17 21:12 miroswan

Tags present here:

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

miroswan avatar Dec 07 '17 21:12 miroswan

>>> 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 avatar Dec 07 '17 21:12 miroswan

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 avatar Dec 07 '17 21:12 miroswan

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 avatar Dec 07 '17 21:12 miroswan

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

miroswan avatar Dec 07 '17 21:12 miroswan

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.

vaab avatar Dec 08 '17 08:12 vaab

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.

miroswan avatar Dec 10 '17 12:12 miroswan

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 !

QuentinN42 avatar Jul 04 '20 09:07 QuentinN42