chore[change_log]: Add previous tag -p option

Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
Change-Id: I4fd7ccd2a110820736337ba9a439e44db6d9eb9d
This commit is contained in:
Herman Chen
2025-12-31 11:06:20 +08:00
parent 034c43891a
commit a9d3b5ead8
+8 -1
View File
@@ -84,6 +84,7 @@ usage="changelog helper script
https://www.conventionalcommits.org/zh-hans/v1.0.0/
.option('-t, --version', 'create a version tag with changelog update')
.option('-t, --prev', 'setup the previous version tag as baseline')
.option('-f, --file [file]', 'file to write to, defaults to ./CHANGELOG.md, use - for stdout', './CHANGELOG.md')
.option('-u, --repo-url [url]', 'specify the repo URL for commit links')
"
@@ -98,6 +99,10 @@ while [ $# -gt 0 ]; do
version_tag=$2
shift
;;
--prev | -p)
prev_tag=$2
shift
;;
--file | -f)
changelog_file=$2
echo "save changelog to file ${changelog_file}"
@@ -172,7 +177,9 @@ fi
# get current version info
curr_ver=$(git describe --tags --long)
curr_tag=$(git describe --tags --abbrev=0)
prev_tag=$(git describe --tags --abbrev=0 "$curr_tag"^)
if [ -n "${prev_tag+x}" ] && [ -z "$prev_tag" ]; then
prev_tag=$(git describe --tags --abbrev=0 "$curr_tag"^)
fi
date="$(date '+%Y-%m-%d')"
echo "curr ver: ${curr_ver}"