private RevCommit callCommit() { final CommitOp commitOp = context.command(CommitOp.class).setAll(true) .setAuthor(authorName, authorEmail).setMessage(commitMessage); commitOp.setProgressListener(getProgressListener()); return commitOp.call(); }
private RevCommit callCommit() { final CommitOp commitOp = context.command(CommitOp.class).setAll(true) .setAuthor(authorName, authorEmail).setMessage(commitMessage); commitOp.setProgressListener(getProgressListener()); return commitOp.call(); }
private RevCommit createCommits(int numCommits, String branchName) { RevCommit commit = null; for (int i = 1; i <= numCommits; i++) { commit = geogig.command(CommitOp.class).setAllowEmpty(true) .setMessage("Commit " + i + " in branch " + branchName).call(); } return commit; }
@Test public void testFailingPostPostProcessHook() throws Exception { CharSequence postHookCode = "exception = Packages.org.locationtech.geogig.hooks.CannotRunGeogigOperationException;\n" + "throw new exception();"; File hooksFolder = new File(new ResolveGeogigDir(geogig.getPlatform()).getFile().get(), "hooks"); File commitPostHookFile = new File(hooksFolder, "post_commit.js"); Files.write(postHookCode, commitPostHookFile, Charsets.UTF_8); insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("A message").call(); }
@Test public void testObjectNotInIndex() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("Commit1").call(); Optional<RevFeatureType> featureType = geogig.command(ResolveFeatureType.class) .setRefSpec("WORK_HEAD:" + linesName).call(); assertFalse(featureType.isPresent()); }
@Test public void testResolveFeatureType() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("Commit1").call(); Optional<RevFeatureType> featureType = geogig.command(ResolveFeatureType.class) .setRefSpec(pointsName).call(); assertTrue(featureType.isPresent()); assertEquals(pointsName, featureType.get().getName().getLocalPart()); assertEquals(TYPE.FEATURETYPE, featureType.get().getType()); }
@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 testCreateBranch() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("Commit1").call(); geogig.command(BranchCreateOp.class).setName("branch1").setAutoCheckout(true).call(); Optional<Ref> branch1 = geogig.command(RefParse.class).setName("branch1").call(); assertTrue(branch1.isPresent()); Optional<Ref> master = geogig.command(RefParse.class).setName("master").call(); assertEquals(master.get().getObjectId(), branch1.get().getObjectId()); }
@Test public void testCheckoutPathFilter() throws Exception { ObjectId points1Id = insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); insert(points1_modified); CheckoutResult result = geogig.command(CheckoutOp.class).addPath("Points/Points.1").call(); Optional<RevTree> workTree = geogig.command(RevObjectParse.class) .setObjectId(result.getNewTree()).call(RevTree.class); Optional<NodeRef> nodeRef = geogig.command(FindTreeChild.class).setParent(workTree.get()) .setChildPath("Points/Points.1").call(); assertEquals(points1Id, nodeRef.get().getNode().getObjectId()); }
@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(SquashOp.class).setSince(c1).setUntil(c1).call(); }
@Test public void testCreateBranchFromNonExistentCommit() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("Commit1").call(); exception.expect(IllegalArgumentException.class); geogig.command(BranchCreateOp.class).setName("branch1").setAutoCheckout(true) .setSource("Nonexistent Commit").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 testUncleanIndex() throws Exception { insertAndAdd(points1); RevCommit c1 = geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); insertAndAdd(points2); exception.expect(IllegalStateException.class); geogig.command(SquashOp.class).setSince(c1).setUntil(c1).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(); }
@Override protected void setUpInternal() throws Exception { dataStore = new GeoGigDataStore(geogig.getRepository()); dataStore.createSchema(super.pointsType); dataStore.createSchema(super.linesType); insertAndAdd(points1, points2, points3, lines1, lines2, lines3); geogig.command(CommitOp.class).setAuthor("yo", "yo@test.com") .setCommitter("me", "me@test.com").setMessage("initial import").call(); pointsSource = (GeogigFeatureStore) dataStore.getFeatureSource(pointsName); linesSource = dataStore.getFeatureSource(linesName); }
@Test public void testCheckoutBranchWithChangesInTheWorkTree() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); geogig.command(BranchCreateOp.class).setName("branch1").call(); insert(points2); exception.expect(CheckoutException.class); geogig.command(CheckoutOp.class).setSource("branch1").call(); }
@Test public void testCreateBranchWithTheSameNameAsExistingBranch() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("Commit1").call(); geogig.command(BranchCreateOp.class).setName("branch1").setAutoCheckout(true).call(); exception.expect(IllegalArgumentException.class); geogig.command(BranchCreateOp.class).setName("branch1").call(); }
@Test public void testCheckoutBranchWithChangesInTheWorkTree() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("commit for " + idP1).call(); geogig.command(BranchCreateOp.class).setName("branch1").call(); insert(points2); exception.expect(CheckoutException.class); geogig.command(CheckoutOp.class).setSource("branch1").call(); }
@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(); }