mirror of
https://github.com/drewcassidy/yaclog.git
synced 2024-09-01 14:58:58 +00:00
Fix release command and empty logs
This commit is contained in:
parent
ec9c785c3a
commit
3972786d82
@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file
|
|||||||
- Changelog links dict now contains version links. Modified version links will overwrite those in the table when writing to a file
|
- Changelog links dict now contains version links. Modified version links will overwrite those in the table when writing to a file
|
||||||
- Changelog object no longer errors when creating without a path.
|
- Changelog object no longer errors when creating without a path.
|
||||||
- `release` now resets lesser version values when incrementing
|
- `release` now resets lesser version values when incrementing
|
||||||
|
- `release` now works with logs that have only unreleased changes
|
||||||
|
|
||||||
## 0.3.2 - 2021-04-24
|
## 0.3.2 - 2021-04-24
|
||||||
|
|
||||||
|
@ -181,13 +181,18 @@ def entry(obj: Changelog, bullets, paragraphs, section_name, version_name):
|
|||||||
@click.pass_obj
|
@click.pass_obj
|
||||||
def release(obj: Changelog, v_flag, commit):
|
def release(obj: Changelog, v_flag, commit):
|
||||||
"""Release versions in the changelog and increment their version numbers"""
|
"""Release versions in the changelog and increment their version numbers"""
|
||||||
version = [v for v in obj.versions if v.name.lower() != 'unreleased'][0]
|
matches = [v for v in obj.versions if v.name.lower() != 'unreleased']
|
||||||
|
if len(matches) == 0:
|
||||||
|
version = '0.0.0'
|
||||||
|
else:
|
||||||
|
version = matches[0].name
|
||||||
|
|
||||||
cur_version = obj.versions[0]
|
cur_version = obj.versions[0]
|
||||||
old_name = cur_version.name
|
old_name = cur_version.name
|
||||||
|
|
||||||
if v_flag:
|
if v_flag:
|
||||||
if v_flag[0] == '+':
|
if v_flag[0] == '+':
|
||||||
new_name = yaclog.cli.version_util.increment_version(version.name, v_flag)
|
new_name = yaclog.cli.version_util.increment_version(version, v_flag)
|
||||||
else:
|
else:
|
||||||
new_name = v_flag
|
new_name = v_flag
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user