-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddLogFile.py
39 lines (30 loc) · 989 Bytes
/
AddLogFile.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
__author__ = 'houxiang'
import os
import git
import csv
basepath = "/Users/dreamteam/Documents/git_repos"
def addLogFile(path):
if os.path.isdir(path):
try:
os.chdir(path)
logfile_path = path + "/logfile"
if os.path.isfile(logfile_path):
os.remove(logfile_path)
os.system("git log -p --all --before={2016-03-01} >> logfile")
print path + " add logfile successfully!"
except:
print "add lgofile failed !"
else:
print "this path is not a file !"
def app(seedfile):
with open(seedfile) as seed:
reader = csv.reader(seed)
next(reader,None)
for line in reader:
proj_id = line[0]
proj_name = line[1]
proj_lang = line[11]
path = basepath+"/"+proj_lang+"/"+proj_name
addLogFile(path)
if __name__ == "__main__":
app("/Users/dreamteam/Documents/study/sonar/script/js_top10.csv")