mirror of
https://github.com/drewcassidy/yaclog.git
synced 2024-09-01 14:58:58 +00:00
release -c
will no longer create empty commits
This commit is contained in:
parent
ebcb70c130
commit
0bf63f1501
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file
|
All notable changes to this project will be documented in this file
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- `release -c` will no longer create empty commits, and will use the current commit instead
|
||||||
|
|
||||||
## 0.3.1 - 2021-04-24
|
## 0.3.1 - 2021-04-24
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -207,20 +207,27 @@ def release(obj: Changelog, v_flag, commit):
|
|||||||
repo.index.add(obj.path)
|
repo.index.add(obj.path)
|
||||||
|
|
||||||
version_type = '' if yaclog.cli.version_util.is_release(cur_version.name) else 'non-release '
|
version_type = '' if yaclog.cli.version_util.is_release(cur_version.name) else 'non-release '
|
||||||
|
tracked = len(repo.index.diff(repo.head.commit))
|
||||||
|
tracked_warning = 'Create tag'
|
||||||
untracked = len(repo.index.diff(None))
|
untracked = len(repo.index.diff(None))
|
||||||
untracked_warning = ''
|
untracked_warning = ''
|
||||||
untracked_plural = 's' if untracked > 1 else ''
|
untracked_plural = 's' if untracked > 1 else ''
|
||||||
if untracked > 0:
|
if untracked > 0:
|
||||||
untracked_warning = click.style(
|
untracked_warning = click.style(
|
||||||
f' You have {untracked} untracked file{untracked_plural} that will not be committed.',
|
f' You have {untracked} untracked file{untracked_plural} that will not be included.',
|
||||||
fg='red', bold=True)
|
fg='red', bold=True)
|
||||||
|
|
||||||
click.confirm(f'Commit and create tag for {version_type}version {cur_version.name}?{untracked_warning}',
|
if tracked > 0:
|
||||||
|
tracked_warning = 'Commit and create tag'
|
||||||
|
|
||||||
|
click.confirm(f'{tracked_warning} for {version_type}version {cur_version.name}?{untracked_warning}',
|
||||||
abort=True)
|
abort=True)
|
||||||
|
|
||||||
|
if tracked > 0:
|
||||||
repo.index.commit(f'Version {cur_version.name}\n\n{cur_version.body()}')
|
repo.index.commit(f'Version {cur_version.name}\n\n{cur_version.body()}')
|
||||||
repo.create_tag(cur_version.name, message=cur_version.body(False))
|
print(f'Created commit {repo.head.commit.hexsha[0:7]}')
|
||||||
|
|
||||||
|
repo.create_tag(cur_version.name, message=cur_version.body(False))
|
||||||
print(f'Created tag "{cur_version.name}".')
|
print(f'Created tag "{cur_version.name}".')
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user