import java.text.MessageFormat;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import org.eclipse.jgit.JGitText;
+import org.eclipse.jgit.api.MergeResult.MergeStatus;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.MultipleParentsNotAllowedException;
import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.merge.MergeStrategy;
import org.eclipse.jgit.merge.ResolveMerger;
+import org.eclipse.jgit.merge.ResolveMerger.MergeFailureReason;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.treewalk.FileTreeIterator;
private List<Ref> revertedRefs = new LinkedList<Ref>();
+ private MergeResult failingResult;
+
/**
* @param repo
*/
.setReflogComment("revert: " + shortMessage).call();
revertedRefs.add(src);
} else {
+ Map<String, MergeFailureReason> failingPaths = merger
+ .getFailingPaths();
+ if (failingPaths != null)
+ failingResult = new MergeResult(null,
+ merger.getBaseCommit(0, 1),
+ new ObjectId[] { headCommit.getId(),
+ srcParent.getId() },
+ MergeStatus.FAILED, MergeStrategy.RESOLVE,
+ merger.getMergeResults(), failingPaths, null);
return null;
}
}
public List<Ref> getRevertedRefs() {
return revertedRefs;
}
+
+ /**
+ * @return the result of the merge failure, <code>null</code> if no merge
+ * failure occurred during the revert
+ */
+ public MergeResult getFailingResult() {
+ return failingResult;
+ }
}