Beispiel #1
0
        cursor.execute(
            statement("SELECT id from repositories where uri = ?",
                      db.place_holder), (uri, ))
        rep = cursor.fetchone()
        initialize_ids(db, cursor)
        cursor.close()

    if config.no_parse and rep is None:
        printerr("The option --no-parse must be used with an already " + \
                 "filled database")
        return 1

    if not db_exists or rep is None:
        # We consider the name of the repo as the last item of the root path
        name = uri.rstrip("/").split("/")[-1].strip()
        cursor = cnn.cursor()
        rep = DBRepository(None, uri, name, repo.get_type())
        cursor.execute(statement(DBRepository.__insert__, db.place_holder),
                       (rep.id, rep.uri, rep.name, rep.type))
        cursor.close()
        cnn.commit()

    cnn.close()

    if not config.no_parse:
        _parse_log(path or uri, repo, parser, reader, config, db)

    # Run extensions
    printout("Executing extensions")
    emg.run_extensions(repo, path or uri, db)
Beispiel #2
0
                         'localhost')
    cnn = db.connect()

    tables = ['actions', 'branches', 'file_copies', 'file_links', 'files',
              'people', 'repositories', 'scmlog', 'tag_revisions', 'tags']

    cursor = cnn.cursor()
    for table in tables:
        query = "delete from %s" % (table)
        cursor.execute(statement(query, db.place_holder))
    cursor.close()
    cnn.commit()

    name = uri.rstrip("/").split("/")[-1].strip()
    cursor = cnn.cursor()
    rep = DBRepository(None, uri, name, 'svn')
    cursor.execute(statement(DBRepository.__insert__, db.place_holder),
                   (rep.id, rep.uri, rep.name, rep.type))
    cursor.close()
    cnn.commit()

    ch = DBContentHandler(db)
    ch.begin()
    ch.repository(uri)

    # We need to split the query to save memory
    icursor = ICursor(cnn.cursor(), 100)
    icursor.execute(statement("SELECT object from _temp_log order by id desc",
                                self.db.place_holder))
    rs = icursor.fetchmany()
    while rs: