diff --git a/sqlGit.py b/sqlGit.py index ecf91758a2e9998a3238e4222fcab4924456f165..247c1c5b1c3ea8dabaa65817df5703696206bcd3 100644 --- a/sqlGit.py +++ b/sqlGit.py @@ -115,20 +115,19 @@ class sqlGit(object): data = line.split('[;;|\/|;;]') yield (data) - def _gInsertFile(self,depth,mdepth): + def _gInsertFile(self,depth): for root, dirs, files in filtered_walk(".", depth=depth): for fn in files: path = os.path.join(root, fn) size = os.path.getsize(path) data = (fn, size, root) yield(data) - for root, dirs, files in filtered_walk(".", - depth=depth, - min_depth=mdepth): - for d in dirs: - path = os.path.join(root, d) - size = self._get_size_dir(path) - data = (d, size, root) + + if( root.count("/") == depth): + for d in dirs: + path = os.path.join(root, d) + size = self._get_size_dir(path) + data = (d, size, root) yield(data) def _gInsertLFC(self,l): @@ -197,13 +196,9 @@ class sqlGit(object): def insert_file(self,depth): ''' insert file data into file table, depth define how precise file data will be.''' - if depth > 0: - mdepth = depth - else: - mdepth = None c = self.conn.cursor() # TODO : gérer profondeur et ignorer fichier dans .git ? - g = self._gInsertFile(depth,mdepth) + g = self._gInsertFile(depth) c.executemany( '''INSERT INTO file(name,size,dir) values (?,?,?);''', g)