-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhotspots.sh
More file actions
executable file
·53 lines (43 loc) · 1.26 KB
/
hotspots.sh
File metadata and controls
executable file
·53 lines (43 loc) · 1.26 KB
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
#!/bin/bash
# hotspots.sh -r ../ro_repo/code -x im -d 2014-08-19 -s 2
OPTIND=1
PREFIX=code_all
AFTER=2014-01-01
BEFORE=`date -v+1d +'%Y-%m-%d'`
REPODIR=.
SPREAD=1
function show_help() {
cat << ENDHELP
-r source repository root (.)
-x unique prefix for data files (code_all)
-d date from (2014-01-01)
-D date to (today)
-s hotspot spread factor (1)
ENDHELP
}
while getopts "hr:x:d:s:" opt; do
case "$opt" in
h) show_help
exit 0
;;
r) REPODIR=${OPTARG}
;;
x) PREFIX=${OPTARG}_all
;;
d) AFTER=${OPTARG}
;;
D) BEFORE=${OPTARG}
;;
s) SPREAD=${OPTARG}
;;
esac
done
shift $((OPTIND-1))
[ "$1" = "--" ] && shift
WD=$PWD
cd $REPODIR
cloc . --by-file --csv --quiet --report-file=$WD/data/${PREFIX}_lines.csv --exclude-dir=dist,out,lib,gems,.idea
git log --pretty=format:'[%h] %an %ad %s' --date=short --numstat --after=${AFTER} --before=${BEFORE} --full-history . > $WD/data/${PREFIX}_evo.log
cd $WD
java -jar code-maat-0.8.5-snapshot-standalone.jar -l data/${PREFIX}_evo.log -c git -a revisions > data/${PREFIX}_freqs.csv
python csv_as_enclosure_json.py --structure data/${PREFIX}_lines.csv --weights data/${PREFIX}_freqs.csv --weightcolumn 1 --minrevs 2 --normalizeweightsfactor ${SPREAD} > serve/json/${PREFIX}_hotspot.json