Skip to content

Instantly share code, notes, and snippets.

@dgageot
Created June 30, 2010 18:16
Show Gist options
  • Save dgageot/459022 to your computer and use it in GitHub Desktop.
Save dgageot/459022 to your computer and use it in GitHub Desktop.
#!/bin/bash
LAST=$(date -j "+%Y-%m-%d")
FIRST=$(date -j -f "%Y-%m-%d" 2008-10-01 "+%Y-%m-%d")
CURRENT=${LAST}
git reset -q --hard origin/master; git clean -q -xdf
echo "Date;Lines of code;Lines of test"
while [ "${CURRENT}" \> "${FIRST}" ]
do
HASH=`git log --date=short --format="%H" --before=${CURRENT} -n1`
git reset -q --hard ${HASH}; git clean -q -xdf
NLOC_CODE=`find . -name "*.java" ! -path "*/src/test/java*" | xargs wc -l | tail -n 1 | awk '{ print $1 }'`
NLOC_TEST=`find . -name "*.java" ! -path "*/src/main/java*" | xargs wc -l | tail -n 1 | awk '{ print $1 }'`
echo "${CURRENT};${NLOC_CODE};${NLOC_TEST}"
CURRENT=$(date -j -v-7d -f "%Y-%m-%d" ${CURRENT} "+%Y-%m-%d")
done
git reset -q --hard origin/master; git clean -q -xdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment