Created
August 5, 2010 00:16
-
-
Save evmar/509017 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Given a grep expression, create a graph of occurrences of that expression | |
# in your code's history. | |
set -e | |
expr="$1" | |
datafile=$(mktemp) | |
echo 'ago count' > $datafile | |
for ago in $(seq 90 -1 0); do | |
echo -n '.' | |
commit=$(git rev-list -1 --until="$ago days ago" origin/trunk) | |
git checkout -q -f $commit | |
count=$(git grep -E "$expr" -- '*.cc' '*.h' '*.m' '*.mm' | wc -l) | |
echo "-$ago $count" >> $datafile | |
done | |
R CMD BATCH <(cat <<EOF | |
data = read.delim("$datafile", sep=' ') | |
png(width=600, height=300) | |
plot(count ~ ago, type="l", main="$expr", xlab='days ago', data=data) | |
EOF | |
) /dev/null | |
echo done. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment