if (lastEq != null) {
toRe = toRe.atRevision(
lastEq.getRevisionForRepository(migrationConfig.getToRepository()).revId);
}
Writer toWriter;
try {
toWriter = toRe.createWriter(context);
} catch (WritingError e) {
throw new MoeProblem("Couldn't create local repo " + toRe + ": " + e);
}
DraftRevision dr = null;
Revision lastMigratedRevision = null;
if (lastEq != null) {
lastMigratedRevision = lastEq.getRevisionForRepository(migrationConfig.getFromRepository());
}
for (Migration m : migrations) {
// For each migration, the reference to-codebase for inverse translation is the Writer,
// since it contains the latest changes (i.e. previous migrations) to the to-repository.
Expression referenceToCodebase = new RepositoryExpression(migrationConfig.getToRepository())
.withOption("localroot", toWriter.getRoot().getAbsolutePath());
Ui.Task oneMigrationTask = AppContext.RUN.ui.pushTask(
"perform_individual_migration",
String.format("Performing individual migration '%s'", m.toString()));
dr = OneMigrationLogic.migrate(m, context, toWriter, referenceToCodebase);
lastMigratedRevision = m.fromRevisions.get(m.fromRevisions.size() - 1);
AppContext.RUN.ui.popTask(oneMigrationTask, "");
}
// TODO(user): Add properly formatted one-DraftRevison-per-Migration message for svn.
migrationsMadeBuilder.add(String.format(
"%s in repository %s", dr.getLocation(), migrationConfig.getToRepository()));
toWriter.printPushMessage();
AppContext.RUN.ui.popTaskAndPersist(migrationTask, toWriter.getRoot());
}
List<String> migrationsMade = migrationsMadeBuilder.build();
if (migrationsMade.isEmpty()) {
AppContext.RUN.ui.info("No migrations made.");