/** * @return the resolved object id * @throws IllegalArgumentException if the provided refspec doesn't resolve to any known object * @see RevObject */ @Override protected Optional<RevObject> _call() throws IllegalArgumentException { return call(RevObject.class); }
/** * @return the resolved object id * @throws IllegalArgumentException if the provided refspec doesn't resolve to any known object * @see RevObject */ @Override protected Optional<RevObject> _call() throws IllegalArgumentException { return call(RevObject.class); }
/** * @param treeId the tree to retrieve * @return the {@link RevTree} referred to by the given {@link ObjectId} */ @Override public RevTree getTree(ObjectId treeId) { return command(RevObjectParse.class).setObjectId(treeId).call(RevTree.class).get(); }
/** * @param treeId the tree to retrieve * @return the {@link RevTree} referred to by the given {@link ObjectId} */ @Override public RevTree getTree(ObjectId treeId) { return command(RevObjectParse.class).setObjectId(treeId).call(RevTree.class).get(); }
/** * Retrieves an object with the specified id from the remote. * * @param objectId the object to get * @return the fetched object */ @Override protected Optional<RevObject> getObject(ObjectId objectId) { return remoteRepo.command(RevObjectParse.class).setObjectId(objectId).call(); }
/** * @return the tree referenced by the old ref, or the head of the index. */ private RevTree getOldTree() { final String oldVersion = Optional.fromNullable(refSpec).or(Ref.STAGE_HEAD); Optional<ObjectId> headTreeId = command(ResolveTreeish.class).setTreeish(oldVersion).call(); Preconditions.checkArgument(headTreeId.isPresent(), "Refspec " + oldVersion + " does not resolve to a tree"); final RevTree headTree; headTree = command(RevObjectParse.class).setObjectId(headTreeId.get()).call(RevTree.class) .get(); return headTree; }
/** * Retrieves an object with the specified id from the remote. * * @param objectId the object to get * @return the fetched object */ @Override protected Optional<RevObject> getObject(ObjectId objectId) { return remoteRepo.command(RevObjectParse.class).setObjectId(objectId).call(); }
/** * @return */ RevTree getTypeTree() { String refSpec = getRootRef() + ":" + getTypeTreePath(); Context commandLocator = getCommandLocator(); Optional<RevTree> ref = commandLocator.command(RevObjectParse.class).setRefSpec(refSpec) .call(RevTree.class); Preconditions.checkState(ref.isPresent(), "Ref %s not found on working tree", refSpec); return ref.get(); }
/** * @return */ RevTree getTypeTree() { String refSpec = getRootRef() + ":" + getTypeTreePath(); Context commandLocator = getCommandLocator(); Optional<RevTree> ref = commandLocator.command(RevObjectParse.class).setRefSpec(refSpec) .call(RevTree.class); Preconditions.checkState(ref.isPresent(), "Ref %s not found on working tree", refSpec); return ref.get(); }
@Override public RevTree get() { Optional<ObjectId> head = command(ResolveTreeish.class).setTreeish(Ref.HEAD).call(); if (!head.isPresent() || head.get().isNull()) { return RevTree.EMPTY; } return command(RevObjectParse.class).setObjectId(head.get()).call(RevTree.class) .get(); } };
@Override public RevTree get() { Optional<ObjectId> head = command(ResolveTreeish.class).setTreeish(Ref.HEAD).call(); if (!head.isPresent() || head.get().isNull()) { return RevTree.EMPTY; } return command(RevObjectParse.class).setObjectId(head.get()).call(RevTree.class) .get(); } };
private void printObject(String name, ObjectId id, Console console, GeoGIG geogig) throws IOException { console.println(name + "\t" + id.toString()); if (!id.isNull()) { Optional<RevObject> obj = geogig.command(RevObjectParse.class).setObjectId(id).call(); CharSequence s = geogig.command(CatObject.class) .setObject(Suppliers.ofInstance(obj.get())).call(); console.println(s); } }
private void printObject(String name, ObjectId id, Console console, GeoGIG geogig) throws IOException { console.println(name + "\t" + id.toString()); if (!id.isNull()) { Optional<RevObject> obj = geogig.command(RevObjectParse.class).setObjectId(id).call(); CharSequence s = geogig.command(CatObject.class) .setObject(Suppliers.ofInstance(obj.get())).call(); console.println(s); } }
@Override public RevTree get() { if (treeId.isNull()) { return RevTree.EMPTY; } return geogig.command(RevObjectParse.class).setObjectId(treeId).call(RevTree.class) .get(); } };
@Override public RevTree get() { if (treeId.isNull()) { return RevTree.EMPTY; } return geogig.command(RevObjectParse.class).setObjectId(treeId).call(RevTree.class) .get(); } };
@Test public void testImportWithFid() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); importOp.setTable("table3"); importOp.setDestinationPath("table3"); importOp.setFidAttribute("number"); importOp.call(); Optional<RevFeature> feature = geogig.command(RevObjectParse.class) .setRefSpec("WORK_HEAD:table3/1000").call(RevFeature.class); assertTrue(feature.isPresent()); }
@Test public void testImportTableWithNoFeatures() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); importOp.setAll(false); importOp.setTable("table4"); importOp.call(); geogig.command(AddOp.class).call(); Optional<RevObject> ft = geogig.command(RevObjectParse.class).setRefSpec("WORK_HEAD:table4") .call(); assertTrue(ft.isPresent()); }
@Test public void testTagCreation() throws Exception { insertAndAdd(points1); RevCommit commit = geogig.command(CommitOp.class).call(); RevTag tag = geogig.command(TagCreateOp.class).setCommitId(commit.getId()).setName("Tag1") .call(); Optional<RevTag> databaseTag = geogig.command(RevObjectParse.class).setRefSpec("Tag1") .call(RevTag.class); assertTrue(databaseTag.isPresent()); assertEquals(tag, databaseTag.get()); }
@Test public void testImportTableWithNoFeatures() throws Exception { ImportOp importOp = geogig.command(ImportOp.class); importOp.setDataStore(TestHelper.createTestFactory().createDataStore(ImmutableMap.of())); importOp.setAll(false); importOp.setTable("table4"); importOp.call(); geogig.command(AddOp.class).call(); Optional<RevObject> ft = geogig.command(RevObjectParse.class).setRefSpec("WORK_HEAD:table4") .call(); assertTrue(ft.isPresent()); }
@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()); }