-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand_generator.py
More file actions
99 lines (81 loc) · 3.77 KB
/
command_generator.py
File metadata and controls
99 lines (81 loc) · 3.77 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
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
titan_dataset_dir = "/home/salab/chenlei/CGR/dataset/"
titan_output_dir = "/home/salab/chenlei/CGR/experiment/output/"
local_dataset_dir = "/Users/leichen/Code/pythonProject/pythonProject/pythonProject/SCRMDetection/experiment/data/"
local_output_dir = "/Users/leichen/Code/pythonProject/pythonProject/pythonProject/SCRMDetection/experiment/output/result/"
def remove_comment(dataset_dir, output_dir, repo, mount=True):
if mount:
command = f"nohup python3 remove_comment.py -s {dataset_dir}{repo} -t {output_dir}{repo}_cr >runlog/{repo}_cr.log 2>&1 &"
else:
command = f"python3 remove_comment.py -s {dataset_dir}{repo} -t {output_dir}{repo}_cr >runlog/{repo}_cr.log"
print(command)
def detect_refactoring(dataset_dir, output_dir, repo, mount=True):
if mount:
for i in range(1, 6):
print(
f"nohup python3 command.py -r {dataset_dir}{repo}_cr -c {i} -o {output_dir} >runlog/{repo}_cr_ref_{i}.log 2>&1 &")
else:
for i in range(1, 6):
print(f"python3 command.py -r {dataset_dir}{repo}_cr -c {i} -o {output_dir} >runlog/{repo}_cr_ref_{i}.log")
def trace_refactoring(dataset_dir, ref_dir, repo, mount=True):
if mount:
print(
f"nohup python3 trace.py -f {ref_dir}{repo}_cr -r {dataset_dir}{repo}_cr/.git >runlog/{repo}_trace.log 2>&1 &")
else:
print(f"python3 trace.py -f {ref_dir}{repo}_cr -r {dataset_dir}{repo}_cr/.git >runlog/{repo}_trace.log")
def attach_descriptions(ref_dir, repo, mount=True):
if mount:
print(
f"nohup python3 attach_descriptions.py -r {ref_dir}{repo}_cr >runlog/{repo}_attach.log 2>&1 &")
else:
print(f"python3 attach_descriptions.py -r {ref_dir}{repo}_cr >runlog/{repo}_attach.log")
def collect_cgr_fgr_repo(dataset_dir, ref_dir, repo, mount=True):
if mount:
print(
f"nohup python3 coarse_fine_ref_extractor.py -p {ref_dir}{repo}_cr -c {dataset_dir}{repo}_cr -r {repo} >runlog/{repo}_collect2csv.log 2>&1 &")
else:
print(f"python3 coarse_fine_ref_extractor.py -p {ref_dir}{repo}_cr -c {dataset_dir}{repo}_cr -r {repo} >runlog/{repo}_collect2csv.log")
if __name__ == "__main__":
temp = """javapoet
mbassador
seyren
jeromq
jfinal
retrolambda
helios
android-async-http
baasbox
RoboBinding
sshj
zuul
giraph
truth
spring-data-rest
blueflood
goclipse
rest-assured
cascading
HikariCP
hydra
PocketHub
rest.li
morphia
xabber-android
redisson
Activiti
processing
checkstyle
libgdx
cgeo
JGroups
"""
repos = temp.split()
# 5/18 evaluate time consumption for reviewer's comment
repos = ["mbassador"]
for repo in repos:
# remove_comment(dataset_dir=titan_dataset_dir, output_dir=titan_dataset_dir, repo=repo)
detect_refactoring(dataset_dir=local_dataset_dir, output_dir=local_output_dir, repo=repo, mount=True)
# detect_refactoring(dataset_dir=titan_dataset_dir, output_dir=titan_output_dir, repo=repo, mount=True)
# trace_refactoring(dataset_dir=local_dataset_dir, ref_dir=local_output_dir, repo=repo, mount=True)
# trace_refactoring(dataset_dir=titan_dataset_dir, ref_dir=titan_output_dir, repo=repo, mount=True)
# attach_descriptions(ref_dir=titan_output_dir, repo=repo, mount=True)
# collect_cgr_fgr_repo(titan_dataset_dir, titan_output_dir, repo)