Last active
December 27, 2015 08:58
-
-
Save jeanlauliac/7299948 to your computer and use it in GitHub Desktop.
Generates a CSV file describing, for each hour of each day of the week: "commit count / added lines / removed lines". An example of generated CSV is provided (generated by running the script on the 'git' git repository).
This file contains 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
day | lines | |
---|---|---|
Tue | 277/7004/2481;201/8576/3561;139/2653/1111;70/1752/664;43/1138/521;38/1587/534;32/1694/1032;82/3202/2554;77/3375/2663;225/15032/7769;219/4212/1857;284/5581/2007;301/7260/3817;270/5442/1764;323/15875/10476;316/9016/4161;312/8601/4115;176/2891/1278;218/9919/4118;177/6341/3024;176/5342/2042;342/12787/5304;348/13520/7663;360/13522/4729 | |
Sat | 200/5975/2634;184/4829/1570;174/7750/3008;97/3315/873;66/2982/664;42/3222/263;48/1539/668;51/3815/2047;35/2309/1611;82/1914/823;121/18503/13880;210/9587/3055;200/3238/1415;187/6255/2249;190/6619/2276;221/7146/2322;233/6229/4527;252/14667/6269;247/7457/1909;178/4527/2363;212/10811/7969;210/5942/3003;257/8527/3574;349/10693/3749 | |
Thu | 293/15092/10292;170/5804/1217;157/4758/1132;70/2226/969;35/955/341;35/1551/937;94/2733/1130;76/1326/330;92/6162/1266;165/6165/3808;290/8094/3213;250/10581/6861;294/5179/2342;296/8492/2996;322/7637/4346;325/7630/3695;283/10570/5174;233/12549/6286;205/8378/3970;256/6950/4600;225/4685/1888;245/8928/4822;320/8338/3088;334/9416/3282 | |
Sun | 229/8068/2928;194/8255/2843;148/4218/2029;119/6663/1256;70/1440/381;32/1746/506;51/1674/698;13/134/45;60/1578/1122;64/6149/402;112/5484/945;188/4708/2394;206/6479/1972;285/16158/5436;259/5404/1943;376/16442/4950;296/11429/5220;284/8961/3906;247/13704/3308;229/9152/3570;233/20915/15528;311/10419/2940;353/6455/3664;320/10135/4604 | |
Mon | 335/10552/6252;151/4833/2369;170/4412/2595;86/2251/2255;40/1703/276;45/1024/457;66/2394/557;51/765/207;119/43728/42854;209/7360/1960;244/6854/2961;336/6004/2582;319/6949/2953;290/8449/3303;272/20608/3684;329/7875/2834;317/6328/2246;259/12591/4163;245/6406/3296;313/9421/4442;183/16744/11089;355/12571/6422;377/22405/8148;312/20599/12613 | |
Fri | 232/7029/3146;206/10559/4547;116/6708/3640;99/2966/841;81/1900/931;57/1192/529;24/879/134;51/2777/2245;85/5785/3199;154/4619/2014;244/5222/2981;330/9299/4833;303/8239/2265;242/6568/2816;257/11118/4967;334/8541/3151;332/7376/2586;276/10139/4298;259/10045/3650;182/5515/2948;180/6179/1679;292/7433/3541;335/15140/6441;277/8445/5225 | |
Wed | 291/9598/3577;202/5931/2080;183/8450/1814;118/3166/1369;63/6224/1889;35/1218/402;43/2426/5468;62/3375/1697;105/3969/2541;214/3970/1472;258/6118/1764;366/6973/2020;415/6393/3194;356/5908/2672;447/6902/3812;400/9258/5139;402/8084/2608;339/24687/16985;206/10599/6968;229/5441/2317;190/5902/1970;219/8233/4512;323/12489/4946;325/9455/4421 |
This file contains 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 | |
git log --format=format:"%aD" --numstat | gawk ' | |
BEGIN { | |
FS="\t" | |
} | |
match($0, /^([[:alnum:]]{3}), [[:digit:]]+ [[:alpha:]]{3} \ | |
[[:digit:]]+ ([[:digit:]]+):[[:digit:]]+:[[:digit:]]+/, mt) { | |
cur_day = mt[1] | |
cur_hour = +mt[2] | |
days[cur_day][cur_hour]["cc"] += 1 | |
} | |
NF == 3 { | |
days[cur_day][cur_hour]["in"] += +$1 | |
days[cur_day][cur_hour]["out"] += +$2 | |
} | |
function print_day(name, day) { | |
printf "%s,", name | |
printf "%d/%d/%d", day[0]["cc"], day[0]["in"], day[0]["out"] | |
for (hour = 1; hour < 24; hour++) { | |
printf ";%d/%d/%d", day[hour]["cc"], day[hour]["in"], day[hour]["out"]; | |
} | |
printf "\n" | |
} | |
END { | |
printf "day,lines\n" | |
for (day in days) | |
print_day(day, days[day]); | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment