diff --git a/CHANGELOG.md b/CHANGELOG.md index 9620ab2..417d3ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.7.0] - 2020-10-28 +### Added +- Revert file when `change all` command is cancelled (see #1). + +### Changed +- Removed duplicates in changelog added during testing. + ## [0.6.1] - 2020-06-06 ### Fixed - Error handling within functions. Replaced exit with return. @@ -75,7 +82,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Created a proof of concept for a changelog updater. -[Unreleased]: https://github.com/adamtabrams/change/compare/0.6.1...HEAD +[Unreleased]: https://github.com/adamtabrams/change/compare/0.7.0...HEAD +[0.7.0]: https://github.com/adamtabrams/change/compare/0.6.1...0.7.0 [0.6.1]: https://github.com/adamtabrams/change/compare/0.6.0...0.6.1 [0.6.0]: https://github.com/adamtabrams/change/compare/0.5.2...0.6.0 [0.5.2]: https://github.com/adamtabrams/change/compare/0.5.1...0.5.2 diff --git a/change b/change index 87c6dbe..60bf5e8 100755 --- a/change +++ b/change @@ -244,16 +244,19 @@ $(format_commits "$first_commits") } run_all() { - change_file + save_file=$(cat $change_file) + ! modify_file && return 1 first_change=$(stat -qf "%Sc" $change_file) ${EDITOR:-vi} $change_file last_change=$(stat -qf "%Sc" $change_file) [ "$first_change" = "$last_change" ] && - echo "cancelling because no manual edits were made to $change_file" >&2 && return 1 + echo "cancelling because no manual edits were made to $change_file" >&2 && + echo "$save_file" > $change_file && + return 1 git add $change_file && git commit --amend --no-edit && make_and_push_tag && post_release } -change_file() { +modify_file() { ! startup_checks && return 1 latest_git_ver_name=$(git tag --list "[[:digit:]]*\.[[:digit:]]*" --sort="-v:refname" | head -1) @@ -272,15 +275,14 @@ change_file() { done } - -[ "$2" ] && { echo "change currently accepts only one argument" >&2; exit 1; } -[ ! "$1" ] && { change_file; exit; } -[ "$1" = "init" ] && { init; exit; } -[ "$1" = "tag" ] && { make_and_push_tag; exit; } -[ "$1" = "auth" ] && { auth; exit; } -[ "$1" = "post" ] && { post_release; exit; } -[ "$1" = "all" ] && { run_all; exit; } -[ "$1" = "-h" ] && { usage; exit; } -[ "$1" = "help" ] && { usage; exit; } -[ "$1" = "--help" ] && { usage; exit; } -[ "$1" ] && { printf "couldn't recognize argument\n\n" >&2; usage >&2; exit 1; } +[ "$2" ] && { echo "change currently accepts only one argument" >&2; exit 1; } +[ ! "$1" ] && { modify_file; exit; } +[ "$1" = "init" ] && { init; exit; } +[ "$1" = "tag" ] && { make_and_push_tag; exit; } +[ "$1" = "auth" ] && { auth; exit; } +[ "$1" = "post" ] && { post_release; exit; } +[ "$1" = "all" ] && { run_all; exit; } +[ "$1" = "-h" ] && { usage; exit; } +[ "$1" = "help" ] && { usage; exit; } +[ "$1" = "--help" ] && { usage; exit; } +[ "$1" ] && { printf "couldn't recognize argument\n\n" >&2; usage >&2; exit 1; }