@Test public void testHeadWithNoHistory() throws Exception { exception.expect(IllegalStateException.class); geogig.command(RevertOp.class).call(); }
@Test public void testHeadWithNoHistory() throws Exception { exception.expect(IllegalStateException.class); geogig.command(RevertOp.class).call(); }
@Test public void testRevertToWrongCommit() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); exception.expect(IllegalArgumentException.class); geogig.command(RevertOp.class).addCommit(Suppliers.ofInstance(RevObjectTestSupport.hashString("wrong"))) .call(); }
@Test public void testUncleanIndex() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); insertAndAdd(points2); exception.expect(IllegalStateException.class); geogig.command(RevertOp.class).addCommit(Suppliers.ofInstance(c1.getId())).call(); }
@Test public void testUncleanWorkingTree() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); insert(points2); exception.expect(IllegalStateException.class); geogig.command(RevertOp.class).addCommit(Suppliers.ofInstance(c1.getId())).call(); }
@Test public void testRevertUsingContinueAndAbort() throws Exception { insertAndAdd(points1); RevCommit commit = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); exception.expect(IllegalArgumentException.class); geogig.command(RevertOp.class).addCommit(Suppliers.ofInstance(commit.getId())) .setAbort(true).setContinue(true).call(); }
@Test public void testRevertOnlyCommit() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); geogig.command(RevertOp.class).addCommit(Suppliers.ofInstance(c1.getId())).call(); 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(); RevTree headTree = repo.getTree(headTreeId.get()); Optional<NodeRef> points1Node = geogig.command(FindTreeChild.class) .setChildPath(NodeRef.appendChild(pointsName, idP1)).setParent(headTree).call(); assertFalse(points1Node.isPresent()); }
@Test public void testRevertToWrongCommit() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); exception.expect(IllegalArgumentException.class); geogig.command(RevertOp.class).addCommit(RevObjectTestSupport.hashString("wrong")).call(); }
@Test public void testRevertOnlyCommit() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); geogig.command(RevertOp.class).addCommit(c1.getId()).call(); 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(); RevTree headTree = repo.getTree(headTreeId.get()); Optional<NodeRef> points1Node = geogig.command(FindTreeChild.class) .setChildPath(NodeRef.appendChild(pointsName, idP1)).setParent(headTree).call(); assertFalse(points1Node.isPresent()); }
@Test public void testNoUserNameForResolveCommiter() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.name") .setValue(null).call(); exception.expect(IllegalStateException.class); geogig.command(RevertOp.class).addCommit(Suppliers.ofInstance(c1.getId())).call(); }
@Test public void testNoUserEmailForResolveCommiterEmail() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.email") .setValue(null).call(); exception.expect(IllegalStateException.class); geogig.command(RevertOp.class).addCommit(Suppliers.ofInstance(c1.getId())).call(); }
@Test public void testUncleanWorkingTree() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); insert(points2); exception.expect(IllegalStateException.class); geogig.command(RevertOp.class).addCommit(c1.getId()).call(); }
@Test public void testUncleanIndex() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); insertAndAdd(points2); exception.expect(IllegalStateException.class); geogig.command(RevertOp.class).addCommit(c1.getId()).call(); }
@Test public void testRevertUsingContinueAndAbort() throws Exception { insertAndAdd(points1); RevCommit commit = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); exception.expect(IllegalArgumentException.class); geogig.command(RevertOp.class).addCommit(commit.getId()).setAbort(true).setContinue(true) .call(); }
@Test public void testRevertToSameFeatureIsNotConflict() throws Exception { @SuppressWarnings("unused") ObjectId oId1 = insertAndAdd(points1); @SuppressWarnings("unused") 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(); insertAndAdd(points1); @SuppressWarnings("unused") RevCommit c3 = geogig.command(CommitOp.class) .setMessage("commit for modified " + idP1 + " again").call(); geogig.command(RevertOp.class).addCommit(Suppliers.ofInstance(c2.getId())).call(); }
@Test public void testStillDeletedMergeConflictResolution() throws Exception { insertAndAdd(points1); @SuppressWarnings("unused") RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); deleteAndAdd(points1); RevCommit c2 = geogig.command(CommitOp.class).setMessage("commit for removing " + idP1) .call(); @SuppressWarnings("unused") ObjectId oId1 = insertAndAdd(points1); @SuppressWarnings("unused") RevCommit c3 = geogig.command(CommitOp.class).setMessage("commit for " + idP1 + " again") .call(); try { geogig.command(RevertOp.class).addCommit(Suppliers.ofInstance(c2.getId())).call(); fail(); } catch (RevertConflictsException e) { assertTrue(e.getMessage().contains(idP1)); } }
@Test public void testNoUserNameForResolveCommiter() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.name") .setValue(null).call(); exception.expect(IllegalStateException.class); geogig.command(RevertOp.class).addCommit(c1.getId()).call(); }
@Test public void testNoUserEmailForResolveCommiterEmail() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); repo.command(ConfigOp.class).setAction(ConfigAction.CONFIG_SET).setName("user.email") .setValue(null).call(); exception.expect(IllegalStateException.class); geogig.command(RevertOp.class).addCommit(c1.getId()).call(); }
@Test public void testStillDeletedMergeConflictResolution() throws Exception { insertAndAdd(points1); @SuppressWarnings("unused") RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); deleteAndAdd(points1); RevCommit c2 = geogig.command(CommitOp.class).setMessage("commit for removing " + idP1) .call(); @SuppressWarnings("unused") ObjectId oId1 = insertAndAdd(points1); @SuppressWarnings("unused") RevCommit c3 = geogig.command(CommitOp.class).setMessage("commit for " + idP1 + " again") .call(); try { geogig.command(RevertOp.class).addCommit(c2.getId()).call(); fail(); } catch (RevertConflictsException e) { assertTrue(e.getMessage().contains(idP1)); } }
@Test public void testRevertToSameFeatureIsNotConflict() throws Exception { @SuppressWarnings("unused") ObjectId oId1 = insertAndAdd(points1); @SuppressWarnings("unused") 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(); insertAndAdd(points1); @SuppressWarnings("unused") RevCommit c3 = geogig.command(CommitOp.class) .setMessage("commit for modified " + idP1 + " again").call(); geogig.command(RevertOp.class).addCommit(c2.getId()).call(); }