private int depthTo(ObjectId tip, ObjectId ca) { Iterator<RevCommit> commits = command(LogOp.class)// .setSince(ca)// .setUntil(tip)// .call(); int depth = Iterators.size(commits); return depth; }
static CompletableFuture<Integer> countMissingCommits(Ref oldTip, Ref newTip, Context context) { if (oldTip.getObjectId().equals(newTip.getObjectId())) { return CompletableFuture.completedFuture(Integer.valueOf(0)); } return CompletableFuture.supplyAsync(() -> { Iterator<RevCommit> missingCommits = context.command(LogOp.class) .setUntil(newTip.getObjectId()).setSince(oldTip.getObjectId()).call(); int commitsBehind = Iterators.size(missingCommits); return commitsBehind; }); }
private int depthTo(ObjectId tip, ObjectId ca) { Iterator<RevCommit> commits = command(LogOp.class)// .setSince(ca)// .setUntil(tip)// .call(); int depth = Iterators.size(commits); return depth; }
ObjectId commitId = ref.getObjectId(); Iterator<RevCommit> commits = commitId.isNull() ? Collections.emptyIterator() : repo.command(LogOp.class).setUntil(commitId).call(); Spliterator<RevCommit> spliterator = Spliterators.spliteratorUnknownSize(commits, Spliterator.DISTINCT | Spliterator.IMMUTABLE | Spliterator.NONNULL);
/** * Executes the {@code RebuildGraphOp} operation. * * @return a list of {@link ObjectId}s that were found to be missing or incomplete */ @Override protected ImmutableList<ObjectId> _call() { Repository repository = repository(); Preconditions.checkState(!repository.isSparse(), "Cannot rebuild the graph of a sparse repository."); List<ObjectId> updated = new LinkedList<ObjectId>(); ImmutableList<Ref> branches = command(BranchListOp.class).setLocal(true).setRemotes(true) .call(); GraphDatabase graphDb = repository.graphDatabase(); for (Ref ref : branches) { Iterator<RevCommit> commits = command(LogOp.class).setUntil(ref.getObjectId()).call(); while (commits.hasNext()) { RevCommit next = commits.next(); if (graphDb.put(next.getId(), next.getParentIds())) { updated.add(next.getId()); } } } return ImmutableList.copyOf(updated); } }
/** * Executes the {@code RebuildGraphOp} operation. * * @return a list of {@link ObjectId}s that were found to be missing or incomplete */ @Override protected ImmutableList<ObjectId> _call() { Repository repository = repository(); Preconditions.checkState(!repository.isSparse(), "Cannot rebuild the graph of a sparse repository."); List<ObjectId> updated = new LinkedList<ObjectId>(); ImmutableList<Ref> branches = command(BranchListOp.class).setLocal(true).setRemotes(true) .call(); GraphDatabase graphDb = repository.graphDatabase(); for (Ref ref : branches) { Iterator<RevCommit> commits = command(LogOp.class).setUntil(ref.getObjectId()).call(); while (commits.hasNext()) { RevCommit next = commits.next(); if (graphDb.put(next.getId(), next.getParentIds())) { updated.add(next.getId()); } } } return ImmutableList.copyOf(updated); } }
until = geogig.command(RevParse.class).setRefSpec(untilRefSpec).call(); checkParameter(until.isPresent(), "Object not found '%s'", sinceRefSpec); op.setUntil(until.get());
until = geogig.command(RevParse.class).setRefSpec(untilRefSpec).call(); checkParameter(until.isPresent(), "Object not found '%s'", sinceRefSpec); op.setUntil(until.get());
until = geogig.command(RevParse.class).setRefSpec(untilRefSpec).call(); checkParameter(until.isPresent(), "Object not found '%s'", sinceRefSpec); op.setUntil(until.get());
/** * Builds an index on every reachable commit in the history. * * @param index the {@link IndexInfo} to use * @return the number of trees that were built */ private int indexHistory(IndexInfo index) { ImmutableList<Ref> branches = command(BranchListOp.class).setLocal(true).setRemotes(true) .call(); int builtTrees = 0; ProgressListener listener = getProgressListener(); for (Ref ref : branches) { if (listener.isCanceled()) { break; } Iterator<RevCommit> commits = command(LogOp.class).setUntil(ref.getObjectId()).call(); while (commits.hasNext()) { if (listener.isCanceled()) { break; } RevCommit next = commits.next(); if (indexCommit(index, next)) { builtTrees++; } } } return builtTrees; }
until = geogig.command(RevParse.class).setRefSpec(this.until).call(); Preconditions.checkArgument(until.isPresent(), "Object not found '%s'", this.until); logOp.setUntil(until.get()); lsTreeOp.setReference(this.until);
public Iterator<RevCommit> log(String refSpec) { ObjectId tip = getContext().command(RevParse.class).setRefSpec(refSpec).call().get(); Iterator<RevCommit> iterator = getContext().command(LogOp.class).setUntil(tip).call(); return iterator; }
.setUntil(wantCommit)//
.setUntil(wantCommit)//
Iterator<RevCommit> log = command(LogOp.class).addPath(path).setUntil(commit).call(); RevCommit commit = log.next(); RevObjectParse revObjectParse = command(RevObjectParse.class);
private static Set<IndexTreeMapping> getIndexMappings(IndexInfo indexInfo, Repository repo, Optional<String> ref) { if (!ref.isPresent()) { return Sets.newHashSet(repo.indexDatabase().resolveIndexedTrees(indexInfo)); } Set<IndexTreeMapping> mappings = new HashSet<>(); List<Ref> branches = getBranches(repo, ref); for (Ref branch : branches) { List<RevCommit> commits = Lists.newArrayList(repo.command(LogOp.class) .addPath(indexInfo.getTreeName()).setUntil(branch.getObjectId()).call()); for (RevCommit c : commits) { String treeRef = String.format("%s:%s", c.getId(), indexInfo.getTreeName()); ObjectId canonicalTreeId = repo.command(RevParse.class).setRefSpec(treeRef).call() .get(); Optional<ObjectId> indexedTree = repo.indexDatabase().resolveIndexedTree(indexInfo, canonicalTreeId); String msg = String.format("Expected index at %s:%s", branch.getName(), indexInfo.getTreeName()); assertTrue(msg, indexedTree.isPresent()); mappings.add(new IndexTreeMapping(canonicalTreeId, indexedTree.get())); } } return mappings; }
Iterator<RevCommit> log = command(LogOp.class).addPath(path).setUntil(commit).call(); RevCommit commit = log.next(); RevObjectParse revObjectParse = command(RevObjectParse.class);
/** * Builds an index on every reachable commit in the history. * * @param index the {@link IndexInfo} to use * @return the number of trees that were built */ private int indexHistory(IndexInfo index) { ImmutableList<Ref> branches = command(BranchListOp.class).setLocal(true).setRemotes(true) .call(); int builtTrees = 0; ProgressListener listener = getProgressListener(); for (Ref ref : branches) { if (listener.isCanceled()) { break; } getProgressListener().setDescription("Building index for %s:%s at %s", index.getTreeName(), index.getAttributeName(), ref.getName()); Iterator<RevCommit> commits = command(LogOp.class).setUntil(ref.getObjectId()).call(); while (commits.hasNext()) { if (listener.isCanceled()) { break; } RevCommit next = commits.next(); if (indexCommit(index, next)) { builtTrees++; } } } return builtTrees; }
logOp.setSince(null).setUntil(oid2_2).call(); fail("Expected ISE as until is not a commit"); } catch (IllegalArgumentException e) { logs = toList(logOp.setSince(commit1_2.getId()).setUntil(null).call()); expected = Arrays.asList(commit2_2, commit2_1); assertEquals(expected, logs); logs = toList(logOp.setSince(commit2_2.getId()).setUntil(null).call()); expected = Collections.emptyList(); assertEquals(expected, logs); logs = toList(logOp.setSince(commit1_2.getId()).setUntil(commit2_1.getId()).call()); expected = Arrays.asList(commit2_1); assertEquals(expected, logs); logs = toList(logOp.setSince(null).setUntil(commit2_1.getId()).call()); expected = Arrays.asList(commit2_1, commit1_2, commit1_1); assertEquals(expected, logs);
logOp.setSince(null).setUntil(oid2_2).call(); fail("Expected ISE as until is not a commit"); } catch (IllegalArgumentException e) { logs = toList(logOp.setSince(commit1_2.getId()).setUntil(null).call()); expected = Arrays.asList(commit2_2, commit2_1); assertEquals(expected, logs); logs = toList(logOp.setSince(commit2_2.getId()).setUntil(null).call()); expected = Collections.emptyList(); assertEquals(expected, logs); logs = toList(logOp.setSince(commit1_2.getId()).setUntil(commit2_1.getId()).call()); expected = Arrays.asList(commit2_1); assertEquals(expected, logs); logs = toList(logOp.setSince(null).setUntil(commit2_1.getId()).call()); expected = Arrays.asList(commit2_1, commit1_2, commit1_1); assertEquals(expected, logs);