-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetpatches.py
44 lines (37 loc) · 1.11 KB
/
getpatches.py
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
import sys, csv
from globals import output_dir
root=output_dir
file = sys.argv[1]
ok = True
count = 0
patches_passed = []
patches_failed = []
with open(file,newline='') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
row=next(reader)
patch = row[0]
bug = row[1]+'-'+row[2]
failure = bool(int(row[6]))
ok = not failure
count +=1
for row in reader:
patch_next = row[0]
bug_next = row[1]+'-'+row[2]
failure_next = bool(int(row[6]))
if (patch==patch_next) and (bug==bug_next):
if ok: ok = not failure_next
else:
if ok: patches_passed.append(patch)
else: patches_failed.append(patch)
patch = patch_next
bug = bug_next
ok = not failure_next
count +=1
if ok: patches_passed.append(patch)
else: patches_failed.append(patch)
#print('patches_passed: ',len(patches_passed))
#print('patches_failed: ',len(patches_failed))
with open(root+'patches_passed.csv','w') as fp:
for p in patches_passed: fp.write(p+'\n')
with open(root+'patches_failed.csv','w') as ff:
for p in patches_failed: ff.write(p+'\n')