예제 #1
0
            read_cursor.execute(statement( \
                    "SELECT id from repositories where uri = ?", \
                    db.place_holder), (repo_uri,))
            repo_id = read_cursor.fetchone()[0]
        except NotImplementedError:
            raise ExtensionRunError( \
                    "Content extension is not supported for %s repos" % \
                    (repo.get_type()))
        except Exception, e:
            raise ExtensionRunError( \
                    "Error creating repository %s. Exception: %s" % \
                    (repo.get_uri(), str(e)))

        self.__prepare_table(connection)
        fp = FilePaths(db)

        read_cursor.execute(
            statement(
                """select COUNT(*)
                        from patches p, scmlog s
                        where p.commit_id = s.id and
                        s.repository_id = ? and
                        p.patch is not NULL""", db.place_holder), (repo_id, ))
        nr_records = read_cursor.fetchone()[0]
        progress = Progress("[Extension Hunks]", nr_records)

        patches = self.get_patches(repo, path or repo.get_uri(), repo_id, db,
                                   read_cursor)

        for commit_id, file_id, patch_content, rev in patches:
예제 #2
0
파일: Hunks.py 프로젝트: jsichi/cvsanaly
                    %(repo.get_type()))
        except Exception, e:
            raise ExtensionRunError( \
                    "Error creating repository %s. Exception: %s" \
                    %(repo.get_uri(), str(e)))
        
        icursor = ICursor(read_cursor, self.INTERVAL_SIZE)
        # Get the patches from this repository
        query = "select p.commit_id, p.patch, s.rev from patches p, scmlog s " + \
                "where p.commit_id = s.id and " + \
                "s.repository_id = ? and " + \
                "p.patch is not NULL"
        icursor.execute(statement(query, db.place_holder),(repo_id,))

        self.__prepare_table(connection)
        fp = FilePaths(db)
        fp.update_all(repo_id)
        
        rs = icursor.fetchmany()

        while rs:
            for commit_id, patch_content, rev in rs:                
                for hunk in self.get_commit_data(patch_content):
                    # Get the file ID from the database for linking
                    # TODO: This isn't going to work if two files are committed
                    # with the same name at the same time, eg. __init.py__ in
                    # different paths. Might get fixed when messing with file paths
                    file_id_query = """select f.id, f.file_name from files f, actions a
                    where a.commit_id = ?
                    and a.file_id = f.id"""
    
예제 #3
0
파일: Hunks.py 프로젝트: carlsonp/MininGit
            read_cursor.execute(statement( \
                    "SELECT id from repositories where uri = ?", \
                    db.place_holder), (repo_uri,))
            repo_id = read_cursor.fetchone()[0]
        except NotImplementedError:
            raise ExtensionRunError( \
                    "Content extension is not supported for %s repos" % \
                    (repo.get_type()))
        except Exception, e:
            raise ExtensionRunError( \
                    "Error creating repository %s. Exception: %s" % \
                    (repo.get_uri(), str(e)))

        self.__prepare_table(connection)
        fp = FilePaths(db)

        patches = self.get_patches(repo, path or repo.get_uri(), repo_id, db,
                                   read_cursor)

        for commit_id, patch_content, rev in patches:
            for hunk in self.get_commit_data(patch_content):
                # Get the file ID from the database for linking
                hunk_file_name = re.sub(r'^[ab]\/', '',
                                        hunk.file_name.strip())
                file_id = fp.get_file_id(hunk_file_name, commit_id)

                if file_id == None:
                    printdbg("file not found")
                    if repo.type == "git":
                        # The liklihood is that this is a merge, not a
예제 #4
0
                    "Error creating repository %s. Exception: %s" % \
                    (repo.get_uri(), str(e)))

        profiler_start("Hunks: fetch all patches")
        icursor = ICursor(read_cursor, self.INTERVAL_SIZE)
        # Get the patches from this repository
        query = """select p.commit_id, p.patch, s.rev 
                    from patches p, scmlog s 
                    where p.commit_id = s.id and
                    s.repository_id = ? and 
                    p.patch is not NULL"""
        icursor.execute(statement(query, db.place_holder), (repo_id, ))
        profiler_stop("Hunks: fetch all patches", delete=True)

        self.__prepare_table(connection)
        fp = FilePaths(db)
        rs = icursor.fetchmany()

        while rs:
            for commit_id, patch_content, rev in rs:
                for hunk in self.get_commit_data(patch_content):
                    # Get the file ID from the database for linking
                    hunk_file_name = re.sub(r'^[ab]\/', '',
                                            hunk.file_name.strip())
                    file_id = fp.get_file_id(hunk_file_name, commit_id)

                    if file_id == None:
                        printdbg("file not found")
                        if repo.type == "git":
                            # The liklihood is that this is a merge, not a
                            # missing ID from some data screwup.
예제 #5
0
        except NotImplementedError:
            raise ExtensionRunError( \
                    "BugPrediction extension is not supported for %s repos" \
                    %(repo.get_type()))
        except Exception, e:
            raise ExtensionRunError( \
                    "Error creating repository %s. Exception: %s" \
                    %(repo.get_uri(), str(e)))
            
        # Get the commit notes from this repository
        query = """select s.id, s.message from scmlog s
            where s.repository_id = ?"""
        read_cursor.execute(statement(query, db.place_holder),(repo_id,))

        self.__prepare_table(connection)
        fp = FilePaths(db)
        fp.update_all(repo_id)

        for row in read_cursor:
            row_id = row[0]
            commit_message = row[1]
            
            update = """update scmlog
                        set is_bug_fix = ?
                        where id = ?"""

            if self.fixes_bug(commit_message):
                is_bug_fix = 1
            else:
                is_bug_fix = 0