use of org.locationtech.geogig.api.porcelain.RevertOp in project GeoGig by boundlessgeo.
the class Revert method runInternal.
/**
* Executes the revert command.
*/
@Override
protected void runInternal(GeogigCLI cli) throws IOException {
checkParameter(commits.size() > 0 || abort || continueRevert, "nothing specified for reverting");
final GeoGIG geogig = cli.getGeogig();
RevertOp revert = geogig.command(RevertOp.class);
for (String st : commits) {
Optional<ObjectId> commitId = geogig.command(RevParse.class).setRefSpec(st).call();
checkParameter(commitId.isPresent(), "Couldn't resolve '" + st + "' to a commit, aborting revert.");
revert.addCommit(Suppliers.ofInstance(commitId.get()));
}
try {
revert.setCreateCommit(!noCommit).setAbort(abort).setContinue(continueRevert).call();
} catch (RevertConflictsException e) {
StringBuilder sb = new StringBuilder();
sb.append(e.getMessage() + "\n");
sb.append("When you have fixed these conflicts, run 'geogig revert --continue' to continue the revert operation.\n");
sb.append("To abort the revert operation, run 'geogig revert --abort'\n");
throw new CommandFailedException(sb.toString());
}
if (abort) {
cli.getConsole().println("Revert aborted successfully.");
}
}
Aggregations