diff --git a/scripts/README b/scripts/README new file mode 100644 index 0000000..28dc140 --- /dev/null +++ b/scripts/README @@ -0,0 +1,14 @@ +In this directory, the scripts used by the release team for the blog post are +stored. + +== stats-beta.sh == + +Generate the diff between to beta versions. + +For example: +scripts/stats-beta.sh ~/dev/mozilla/beta-src FIREFOX_32_0b1_RELEASE FIREFOX_32_0b2_RELEASE > _posts/$(date +"%Y-%m-%d")-fx-32-b1-to-b2.md + +Will generate the diff between beta 1 and beta 2 of Firefox 32. + + + diff --git a/scripts/stats-beta.sh b/scripts/stats-beta.sh new file mode 100755 index 0000000..f60f3c3 --- /dev/null +++ b/scripts/stats-beta.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# This script generates stats between two tags of Firefox +# It will generate an HTML result. + +if test $# -ne 3; then + echo "Wrong syntax. Expecting:" + echo "$0 " + exit 1 +fi + +DIRECTORY=$1 +PREV=$2 +CURRENT=$3 + +if test ! -d $DIRECTORY; then + echo "Cannot find/access $DIRECTORY" + exit 1 +fi +if test ! -d $DIRECTORY/.hg; then + echo "Cannot find/access $DIRECTORY/.hg. Not a mercurial repository?" + exit 1 +fi + +cd $DIRECTORY + +REVISION="ancestor($PREV,$CURRENT)::$CURRENT - ancestor($PREV,$CURRENT)" + +STATS=$(hg diff --stat --rev "$REVISION"|tail -1) + +# Parse "112 files changed, 2174 insertions(+), 423 deletions(-)" +FILES_CHANGED=$(echo $STATS|sed -e "s|\([0-9]*\) files changed.*|\1|g") +INSERT=$(echo $STATS|sed -e "s|.* \([0-9]*\) insertions.*|\1|g") +DELETE=$(echo $STATS|sed -e "s|.* \([0-9]*\) deletions(-)|\1|g") + +LIST=$(hg log --rev "$REVISION" --template '{author}{desc|strip|firstline} - {node|short}\n'|grep -v "ffxbld") + +# get the list of languages used +LANGUAGES=$(hg diff --rev "$REVISION"|grep +++|sed -e "s|.*\.\(.*\)$|\1|g"|grep -v ^+++|sort |uniq -c|sort -n -r) +# get the list of modules touched +MODULES=$(hg diff --rev "$REVISION"|grep +++|sed -e "s|+++ b/\([[:alnum:]]*\)/.*|\1|g"|grep -v ^+++|uniq -c|sort -r -n) + +NB_CHANGESET=$(echo "$LIST"|wc -l) + +# Generate the metadata for the blog post +MAJOR_VERSION=$(echo $PREV|sed -e "s|FIREFOX_\(.*\)_.*_.*|\1|g") +PREV_BETA_VERSION=$(echo $PREV|sed -e "s|FIREFOX_.*_0b\(.*\)_.*|\1|g") +CURRENT_BETA_VERSION=$(echo $CURRENT|sed -e "s|FIREFOX_.*_0b\(.*\)_.*|\1|g") +CURRENT_DATE=$(date +"%Y-%m-%d %H:%M:%S") + +echo "--- +layout: post +title: \"Firefox $MAJOR_VERSION beta$PREV_BETA_VERSION to beta$CURRENT_BETA_VERSION\" +date: $CURRENT_DATE +categories: statistics $MAJOR_VERSION +--- +" + +echo "

" +echo "

    " +echo "
  • "$NB_CHANGESET" changesets
  • " +echo "
  • "$FILES_CHANGED" files changed
  • " +echo "
  • "$INSERT" insertions
  • " +echo "
  • "$DELETE" deletions
  • " +echo "
" +echo "

" +echo "

" +echo "" +echo "$LANGUAGES"|awk '{print ""}' +echo "
ExtensionOccurrences
"$2""$1"
" +echo "

" +echo "

" +echo "" +echo "$MODULES"|awk '{print ""}' +echo "
ModuleOccurrences
"$2""$1"
" +echo "

" +echo "

List of changesets:" + +echo "" +# Strip the email address +echo "$LIST"|sed -e "s|\(.*\) <.*>|\1|g" -e "s|Bug \([0-9]*\)|Bug \1|gi" +echo "
" +echo "

"