Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treehouses changelog compare <version> [version] upgrade (fixes #2164) #2169

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions modules/changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,27 @@ case "$displaymode" in
case "$version2" in
"")
checkargn $# 2
sed "/^### $CURRENT/!d;s//&\n/;s/.*\n//;:a;/^### $version1/bb;\$!{n;ba};:b;s//\n&/;P;D" $LOGPATH #grabs text between version numbers, print bottom to top
dpkg --compare-versions "$CURRENT" "gt" "$version1"
gt="$?"
if [[ $gt -eq 0 ]]; then
sed "/^### $CURRENT/!d;s//&\n/;s/.*\n//;:a;/^### $version1/bb;\$!{n;ba};:b;s//\n&/;P;D" $LOGPATH #grabs text between version numbers, print bottom to top
else # Needs to specify previous version instead of current
echo "ERROR: Must specify a previous version (less than $CURRENT)"
fi
;;
*)
checkargn $# 3
sed "/^### $version2/!d;s//&\n/;s/.*\n//;:a;/^### $version1/bb;\$!{n;ba};:b;s//\n&/;P;D" $LOGPATH
dpkg --compare-versions "$version2" "gt" "$version1"
gt="$?"
dpkg --compare-versions "$version2" "eq" "$version1"
eq="$?"
if [[ $gt -eq 0 ]]; then
sed "/^### $version2/!d;s//&\n/;s/.*\n//;:a;/^### $version1/bb;\$!{n;ba};:b;s//\n&/;P;D" $LOGPATH
elif [[ $eq -eq 0 ]]; then
echo "ERROR: Must specify different versions for comparisons (cannot compare same version to itself)"
else
sed "/^### $version1/!d;s//&\n/;s/.*\n//;:a;/^### $version2/bb;\$!{n;ba};:b;s//\n&/;P;D" $LOGPATH
fi
;;
esac
;;
Expand Down