Commit a2a2176a authored by Inkhey's avatar Inkhey

rename method

parent 5fbcf305
......@@ -19,7 +19,7 @@ class sqlGit(object):
''' Transform Git data into sqlite database to
analyse these datas into program like gephi'''
# CREATE
# CREATE
def __init__(self, db):
''' Initialise sqlite database file'''
self.conn = sqlite3.connect(db)
......@@ -73,18 +73,17 @@ class sqlGit(object):
# INSERT
# DATA
def getContent(self, path, depth):
''' get_all_content and delete unused file'''
def insert_all(self, path, depth):
''' insert all content and delete unused file'''
os.chdir(path)
self.getAuthor()
self.getCommit()
self.getFile(1)
self.getFile(depth)
self.getLink_A_C()
self.getLink_F_C()
self.deleteUnusedFile()
def getAuthor(self):
self.insert_author()
self.insert_commit()
self.insert_file(depth)
self.insert_link_A_C()
self.insert_link_F_C()
self.delete_unused_file()
def insert_author(self):
''' insert author data into author table'''
f = os.popen("git log --format='%aN;;%aE'| sort -u")
dAuthor = f.read().splitlines()
......@@ -96,7 +95,7 @@ class sqlGit(object):
values (?,?);''', data)
self.conn.commit()
def getCommit(self):
def insert_commit(self):
''' insert commit data into commits table'''
f = os.popen("git log --format='%s;;%H;;%t;;%at' | sort -u")
......@@ -110,7 +109,7 @@ class sqlGit(object):
values (?,?,?,?);''', data)
self.conn.commit()
def getFile(self, depth):
def insert_file(self, depth):
''' insert file data into file table, depth define how precise
file data will be.'''
......@@ -127,7 +126,7 @@ class sqlGit(object):
self.conn.commit()
# LINKS
def getLink_A_C(self):
def insert_link_A_C(self):
''' insert link data between author and commit into
link_author_commits table'''
......@@ -143,7 +142,7 @@ class sqlGit(object):
values (?,?,?);''', data)
self.conn.commit()
def getLink_F_C(self):
def insert_link_F_C(self):
''' insert link data between file and commit into
link_author_commits table'''
......@@ -162,29 +161,30 @@ class sqlGit(object):
self.conn.commit()
# VIEW
def 3nodestypeView():
'''View with 3 types of nodes : author,commit,file''''
def view_3nodestype():
'''View with 3 types of nodes : author,commit,file'''
pass
def 2nodestypeView():
'''View with 2 types of nodes : author,file''''
def view_2nodestype():
'''View with 2 types of nodes : author,file'''
pass
def fileView():
'''View of relation between files''''
def view_files():
'''View of relation between files'''
pass
def authorView():
'''View of relation between authors''''
def view_authors():
'''View of relation between authors'''
pass
def fileCommitView():
def view_file_commits():
pass
def authorCommitView():
def view_authors_commits():
pass
# CLEAN
def deleteUnusedFile(self):
def delete_unused_file(self):
''' delete unused file (who are not linked to any commit.)'''
c = self.conn.cursor()
......@@ -200,7 +200,7 @@ class sqlGit(object):
'" and dir="' + row[1] + '";')
self.conn.commit()
def cleanDB(self):
def clean_DB(self):
''' drop alls tables'''
c = self.conn.cursor()
......@@ -210,10 +210,9 @@ class sqlGit(object):
c.execute('DROP TABLE ' + table + ' ;')
self.conn.commit()
# autotest
if __name__ == '__main__':
db = sqlGit('self.db')
#db.cleanDB()
db.clean_DB()
db.create_table()
db.getContent('.', 0)
db.insert_all('.', 0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment