/** * Constructs a new {@code LinearHistoryIterator} with the given parameters. * * @param tip the first commit in the history * @param repo the repository where the commits are stored. */ @SuppressWarnings("unchecked") public LinearHistoryIterator(final ObjectId tip, final Repository repo) { this.nextCommitId = (Optional<ObjectId>) (tip.isNull() ? Optional.absent() : Optional.of(tip)); this.repo = repo; }
/** * Constructs a new {@code LinearHistoryIterator} with the given parameters. * * @param tip the first commit in the history * @param repo the repository where the commits are stored. */ @SuppressWarnings("unchecked") public LinearHistoryIterator(final ObjectId tip, final Repository repo) { this.nextCommitId = (Optional<ObjectId>) (tip.isNull() ? Optional.absent() : Optional.of(tip)); this.repo = repo; }
RefRequest(String name, ObjectId want, @Nullable ObjectId have) { checkNotNull(name); checkNotNull(want); checkArgument(!want.isNull(), "Do not request refs pointing to the NULl id"); this.name = name; this.want = want; this.have = Optional.fromNullable(have); }
@Override public boolean apply(NodeRef input) { ObjectId metadataId = input.getMetadataId(); return !metadataId.isNull(); } });
private BaseNode(final String name, final ObjectId oid, final ObjectId metadataId, @Nullable Envelope bounds, @Nullable Map<String, Object> extraData) { checkNotNull(name); checkNotNull(oid); checkNotNull(metadataId); this.name = name; this.objectId = oid; this.metadataId = metadataId.isNull() ? null : metadataId; this.extraData = ExtraData.of(extraData); this.bounds = Float32Bounds.valueOf(bounds); }
public @Override Optional<ObjectId> getMetadataId() { final SHA mdid = tree.nodesMetadataIds(nodeIndex); ObjectId id = ObjectId.NULL; if (mdid != null) { id = FBAdapters.toId(mdid); } if (id.isNull()) { return Optional.absent(); } return Optional.of(id); }
/** * @param branchRef * @return */ private Optional<RevCommit> findCommit(GeoGIG geogig, Ref branchRef) { ObjectId commitId = branchRef.getObjectId(); if (commitId.isNull()) { return Optional.absent(); } RevCommit commit = geogig.getRepository().getCommit(commitId); return Optional.of(commit); }
/** * Determines if the provided object exists in the repository. * * @param objectId the object to look for * @return true if the object existed, false otherwise */ @Override public boolean objectExists(ObjectId objectId) { return objectId.isNull() || localRepository.objectDatabase().exists(objectId); }
private long sizeOfTree(ObjectId treeId) { if (treeId.isNull()) { return 0L; } RevTree tree = loadTree(treeId); return tree.size(); }
public static RefRequest want(Ref want, @Nullable ObjectId have) { checkNotNull(want); checkArgument(!want.getObjectId().isNull(), "Do not request refs pointing to the NULl id: %s", want); return new RefRequest(want.getName(), want.getObjectId(), have); }
@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(); } };
public boolean remove(Node node) { if (!node.getObjectId().isNull()) { node = node.update(ObjectId.NULL); } int delta = put(node); return -1 == delta; }
public Name getDescriptorName(NodeRef treeRef) { Preconditions.checkNotNull(treeRef); Preconditions.checkArgument(TYPE.TREE.equals(treeRef.getType())); Preconditions.checkArgument(!treeRef.getMetadataId().isNull(), "NodeRef '%s' is not a feature type reference", treeRef.path()); return new NameImpl(getNamespaceURI(), NodeRef.nodeFromPath(treeRef.path())); }
public @Override boolean put(final RevObject object) { checkNotNull(object, "argument object is null"); checkArgument(!object.getId().isNull(), "ObjectId is NULL"); checkState(isOpen(), "db is closed"); ObjectId id = object.getId(); RevObject existing = objects.putIfAbsent(id, object); return null == existing; }
public @Override boolean put(final RevObject object) { checkNotNull(object, "argument object is null"); checkArgument(!object.getId().isNull(), "ObjectId is NULL"); checkState(isOpen(), "db is closed"); ObjectId id = object.getId(); RevObject existing = objects.putIfAbsent(id, object); return null == existing; }
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 long sizeOfTree(ObjectId treeId) { if (treeId.isNull()) { return 0L; } RevTree tree = loadTree(treeId); return tree.size(); }
@Test public void testPathListing() { Iterator<NodeRef> iter = geogig.command(LsTreeOp.class).setReference("Points").call(); List<NodeRef> nodes = ImmutableList.copyOf(iter); assertEquals(3, nodes.size()); for (NodeRef ref : nodes) { ObjectId metadataId = ref.getMetadataId(); assertFalse(metadataId.isNull()); } }
@Test public void testRefAndPathListing() { Iterator<NodeRef> iter = geogig.command(LsTreeOp.class).setReference("HEAD:Points").call(); List<NodeRef> nodes = ImmutableList.copyOf(iter); assertEquals(3, nodes.size()); for (NodeRef ref : nodes) { ObjectId metadataId = ref.getMetadataId(); assertFalse(metadataId.isNull()); } }
@Test public void testRefAndPathListing() { Iterator<NodeRef> iter = geogig.command(LsTreeOp.class).setReference("HEAD:Points").call(); List<NodeRef> nodes = ImmutableList.copyOf(iter); assertEquals(3, nodes.size()); for (NodeRef ref : nodes) { ObjectId metadataId = ref.getMetadataId(); assertFalse(metadataId.isNull()); } }