-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitstats.sh
130 lines (121 loc) · 4.16 KB
/
gitstats.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
currentbranch(){
git status -b -s | grep '#' | cut -d ' ' -f 2
}
origbranch=`currentbranch`
walk(){
git log --pretty=tformat:%H_%ci --topo-order --reverse | cut -d ' ' -f 1,2 --output-delimiter='.'
}
countml(){
find . -name "*.ml" -not -path "./out/*" -not -path "./_build/*" -exec cat {} \; | wc -l
}
count(){
find ./out -name "$1" -exec cat {} \; | wc -c
}
counttestschars(){
find ./tests/prog -name "*.metalang" -exec cat {} \; | tr -d ' \n' | wc -c
}
counttestslines(){
find ./tests/prog -name "*.metalang" -exec cat {} \; | wc -l
}
echo "" > countlines.dat
echo "" > countlinesTest.dat
echo "" > countlinesC.dat
echo "" > countlinesCC.dat
echo "" > countlinesML.dat
echo "" > countlinesFUNML.dat
echo "" > countlinesPY.dat
echo "" > countlinesRB.dat
echo "" > countlinesJS.dat
echo "" > countlinesPAS.dat
echo "" > countlinesGO.dat
echo "" > countlinesPHP.dat
echo "" > countlinesJAVA.dat
echo "" > countlinesCL.dat
echo "" > countlinesCS.dat
makepoints(){
statComp=`countml`
echo "$1 $statComp" >> countlines.dat
if [ -d ./tests/prog ]; then
statMETALANG=`counttestschars`
statMETALANGL=`counttestslines`
statML=`count '*.ml'`
statFUNML=`count '*.fun.ml'`
statC=`count '*.c'`
statCC=`count '*.cc'`
statPY=`count '*.py'`
statRB=`count '*.rb'`
statJS=`count '*.js'`
statPAS=`count '*.pas'`
statGO=`count '*.go'`
statPHP=`count '*.php'`
statJAVA=`count '*.java'`
statCS=`count '*.cs'`
statCL=`count '*.cl'`
if [ "$statMETALANGL" != "0" ]; then
echo "$1 $statMETALANGL" >> countlinesTest.dat
fi
if [ "$statMETALANG" != "0" ]; then
statML=$(( ( $statML - $statFUNML ) * 1000 / $statMETALANG ))
statFUNML=$(( $statFUNML * 1000 / $statMETALANG ))
statC=$(( $statC * 1000 / $statMETALANG ))
statCC=$(( $statCC * 1000 / $statMETALANG ))
statPY=$(( $statPY * 1000 / $statMETALANG ))
statRB=$(( $statRB * 1000 / $statMETALANG ))
statJS=$(( $statJS * 1000 / $statMETALANG ))
statPAS=$(( $statPAS * 1000 / $statMETALANG ))
statGO=$(( $statGO * 1000 / $statMETALANG ))
statPHP=$(( $statPHP * 1000 / $statMETALANG ))
statJAVA=$(( $statJAVA * 1000 / $statMETALANG ))
statCS=$(( $statCS * 1000 / $statMETALANG ))
statCL=$(( $statCL * 1000 / $statMETALANG ))
if [ "$statFUNML" != "0" ]; then
echo "$1 $statFUNML" >> countlinesFUNML.dat
fi
if [ "$statML" != "0" ]; then
echo "$1 $statML" >> countlinesML.dat
fi
if [ "$statC" != "0" ]; then
echo "$1 $statC" >> countlinesC.dat
fi
if [ "$statCC" != "0" ]; then
echo "$1 $statCC" >> countlinesCC.dat
fi
if [ "$statPY" != "0" ]; then
echo "$1 $statPY" >> countlinesPY.dat
fi
if [ "$statRB" != "0" ]; then
echo "$1 $statRB" >> countlinesRB.dat
fi
if [ "$statJS" != "0" ]; then
echo "$1 $statJS" >> countlinesJS.dat
fi
if [ "$statPAS" != "0" ]; then
echo "$1 $statPAS" >> countlinesPAS.dat
fi
if [ "$statGO" != "0" ]; then
echo "$1 $statGO" >> countlinesGO.dat
fi
if [ "$statPHP" != "0" ]; then
echo "$1 $statPHP" >> countlinesPHP.dat
fi
if [ "$statJAVA" != "0" ]; then
echo "$1 $statJAVA" >> countlinesJAVA.dat
fi
if [ "$statCS" != "0" ]; then
echo "$1 $statCS" >> countlinesCS.dat
fi
if [ "$statCL" != "0" ]; then
echo "$1 $statCL" >> countlinesCL.dat
fi
fi
fi
}
for commit in `walk`; do
commitdate=`echo $commit | cut -d '_' -f 2`
commit=`echo $commit | cut -d '_' -f 1`
echo "$commit $commitdate"
git checkout "$commit" || exit 1
makepoints "$commitdate" || exit 1
done
git checkout "$origbranch"
gnuplot gitstats.plot