diff --git a/release_stats.sh b/release_stats.sh index 749d30e554226..1e82447007796 100755 --- a/release_stats.sh +++ b/release_stats.sh @@ -1,15 +1,42 @@ -#!/bin/sh - -LAST=`git tag --sort v:refname | grep -v rc | tail -1` -START=`git log $LAST.. --simplify-by-decoration --pretty="format:%ai %d" | tail -1 | gawk '{ print $1 }'` -END=`git log $LAST.. --simplify-by-decoration --pretty="format:%ai %d" | head -1 | gawk '{ print $1 }'` - -git log $LAST.. --format='%an#%s' | grep -v Merge > commits +#!/bin/bash + +while [[ $# > 1 ]] +do +key="$1" + +case $key in + --from) + FROM="$2" + shift # past argument + ;; + --to) + TO="$2" + shift # past argument + ;; + *) + # unknown option + ;; +esac +shift # past argument or value +done + +if [ -z "$FROM" ]; then + FROM=`git tag --sort v:refname | grep -v rc | tail -1` +fi + +if [ -z "$TO" ]; then + TO="" +fi + +START=`git log $FROM.. --simplify-by-decoration --pretty="format:%ai %d" | tail -1 | gawk '{ print $1 }'` +END=`git log $TO.. --simplify-by-decoration --pretty="format:%ai %d" | head -1 | gawk '{ print $1 }'` + +git log $FROM.. --format='%an#%s' | grep -v Merge > commits # Include a summary by contributor in release notes: # cat commits | gawk -F '#' '{ print "- " $1 }' | sort | uniq -echo "Stats since <$LAST> [$START - $END]" +echo "Stats since <$FROM> [$START - $END]" echo "" AUTHORS=`cat commits | gawk -F '#' '{ print $1 }' | sort | uniq | wc -l`