2016-06-02 16:53:24 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# Interactively generates a changelog over a range of commits:
|
|
|
|
|
|
|
|
commit_summary() {
|
|
|
|
local hash=$1
|
|
|
|
|
|
|
|
pr=$(git show $hash | grep -o "#\([0-9]*\)" | cut -c 2-)
|
2016-11-15 17:07:11 +00:00
|
|
|
prjson="$(curl -n https://api.github.com/repos/git-lfs/git-lfs/pulls/$pr 2>/dev/null)"
|
2016-06-02 16:53:24 +00:00
|
|
|
title="$(echo $prjson | jq -r -e ".title")"
|
|
|
|
id="$(echo $prjson | jq -r -e ".number")"
|
|
|
|
author="$(echo $prjson | jq -r -e ".user.login")"
|
|
|
|
|
2016-06-02 21:51:28 +00:00
|
|
|
# If the title begins with "Backport", then strip everything until the actual
|
|
|
|
# pull-request title.
|
|
|
|
if grep -q "Backport" <(echo $title); then
|
|
|
|
title="$(echo $title | sed 's/^[^:]*: //g')"
|
|
|
|
fi
|
|
|
|
|
2016-06-02 21:50:13 +00:00
|
|
|
echo "* $title #$id (@$author)"
|
2016-06-02 16:53:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
range=$1
|
|
|
|
|
|
|
|
if [ "$range" = "" ]; then
|
|
|
|
echo "Usage: $0 [options] base..next"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
features=""
|
|
|
|
bugs=""
|
|
|
|
misc=""
|
|
|
|
|
|
|
|
for rev in $(git rev-list --merges $range); do
|
|
|
|
git show $rev
|
|
|
|
|
2016-06-02 22:04:09 +00:00
|
|
|
processed=0
|
|
|
|
while [ $processed -eq 0 ]; do
|
|
|
|
echo "Categorize this change: [f,b,m,s,?] ?"
|
|
|
|
read -n 1 opt
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
case $opt in
|
|
|
|
[fbms])
|
|
|
|
processed=1
|
|
|
|
;;
|
|
|
|
?)
|
|
|
|
echo "f - mark this merge as a feature"
|
|
|
|
echo "b - mark this merge as a bugfix"
|
|
|
|
echo "m - make this merge as a misc. change"
|
|
|
|
echo "s - skip this merge, excluding it from the changelog"
|
|
|
|
echo "? - display this help message"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown option: $opt, try again."
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $opt != "s" ]; then
|
|
|
|
summary="$(commit_summary $rev)"
|
2016-06-02 16:53:24 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
case $opt in
|
|
|
|
f)
|
|
|
|
features="$(printf "%s\n%s\n" "$features" "$summary")"
|
|
|
|
;;
|
|
|
|
b)
|
|
|
|
bugs="$(printf "%s\n%s\n" "$bugs" "$summary")"
|
|
|
|
;;
|
|
|
|
m)
|
|
|
|
misc="$(printf "%s\n%s\n" "$misc" "$summary")"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "" >&2
|
|
|
|
|
|
|
|
cat <<- EOF
|
2016-06-02 21:50:44 +00:00
|
|
|
### Features
|
|
|
|
$features
|
2016-06-02 16:53:24 +00:00
|
|
|
|
2016-06-02 21:50:44 +00:00
|
|
|
### Bugs
|
|
|
|
$bugs
|
2016-06-02 16:53:24 +00:00
|
|
|
|
2016-06-02 21:50:44 +00:00
|
|
|
### Misc
|
|
|
|
$misc
|
2016-06-02 16:53:24 +00:00
|
|
|
EOF
|