Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000),
"POINT(1 1)");
insert(points1Modified);
delete(points2);
geogig.command(AddOp.class).call();
RevCommit masterCommit2 = geogig.command(CommitOp.class)
.setMessage("adding points1 modified, deleting point2").call();
insert(lines1);
geogig.command(AddOp.class).call();
RevCommit masterCommit = geogig.command(CommitOp.class).setMessage("adding lines.1").call();
geogig.command(CheckoutOp.class).setSource("branch1").call();
insert(points3);
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000),
"POINT(1 1)");
insert(points1ModifiedB);
delete(points2);
geogig.command(AddOp.class).call();
RevCommit branchCommit = geogig.command(CommitOp.class).setMessage("branch commit").call();
geogig.command(CheckoutOp.class).setSource("master").call();
Ref branch1 = geogig.command(RefParse.class).setName("branch1").call().get();
try {
geogig.command(RebaseOp.class).setUpstream(Suppliers.ofInstance(branch1.getObjectId()))
.call();
fail();
} catch (RebaseConflictsException e) {
assertTrue(e.getMessage().contains("conflict"));
}
Optional<Ref> ref = geogig.command(RefParse.class).setName(Ref.ORIG_HEAD).call();
assertTrue(ref.isPresent());
assertEquals(masterCommit.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(points1Modified).getId());
assertEquals(conflicts.get(0).getTheirs(), RevFeatureBuilder.build(points1ModifiedB)
.getId());
// solve, and continue
Feature points1Merged = feature(pointsType, idP1, "StringProp1_2", new Integer(2000),
"POINT(1 1)");
insert(points1Merged);
geogig.command(AddOp.class).call();
geogig.command(RebaseOp.class).setContinue(true).call();
Iterator<RevCommit> log = geogig.command(LogOp.class).call();
RevCommit logCommit1 = log.next();
assertEquals(masterCommit.getAuthor(), logCommit1.getAuthor());
assertEquals(masterCommit.getCommitter().getName(), logCommit1.getCommitter().getName());
assertEquals(masterCommit.getMessage(), logCommit1.getMessage());
assertEquals(masterCommit.getAuthor().getTimeZoneOffset(), logCommit1.getAuthor()
.getTimeZoneOffset());
assertEquals(masterCommit.getAuthor().getTimestamp(), logCommit1.getAuthor().getTimestamp());
assertEquals(masterCommit.getCommitter().getTimeZoneOffset(), logCommit1.getCommitter()
.getTimeZoneOffset());
assertNotSame(masterCommit.getCommitter().getTimestamp(), logCommit1.getCommitter()
.getTimestamp());
assertNotSame(masterCommit.getTreeId(), logCommit1.getTreeId());
RevCommit logCommit2 = log.next();
assertEquals(masterCommit2.getAuthor(), logCommit2.getAuthor());
assertEquals(masterCommit2.getCommitter().getName(), logCommit2.getCommitter().getName());
assertEquals(masterCommit2.getMessage(), logCommit2.getMessage());
RevCommit logCommit3 = log.next();
assertEquals(branchCommit.getAuthor(), logCommit3.getAuthor());
assertEquals(branchCommit.getCommitter().getName(), logCommit3.getCommitter().getName());
assertEquals(branchCommit.getMessage(), logCommit3.getMessage());
ref = geogig.command(RefParse.class).setName(Ref.ORIG_HEAD).call();
assertFalse(ref.isPresent());
}