DOC: Update changelog script to handle squashed merges
@@ -26,7 +26,20 @@ echo $( printf "%${#HEADER}s" | tr " " "=" ) >> newchanges
echo "" >> newchanges
# Search for PRs since previous release
-git log --grep="Merge pull request" `git describe --tags --abbrev=0`..HEAD --pretty='format: * %b %s' | sed 's/Merge pull request \#\([^\d]*\)\ from\ .*/(\#\1)/' >> newchanges
+MERGE_COMMITS=$( git log --grep="Merge pull request\|(#.*)$" `git describe --tags --abbrev=0`..HEAD --pretty='format:%h' )
+for COMMIT in ${MERGE_COMMITS//\n}; do
+ SUB=$( git log -n 1 --pretty="format:%s" $COMMIT )
+ if ( echo $SUB | grep "^Merge pull request" ); then
+ # Merge commit
+ PR=$( echo $SUB | sed -e "s/Merge pull request \#\([0-9]*\).*/\1/" )
+ TITLE=$( git log -n 1 --pretty="format:%b" $COMMIT )
+ else
+ # Squashed merge
+ PR=$( echo $SUB | sed -e "s/.*(\#\([0-9]*\))$/\1/" )
+ TITLE=$( echo $SUB | sed -e "s/\(.*\) (\#[0-9]*)$/\1/" )
+ fi
+ echo "* $TITLE (#$PR)" >> newchanges
+done
echo "" >> newchanges
echo "" >> newchanges
