Exemplo n.º 1
0
        if self.id_counter > 1:
            blames = self.__get_blames (read_cursor, repoid)

        job_pool = JobPool (repo, path or repo.get_uri (), queuesize=100)

        # Get code files
        query = "select f.id from file_types ft, files f " + \
                "where f.id = ft.file_id and " + \
                "ft.type in ('code', 'unknown') and " + \
                "f.repository_id = ?"
        read_cursor.execute (statement (query, db.place_holder), (repoid,))
        code_files = [item[0] for item in read_cursor.fetchall ()]

        n_blames = 0
        fr = FileRevs (db, cnn, read_cursor, repoid)
        for revision, commit_id, file_id, action_type, composed in fr:
            if file_id not in code_files:
                continue

            if (file_id, commit_id) in blames:
                printdbg ("%d@%d is already in the database, skip it", (file_id, commit_id))
                continue

            if composed:
                rev = revision.split ("|")[0]
            else:
                rev = revision

            relative_path = fr.get_path ()
            printdbg ("Path for %d at %s -> %s", (file_id, rev, relative_path))
Exemplo n.º 2
0
        # after download. However, ignore them for now to speed things up
        query = "select f.id from file_types ft, files f " + \
                "where f.id = ft.file_id and " + \
                "ft.type in('code') and " + \
                "f.repository_id = ?"
        # "ft.type in('code', 'unknown') and " + \
        read_cursor.execute(statement(query, db.place_holder), (repo_id, ))
        code_files = [item[0] for item in read_cursor.fetchall()]
        query = """select c.file_id, c.commit_id from content c, files f
            where c.file_id=f.id and f.repository_id=?
        """
        read_cursor.execute(statement(query, db.place_holder), (repo_id, ))
        existing_content = [(item[0], item[1]) \
                            for item in read_cursor.fetchall()]

        fr = FileRevs(db, connection, read_cursor, repo_id)

        i = 0
        # Loop through each file and its revision
        for revision, commit_id, file_id, action_type, composed in fr:
            #            loop_start = datetime.now()
            if file_id not in code_files:
                continue
            if (file_id, commit_id) in existing_content:
                continue

            try:
                relative_path = fr.get_path()
            except AttributeError, e:
                printerr("No path found for file %d at commit %d",
                         (file_id, commit_id))
Exemplo n.º 3
0
        # after download. However, ignore them for now to speed things up
        query = "select f.id from file_types ft, files f " + \
                "where f.id = ft.file_id and " + \
                "ft.type in('code') and " + \
                "f.repository_id = ?"
                # "ft.type in('code', 'unknown') and " + \
        read_cursor.execute(statement(query, db.place_holder), (repo_id,))
        code_files = [item[0] for item in read_cursor.fetchall()]
        query = """select c.file_id, c.commit_id from content c, files f
            where c.file_id=f.id and f.repository_id=?
        """
        read_cursor.execute(statement(query, db.place_holder), (repo_id,))
        existing_content = [(item[0], item[1])
                            for item in read_cursor.fetchall()]

        fr = FileRevs(db, connection, read_cursor, repo_id)

        i = 0
        # Loop through each file and its revision
        for revision, commit_id, file_id, action_type, composed in fr:
            if action_type == 'D':
                continue
#            loop_start = datetime.now()
            if file_id not in code_files:
                continue
            if (file_id, commit_id) in existing_content:
                continue

            try:
                relative_path = fr.get_path(repo, path or repo.get_uri())
            except TypeError as e:
Exemplo n.º 4
0
        query = (
            "select f.id from file_types ft, files f "
            + "where f.id = ft.file_id and "
            + "ft.type in('code') and "
            + "f.repository_id = ?"
        )
        # "ft.type in('code', 'unknown') and " + \
        read_cursor.execute(statement(query, db.place_holder), (repo_id,))
        code_files = [item[0] for item in read_cursor.fetchall()]
        query = """select c.file_id, c.commit_id from content c, files f
            where c.file_id=f.id and f.repository_id=?
        """
        read_cursor.execute(statement(query, db.place_holder), (repo_id,))
        existing_content = [(item[0], item[1]) for item in read_cursor.fetchall()]

        fr = FileRevs(db, connection, read_cursor, repo_id)

        i = 0
        # Loop through each file and its revision
        for revision, commit_id, file_id, action_type, composed in fr:
            if action_type == "D":
                continue
            #            loop_start = datetime.now()
            if file_id not in code_files:
                continue
            if (file_id, commit_id) in existing_content:
                continue

            try:
                relative_path = fr.get_path(repo, path or repo.get_uri())
            except TypeError as e:
Exemplo n.º 5
0
        if self.id_counter > 1:
            blames = self.__get_blames(read_cursor, repoid)

        job_pool = JobPool(repo, path or repo.get_uri(), queuesize=100)

        # Get code files
        query = "select f.id from file_types ft, files f " + \
                "where f.id = ft.file_id and " + \
                "ft.type in ('code', 'unknown') and " + \
                "f.repository_id = ?"
        read_cursor.execute(statement(query, db.place_holder), (repoid, ))
        code_files = [item[0] for item in read_cursor.fetchall()]

        n_blames = 0
        fr = FileRevs(db, cnn, read_cursor, repoid)
        for revision, commit_id, file_id, action_type, composed in fr:
            if file_id not in code_files:
                continue

            if (file_id, commit_id) in blames:
                printdbg("%d@%d is already in the database, skip it",
                         (file_id, commit_id))
                continue

            if composed:
                rev = revision.split("|")[0]
            else:
                rev = revision

            relative_path = fr.get_path(repo, path or repo.get_uri())