forked from gerner/autodevstats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextractplies.awk
57 lines (46 loc) · 1.21 KB
/
extractplies.awk
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
#run with included date.awk and reduce.awk
#input: comments sorted by PR, dev, create time
#columns:
#1. PR number
#2. dev login
#3. create time of comment (in ISO-8601)
#4. type of comment (e.g. toplevel, codecomment)
#5. state of pr (assume it's the same for all rows within pr)
#output: comments including which "dev-ply" the comment belongs to
#columns:
#1. PR number
#2. dev login
#3. ply number
#4. create time of comment (unix timestamp)
#5. type of comment (e.g. toplevel, codecomment)
#6. state of pr
#7. create time of pr (unix timestamp)
#8. close time of pr (unix timestamp) (if there is one)
BEGIN {
OFS="\t";
setkey("1\t2");
}
function startrun(key) {
lastts=parsedate($3);
cycles=0;
}
function reduce(key) {
ts=parsedate($3);
#bail if this comment happened after the PR was closed
if($7 == "") {
closets="";
} else {
closets=parsedate($7);
#if(ts > closets) {
# return;
#}
}
if(ts - lastts > 2*3600) {
cycles+=1;
};
createts=parsedate($6);
#output one row for every comment including which cycle it belongs to
print $1,$2,cycles,ts, $4, $5, createts, closets;
lastts=ts;
}
function endrun(key) { }