Add verbose statistics for Schema 130 & 131
Migration to Schemas 130 and 131 are quite heavy and may take a long time to complete. With extra statistics on the number of repositories actually impacted is going to be easier to plan the migration up-front. Change-Id: I5586c912001122bee61ef1ec4e03a46334bb5c10
This commit is contained in:
@@ -30,6 +30,9 @@ import org.eclipse.jgit.lib.PersonIdent;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Schema_131 extends SchemaVersion {
|
||||
private static final String COMMIT_MSG =
|
||||
@@ -49,7 +52,10 @@ public class Schema_131 extends SchemaVersion {
|
||||
|
||||
@Override
|
||||
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException {
|
||||
for (Project.NameKey projectName : repoManager.list()) {
|
||||
SortedSet<Project.NameKey> repoList = repoManager.list();
|
||||
SortedSet<Project.NameKey> repoUpgraded = new TreeSet<>();
|
||||
ui.message("\tMigrating " + repoList.size() + " repositories ...");
|
||||
for (Project.NameKey projectName : repoList) {
|
||||
try (Repository git = repoManager.openRepository(projectName);
|
||||
MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED,
|
||||
projectName, git)) {
|
||||
@@ -59,10 +65,16 @@ public class Schema_131 extends SchemaVersion {
|
||||
md.getCommitBuilder().setCommitter(serverUser);
|
||||
md.setMessage(COMMIT_MSG);
|
||||
config.commit(md);
|
||||
repoUpgraded.add(projectName);
|
||||
}
|
||||
} catch (ConfigInvalidException | IOException ex) {
|
||||
throw new OrmException("Cannot migrate project " + projectName, ex);
|
||||
}
|
||||
}
|
||||
ui.message("\tMigration completed: " + repoUpgraded.size()
|
||||
+ " repositories updated:");
|
||||
ui.message("\t"
|
||||
+ repoUpgraded.stream().map(n -> n.get())
|
||||
.collect(Collectors.joining(" ")));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user