/**
   * @param fromRev
   * @param toRev
   * @param indexDirectory
   * @param create
   * @param repository
   */
  public static void scanSingleRepos(
      ScanRepository scanRepository, String indexDirectory, boolean create) {
    // BLOCK ANFANG

    Index index = new Index();
    // We will create a new one if --create is given on command line
    // otherwise we will append to the existing index.
    Analyzer analyzer = AnalyzerFactory.createInstance();
    index.setAnalyzer(analyzer);

    index.setCreate(create);
    IndexWriter indexWriter = index.createIndexWriter(indexDirectory);

    try {
      LOGGER.info("Scanning started.");
      scanRepository.scan(indexWriter);
      LOGGER.info("Scanning ready.");
      try {
        long startTime = System.currentTimeMillis();
        LOGGER.info("Index optimizing started.");
        indexWriter.optimize();
        indexWriter.close();
        long stopTime = System.currentTimeMillis();
        LOGGER.info("Index optimizing done.");
        long ms = (stopTime - startTime);
        long seconds = ms / 1000;
        LOGGER.info("The Index optimizing has taken " + seconds + " seconds.");
      } catch (CorruptIndexException e) {
        LOGGER.error("CorruptIndexException: Error during optimization of index: ", e);
      } catch (IOException e) {
        LOGGER.error("IOException: Error during optimization of index: ", e);
      }
    } catch (SVNAuthenticationException svnae) {
      LOGGER.error("Authentication has failed. ", svnae);
    } catch (Exception e) {
      LOGGER.error("Something unexpected went wrong ", e);
    }
  }