}
@Test
public void testRevertModifiedFeatureConflictSolveAndContinue() throws Exception {
ObjectId oId1 = insertAndAdd(points1);
RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call();
insertAndAdd(points1_modified);
RevCommit c2 = geogig.command(CommitOp.class).setMessage("commit for modified " + idP1)
.call();
Feature points1_modifiedB = feature(pointsType, idP1, "StringProp1_2", new Integer(2000),
"POINT(1 1)");
insertAndAdd(points1_modifiedB);
RevCommit c3 = geogig.command(CommitOp.class)
.setMessage("commit for modified " + idP1 + " again").call();
try {
geogig.command(RevertOp.class).addCommit(Suppliers.ofInstance(c2.getId())).call();
fail();
} catch (RevertConflictsException e) {
assertTrue(e.getMessage().contains(idP1));
}
Optional<Ref> ref = geogig.command(RefParse.class).setName(Ref.ORIG_HEAD).call();
assertTrue(ref.isPresent());
assertEquals(c3.getId(), ref.get().getObjectId());
List<Conflict> conflicts = geogig.command(ConflictsReadOp.class).call();
assertEquals(1, conflicts.size());
String path = NodeRef.appendChild(pointsName, idP1);
assertEquals(conflicts.get(0).getPath(), path);
assertEquals(conflicts.get(0).getOurs(), RevFeatureBuilder.build(points1_modifiedB).getId());
assertEquals(conflicts.get(0).getTheirs(), RevFeatureBuilder.build(points1).getId());
// solve, and continue
insert(points1);
geogig.command(AddOp.class).call();
geogig.command(RevertOp.class).setContinue(true).call();
Iterator<RevCommit> log = geogig.command(LogOp.class).call();
RevCommit logCommit = log.next();
assertEquals(c2.getAuthor().getName(), logCommit.getAuthor().getName());
assertEquals(c2.getCommitter().getName(), logCommit.getCommitter().getName());
assertEquals("Revert '" + c2.getMessage() + "'\nThis reverts " + c2.getId().toString(),
logCommit.getMessage());
assertNotSame(c2.getCommitter().getTimestamp(), logCommit.getCommitter().getTimestamp());
assertNotSame(c2.getTreeId(), logCommit.getTreeId());
final Optional<Ref> currHead = geogig.command(RefParse.class).setName(Ref.HEAD).call();
final Optional<ObjectId> headTreeId = geogig.command(ResolveTreeish.class)
.setTreeish(currHead.get().getObjectId()).call();