Browse Source

fix: fix `NameError` when using `shore changelog --add` but without specifying `-m,--message` or when specifying `-e,--edit`

master
Niklas Rosenstein 10 months ago
parent
commit
63b5dcb336
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
2 changed files with 8 additions and 3 deletions
  1. + 5
    - 0
      .changelog/_unreleased.yml
  2. + 3
    - 3
      src/shore/__main__.py

+ 5
- 0
.changelog/_unreleased.yml

@ -0,0 +1,5 @@
- type: fix
component: changelog
description: fix `NameError` when using `shore changelog --add` but without specifying
`-m,--message` or when specifying `-e,--edit`
fixes: []

+ 3
- 3
src/shore/__main__.py

@ -821,12 +821,12 @@ def changelog(**args):
# Allow the user to edit the entry if no description is provided or the
# -e,--edit option was set.
if not entry.description or args['edit']:
serialized = yaml.safe_dump(mapper.serialize(entry, ChangelogEntry), sort_keys=False)
entry = mapper.deserialize(yaml.safe_load(_edit_text(serialized)), ChangelogEntry)
serialized = yaml.safe_dump(mapper.serialize(entry, ChangelogEntryV2), sort_keys=False)
entry = mapper.deserialize(yaml.safe_load(_edit_text(serialized)), ChangelogEntryV2)
# Validate the entry contents (need a description and at least one type and component).
if not entry.description or not entry.component:
logger.error('changelog entries need at least one type and component and a description')
logger.error('changelog entries need a component and description')
sys.exit(1)
created = not manager.unreleased.exists()

Loading…
Cancel
Save