server/contrib/backporting/update-commit-log.sh
2020-02-17 08:59:53 +00:00

38 lines
1.3 KiB
Bash

#!/bin/sh
# Simple helper script to create backport lists
# By user defined (remote/branch to the to-be-backported history)
COMPARE_PATH="wotlk/master"
OUTPUT_FILE="contrib/backporting/todo_wotlk_commits.log"
# By user defined (text format)
#SMALL_FORMAT="wotlk: %h * %an (committer %cn)"
#FULL_FORMAT="${SMALL_FORMAT}: %s"
#FOOTER_FORMAT="FILE LAST UPDATED BASED ON... ${SMALL_FORMAT}"
# By user defined (Textile markup based wiki format)
SMALL_FORMAT="\"three\":http://github.com/mangosthree/server/commit/%h: %h * %an (committer %cn)"
FULL_FORMAT="</code></pre>%n* ${SMALL_FORMAT}<pre><code>%s"
FOOTER_FORMAT="</code></pre>FILE LAST UPDATED BASED ON... ${SMALL_FORMAT}"
# param1 must be the commit hash of last backported commit (of original commit)
if [ "$#" != "1" ]
then
echo "You must provide the last commit's hash of the \"$OUTPUT_FILE\" file"
exit 1
fi
# are we in git root dir?
if [[ ! -d .git/ ]]; then
echo "ERROR: This script is expected to be called from repository root directory"
echo "Try: contrib/backporting/update-commit-log.sh"
exit 1
fi
HASH=$1
git log $HASH..$COMPARE_PATH --pretty=format:"${FULL_FORMAT}" --reverse --dirstat >> $OUTPUT_FILE
echo "" >> $OUTPUT_FILE
echo "$(git log -1 --pretty="${FOOTER_FORMAT}" $COMPARE_PATH)" >> $OUTPUT_FILE
echo "" >> $OUTPUT_FILE