Faire un calendrier d'activité git avec gnuplot - retour accueil
git clone git://bebou.netlib.re/git-cal
Log | Files | Refs | README |
commit 42ed4410ed07dfd6b962de8fcb2028ce6856bcaa Auterice: Arthur Pons <arthur.pons@unistra.fr> Date: Mon, 21 Oct 2024 17:33:01 +0200 Premier commit Modifier l'auteurice et le dossier dans le makefile puis faire make Pas de dates sur le graph Réitère partout pour chaque personne, moyen de faire une seule passe pour n personnes si besoin mais faut réécrire des trucs Diffstat:
A | countcommits.sh | | | 26 | ++++++++++++++++++++++++++ |
A | graph.gp | | | 18 | ++++++++++++++++++ |
A | makefile | | | 13 | +++++++++++++ |
3 files changed, 57 insertions(+), 0 deletions(-)
diff --git a/countcommits.sh b/countcommits.sh @@ -0,0 +1,26 @@ +#! /bin/sh + +t=$(mktemp) +l=$(mktemp) +for dep in $(find "${1:?folder ?}/"* -maxdepth 0 -type d );do + cd $dep + git log --date=format:"%u %Y-%m-%d" --author="${2:?author name ?}" | grep Date: +done | + awk '{print $2,$3}' | + sort | uniq -c | sort -n | + awk '{print $1" "$2,$3}' > $t + +for d in $(seq 365 -1 0);do + day=$(LC_ALL=C date --date "today - $d days" +"%u %Y-%m-%d") + res=$(grep "$day" $t) + [ -n "$res" ] && echo "$res 1" || echo "0 $day 1" +done > $l + +firstday=$(head -n1 $l | cut -f2 | cut -c1) + +for d in $(seq 1 $(( $firstday - 1 )) );do + printf "0 %s 0\n" $d +done +cat $l + +rm $t $l diff --git a/graph.gp b/graph.gp @@ -0,0 +1,18 @@ +#! /usr/bin/gnuplot + +width=2000 +gap=0.80 +set datafile separator "\t" + +set term pngcairo size width,(width/(52/7)) +set border 0;unset tics;unset key;unset colorbox + +set style fill solid +set palette defined ( 0 "light-grey", 1 "light-blue", 20 "blue", 50 "dark-blue" ) + +xlow(nl) = floor(nl/7) +ylow(nl) = int(nl*-1)%7 + +plot 'nbofcommits.dat' \ + u (0):($3==0 ? NaN:0):(xlow($0)):(xlow($0)+gap):(ylow($0)):(ylow($0)+gap):1 \ + w boxxy lc palette diff --git a/makefile b/makefile @@ -0,0 +1,13 @@ +gitfolder=/home/arthur/git +author=".*arthur.*" + +all: graph.png + +graph.png: nbofcommits.dat graph.gp + ./graph.gp > $@ + +nbofcommits.dat: countcommits.sh + ./countcommits.sh ${gitfolder} ${author} > $@ + +#.PHONY: nbofcommits.dat +