#! /bin/sh # Global variables realfile="/home/tuxillo/public_html/archive/misc/commitsgraph.txt" outfile=$(mktemp) insfile=$(mktemp) delfile=$(mktemp) timestamp=$(date) prevb="master" distribution="/build/home/tuxillo/s/distribution/distribution" srcdir="/build/home/tuxillo/s/dragonfly" log() { local args=$* echo ${args} >> ${outfile} } header() { local from=$1 local to=$2 local heading="" if [ -z ${to} ]; then heading="origin/${from}" else heading="origin/${from} --> origin/${to}" fi log ${heading} log "----------------------------------------------------------------------------------------------" } # Make sure you pass refs quoted histogram_ref() { local ref=$1 cd ${srcdir} git shortlog -s ${ref} | \ sort -rn -k1,1 | \ ${distribution} --height=150 --char=# --graph=vk >> ${outfile} 2>/dev/null } # ------------------ MAIN # Make sure no previous files exist rm -f ${outfile} ${insfile} ${delfile} log ${timestamp} log " " # Make sure we have latest changes ( cd ${srcdir} && git fetch ) || exit 255 header ${prevb} histogram_ref "origin/${prevb}" for b in `git branch -a | grep "origin/.*DragonFly_RELEASE_" | cut -d "/" -f3 | sort -Vr` do time1=$(git log -n 1 origin/${b} | grep Date | cut -c 9-100) log " " log ${time1} header ${b} ${prevb} histogram_ref "origin/${b}..origin/${prevb}" if [ "${prevb}" != "master" ]; then tmp=$(git diff --stat origin/${b}..origin/${prevb} | tail -1) ins=$(echo ${tmp} | cut -d "," -f 2 | cut -w -f2) printf "%s\t%s\n" ${prevb} ${ins} >> ${insfile} del=$(echo ${tmp} | cut -d "," -f 3 | cut -w -f2) printf "%s\t%s\n" ${prevb} ${del} >> ${delfile} fi prevb=${b} done log " " log "INSERTIONS per branch" log "----------------------------------------------------------------------------------------------" sort -rn -k2,2 ${insfile} | \ ${distribution} --size=full --char=# --graph=kv >> ${outfile} 2> /dev/null log " " log "DELETIONS per branch" log "----------------------------------------------------------------------------------------------" sort -rn -k2,2 ${delfile} | \ ${distribution} --size=full --char=# --graph=kv >> ${outfile} 2> /dev/null # Cleanup cp -f ${outfile} ${realfile} rm -f ${outfile} ${insfile} ${delfile}