use of org.eclipse.jgit.api.errors.MultipleParentsNotAllowedException in project archi-modelrepository-plugin by archi-contribs.
the class RevertCommitsAction method doRevertCommand.
@Override
protected RevertCommand doRevertCommand(Git git) throws GitAPIException, IOException {
RevertCommand revertCommand = git.revert();
try (RevWalk revWalk = new RevWalk(git.getRepository())) {
// We are interested in the HEAD
revWalk.markStart(revWalk.parseCommit(git.getRepository().resolve(IGraficoConstants.HEAD)));
for (RevCommit c : revWalk) {
if (c.getParentCount() > 1) {
throw new MultipleParentsNotAllowedException(NLS.bind(Messages.RevertCommitsAction_1, c.getName()));
}
if (c.equals(fCommit)) {
break;
}
revertCommand.include(c);
}
revWalk.dispose();
}
revertCommand.call();
return revertCommand;
}
Aggregations