Skip to content

Commit

Permalink
Generate release notes based on version tags
Browse files Browse the repository at this point in the history
Bump to beta version
  • Loading branch information
dormant-user committed Aug 10, 2023
1 parent 4bebb8c commit a36c4a6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 32 deletions.
5 changes: 5 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Commit History
==============

0.3.7 (08/10/2023)
------------------
- Generate release notes based on version tags
- Bump to beta version

0.3.6 (08/09/2023)
------------------
- Update more references
Expand Down
2 changes: 1 addition & 1 deletion gitverse/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.1a"
version = "1.0b"
43 changes: 12 additions & 31 deletions gitverse/releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,39 +66,20 @@ def get_releases() -> Union[List[Dict[str, Union[str, List[str], int, str]]], No
if not tags:
debugger.error("Failed to fetch tags information.") if options['debug'] else None
return
version_updates = []
current_version = None
current_changes = []
version_updates = {}
for tag in tags:
tag = tag.strip()
if tag:
# Continuation of changes for the current version
if tag.startswith((".", "-")) or tag.split()[0].isalpha():
current_changes.append(tag.lstrip(".- "))
else: # New version entry
if current_version is not None:
version_updates.append(
{
"version": current_version,
"description": current_changes,
"timestamp": dates[current_version],
"date": datetime.fromtimestamp(dates[current_version]).strftime("%m/%d/%Y")
}
)
version, changes = tag.split(None, 1)
current_version = version
current_changes = [changes]

# Add the last version entry
if current_version is not None:
version_updates.append(
{
"version": current_version,
"description": current_changes,
"timestamp": dates[current_version],
"date": datetime.fromtimestamp(dates[current_version]).strftime("%m/%d/%Y")
}
)
if tag.split()[0] in dates.keys():
current_version = tag.split()[0]
version_updates[current_version] = {
"version": current_version,
"description": [' '.join(tag.split()[1:])],
"timestamp": dates[current_version],
"date": datetime.fromtimestamp(dates[current_version]).strftime("%m/%d/%Y")
}
else:
version_updates[current_version]['description'].append(tag.strip()) # adds next line to previous desc
version_updates = list(version_updates.values())
if options['reverse']:
debugger.warning('Converting snippets to reverse order') if options['debug'] else None
version_updates = sorted(version_updates, key=lambda x: x['timestamp'], reverse=True)
Expand Down

0 comments on commit a36c4a6

Please sign in to comment.