use of com.google.gerrit.server.git.LocalDiskRepositoryManager in project gerrit by GerritCodeReview.
the class Schema_106 method migrateData.
@Override
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException {
if (!(repoManager instanceof LocalDiskRepositoryManager)) {
return;
}
ui.message("listing all repositories ...");
SortedSet<Project.NameKey> repoList = repoManager.list();
ui.message("done");
ui.message(String.format("creating reflog files for %s branches ...", RefNames.REFS_CONFIG));
ExecutorService executorPool = createExecutor(ui, repoList.size());
List<Future<Void>> futures = new ArrayList<>();
for (Project.NameKey project : repoList) {
Callable<Void> callable = new ReflogCreator(project);
futures.add(executorPool.submit(callable));
}
executorPool.shutdown();
try {
for (Future<Void> future : futures) {
try {
future.get();
} catch (ExecutionException e) {
ui.message(e.getCause().getMessage());
}
}
ui.message("done");
} catch (InterruptedException ex) {
String msg = String.format("Migration step 106 was interrupted. " + "Reflog created in %d of %d repositories only.", countDone(futures), repoList.size());
ui.message(msg);
}
}
Aggregations