LogOp op = geogig.command(LogOp.class).setTopoOrder(args.topo) .setFirstParentOnly(args.firstParent); since = geogig.command(RevParse.class).setRefSpec(sinceRefSpec).call(); checkParameter(since.isPresent(), "Object not found '%s'", sinceRefSpec); op.setSince(since.get()); until = geogig.command(RevParse.class).setRefSpec(untilRefSpec).call(); checkParameter(until.isPresent(), "Object not found '%s'", sinceRefSpec); op.setUntil(until.get()); checkParameter(geogig.getRepository().commitExists(commitId.get()), "%s does not resolve to a commit", commit); op.addCommit(commitId.get()); op.setAuthor(args.author); op.setCommiter(args.committer); op.setSkip(args.skip.intValue()); op.setLimit(args.limit.intValue()); op.setTimeRange(new Range<Date>(Date.class, since, until)); op.addPath(s); Iterator<RevCommit> log = op.call(); console = cli.getConsole();
@Override protected Optional<RevCommit> _call() { Preconditions.checkState(date != null); long time = date.getTime(); Iterator<RevCommit> iter = command(LogOp.class).setFirstParentOnly(true).call(); while (iter.hasNext()) { RevCommit commit = iter.next(); if (commit.getCommitter().getTimestamp() < time) { return Optional.of(commit); } } return Optional.absent(); }
final Context geogig = this.getRepositoryContext(context); LogOp op = geogig.command(LogOp.class).setFirstParentOnly(firstParentOnly); op.setSkip(skip.intValue()); op.setLimit(limit.intValue()); geogig.command(ParseTimestamp.class).setString(this.untilTime).call()); op.setTimeRange(new Range<Date>(Date.class, since, until)); since = geogig.command(RevParse.class).setRefSpec(this.since).call(); Preconditions.checkArgument(since.isPresent(), "Object not found '%s'", this.since); op.setSince(since.get()); until = geogig.command(RevParse.class).setRefSpec(this.until).call(); Preconditions.checkArgument(until.isPresent(), "Object not found '%s'", this.until); op.setUntil(until.get()); op.addPath(path); final Iterator<RevCommit> log = op.call();
protected List<RevCommit> log(Repository repo) { return Lists.newArrayList(repo.command(LogOp.class).call()); } }
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);
Iterator<RevCommit> toSquash = command(LogOp.class).setSince(since.getParentIds().get(0)) .setUntil(until.getId()).setFirstParentOnly(true).call(); List<ObjectId> firstParents = Lists.newArrayList(); List<ObjectId> secondaryParents = Lists.newArrayList();
final Context geogig = this.getRepositoryContext(context); final List<FeatureTypeStats> stats = Lists.newArrayList(); LogOp logOp = geogig.command(LogOp.class).setFirstParentOnly(true); LsTreeOp lsTreeOp = geogig.command(LsTreeOp.class) .setStrategy(LsTreeOp.Strategy.TREES_ONLY); Date untilTime = new Date(); Date sinceTime = new Date(geogig.command(ParseTimestamp.class).setString(since).call()); logOp.setTimeRange(new Range<Date>(Date.class, sinceTime, untilTime)); 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); logOp.addPath(path); log = logOp.call();
.setTopoOrder(true)// .setUntil(wantCommit)// .setSince(haveCommit.isNull() ? null : haveCommit)// .call();
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; }
@Test public void testPathFilterByTypeName() throws Exception { List<Feature> features = Arrays.asList(points1, lines1, points2, lines2, points3, lines3); LinkedList<RevCommit> commits = Lists.newLinkedList(); LinkedList<RevCommit> typeName1Commits = Lists.newLinkedList(); for (Feature f : features) { insertAndAdd(f); final RevCommit commit = geogig.command(CommitOp.class) .setMessage(f.getIdentifier().toString()).call(); commits.addFirst(commit); if (pointsName.equals(f.getType().getName().getLocalPart())) { typeName1Commits.addFirst(commit); } } // path to filter commits on type1 String path = pointsName; List<RevCommit> logCommits = toList(logOp.addPath(path).call()); assertEquals(typeName1Commits.size(), logCommits.size()); assertEquals(typeName1Commits, logCommits); }
checkArgument(!entries.isEmpty(), "Not in a geogig repository with OSM data"); Iterator<RevCommit> log = command(LogOp.class).setFirstParentOnly(false).setTopoOrder(false) .call();
Iterator<RevCommit> iterator = logOp.addPath(pointsName + "/" + idP2).call(); assertNotNull(iterator); assertTrue(iterator.hasNext()); LogOp op = geogig.command(LogOp.class).addPath(pointsName + "/" + idP2) .setFirstParentOnly(true); iterator = op.call(); assertNotNull(iterator); assertTrue(iterator.hasNext());
Iterator<RevCommit> iterator = logOp.setTopoOrder(true).setSince(sinceCommit.getId()) .call();
op.addCommit(id); Iterator<RevCommit> commits = op.call(); sw.stop(); System.err.println("LogOp took " + sw.toString()); op = geogig.command(LogOp.class).setTopoOrder(true); for (ObjectId id : ids) { op.addCommit(id); commits = op.call(); sw.stop(); System.err.println("LogOp using --topo-order took " + sw.toString());
geogig.command(LogOp.class).setTopoOrder(true).call()); geogig.command(LogOp.class).setTopoOrder(false).call());
@Test public void testSkip() throws Exception { List<Feature> features = Arrays.asList(points1, lines1, points2, lines2, points3, lines3); for (Feature f : features) { insertAndAdd(f); geogig.command(CommitOp.class).call(); } logOp.setSkip(2).call(); exception.expect(IllegalArgumentException.class); logOp.setSkip(-1).call(); }
@Test public void testLimit() throws Exception { List<Feature> features = Arrays.asList(points1, lines1, points2, lines2, points3, lines3); for (Feature f : features) { insertAndAdd(f); geogig.command(CommitOp.class).call(); } assertEquals(3, Iterators.size(logOp.setLimit(3).call())); assertEquals(1, Iterators.size(logOp.setLimit(1).call())); assertEquals(4, Iterators.size(logOp.setLimit(4).call())); exception.expect(IllegalArgumentException.class); logOp.setLimit(-1).call(); }
Range<Date> commitRange = new Range<Date>(Date.class, new Date(2000), minInclusive, new Date(5000), maxInclusive); logOp.setTimeRange(commitRange); List<RevCommit> logged = toList(logOp.call()); List<RevCommit> expected = allCommits.subList(2, 4); assertEquals(expected, logged); commitRange = new Range<Date>(Date.class, new Date(2000), minInclusive, new Date(5000), maxInclusive); logOp = geogig.command(LogOp.class).setTimeRange(commitRange); logged = toList(logOp.call()); expected = allCommits.subList(1, 5); assertEquals(expected, logged); logOp = geogig.command(LogOp.class).setTimeRange(commitRange).setTimeRange(null); logged = toList(logOp.call()); expected = allCommits; assertEquals(expected, logged);