def __init__ (self, db, cnn, cursor, repoid): self.db = db self.cnn = cnn self.repoid = repoid self.icursor = ICursor (cursor, self.INTERVAL_SIZE) self.icursor.execute (statement (self.__query__, db.place_holder), (repoid,)) self.rs = iter (self.icursor.fetchmany ()) self.prev_commit = -1 self.current = None self.fp = FilePaths (db) self.fp.update_all(repoid)
job_pool = JobPool(repo, path or repo.get_uri(), queuesize=100) outer_query = """select distinct h.file_id, h.commit_id from hunks h, scmlog s where h.commit_id=s.id and s.repository_id=? and s.is_bug_fix=1 and h.old_start_line is not null and h.old_end_line is not null and h.file_id is not null and h.commit_id is not null """ read_cursor.execute(statement(outer_query, db.place_holder), (repoid, )) file_rev = read_cursor.fetchone() n_blames = 0 fp = FilePaths(db) fp.update_all(repoid) while file_rev is not None: try: file_id, commit_id = file_rev pre_commit_id, pre_rev = self.__find_previous_commit( file_id, commit_id) relative_path = fp.get_path(file_id, pre_commit_id, repoid) if relative_path is None: raise NotValidHunkWarning( "Couldn't find path for file ID %d" % file_id) printdbg("Path for %d at %s -> %s", (file_id, pre_rev, relative_path)) try: inner_cursor = cnn.cursor()