private List<RevCommit> getCommitsAfterUntil() { Iterator<RevCommit> commitIterator = command(LogOp.class).setSince(until.getId()).call(); List<RevCommit> commits = Lists.newArrayList(commitIterator); Collections.reverse(commits); return commits; }
private List<RevCommit> getCommitsAfterUntil() { Iterator<RevCommit> commitIterator = command(LogOp.class).setSince(until.getId()).call(); List<RevCommit> commits = Lists.newArrayList(commitIterator); Collections.reverse(commits); return commits; }
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; }
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; }); }
@Test public void testEmptyRepo() throws Exception { Iterator<RevCommit> logs = logOp.call(); assertNotNull(logs); assertFalse(logs.hasNext()); }
@Test public void testConcurrentEdits() throws Exception { final int insertsPerTask = 20; List<Future<Integer>> insertResults = runInserts(writeThreadCount, insertsPerTask); for (Future<Integer> f : insertResults) { assertEquals(insertsPerTask, f.get().intValue()); } List<RevCommit> commits = copyOf(context.command(LogOp.class).call()); final int expectedCommitCount = initialCommitCount + insertsPerTask * writeThreadCount; assertEquals(expectedCommitCount, commits.size()); }
@Test public void testConcurrentEdits() throws Exception { final int insertsPerTask = 20; List<Future<Integer>> insertResults = runInserts(writeThreadCount, insertsPerTask); for (Future<Integer> f : insertResults) { assertEquals(insertsPerTask, f.get().intValue()); } List<RevCommit> commits = copyOf(context.command(LogOp.class).call()); final int expectedCommitCount = initialCommitCount + insertsPerTask * writeThreadCount; assertEquals(expectedCommitCount, commits.size()); }
@Test public void testEmptyRepo() throws Exception { Iterator<RevCommit> logs = logOp.call(); assertNotNull(logs); assertFalse(logs.hasNext()); }
@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 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 testHeadWithSingleCommit() throws Exception { insertAndAdd(points1); final RevCommit firstCommit = geogig.command(CommitOp.class).call(); Iterator<RevCommit> iterator = logOp.call(); assertNotNull(iterator); assertTrue(iterator.hasNext()); assertEquals(firstCommit, iterator.next()); assertFalse(iterator.hasNext()); }
@Test public void testHeadWithSingleCommit() throws Exception { insertAndAdd(points1); final RevCommit firstCommit = geogig.command(CommitOp.class).call(); Iterator<RevCommit> iterator = logOp.call(); assertNotNull(iterator); assertTrue(iterator.hasNext()); assertEquals(firstCommit, iterator.next()); assertFalse(iterator.hasNext()); }
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; }
private void verifyPrune() throws Exception { // Make sure the local repository got all of the commits from master localGeogig.geogig.command(CheckoutOp.class).setForce(true) .setSource("refs/remotes/origin/master").call(); Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call(); List<RevCommit> logged = Lists.newArrayList(logs); assertEquals(expectedMaster, logged); // Make sure the local repository no longer has Branch1 Optional<Ref> missing = localGeogig.geogig.command(RefParse.class) .setName("refs/remotes/origin/Branch1").call(); assertFalse(missing.isPresent()); }
private void verifyPrune() throws Exception { // Make sure the local repository got all of the commits from master localGeogig.geogig.command(CheckoutOp.class).setForce(true) .setSource("refs/remotes/origin/master").call(); Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call(); List<RevCommit> logged = Lists.newArrayList(logs); assertEquals(expectedMaster, logged); // Make sure the local repository no longer has Branch1 Optional<Ref> missing = localGeogig.geogig.command(RefParse.class) .setName("refs/remotes/origin/Branch1").call(); assertFalse(missing.isPresent()); }
private void verifyPrune() throws Exception { // Make sure the local repository got all of the commits from master localGeogig.geogig.command(CheckoutOp.class).setForce(true) .setSource("refs/remotes/origin/master").call(); Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call(); List<RevCommit> logged = Lists.newArrayList(logs); assertEquals(expectedMaster, logged); // Make sure the local repository no longer has Branch1 Optional<Ref> missing = localGeogig.geogig.command(RefParse.class) .setName("refs/remotes/origin/Branch1").call(); assertFalse(missing.isPresent()); }
private void verifyPrune() throws Exception { // Make sure the local repository got all of the commits from master localGeogig.geogig.command(CheckoutOp.class).setForce(true) .setSource("refs/remotes/origin/master").call(); Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call(); List<RevCommit> logged = Lists.newArrayList(logs); assertEquals(expectedMaster, logged); // Make sure the local repository no longer has Branch1 Optional<Ref> missing = localGeogig.geogig.command(RefParse.class) .setName("refs/remotes/origin/Branch1").call(); assertFalse(missing.isPresent()); }
private void verifyCancelledCleanly(RevCommit oldHeadCommit) { StatusSummary summary = geogig.command(StatusOp.class).call(); assertEquals(0, summary.getCountConflicts()); assertEquals(0, summary.getCountStaged()); assertEquals(0, summary.getCountUnstaged()); Iterator<RevCommit> log = geogig.command(LogOp.class).call(); assertTrue(log.hasNext()); assertEquals(oldHeadCommit, log.next()); }
private void verifyCancelledCleanly(RevCommit oldHeadCommit) { StatusSummary summary = geogig.command(StatusOp.class).call(); assertEquals(0, summary.getCountConflicts()); assertEquals(0, summary.getCountStaged()); assertEquals(0, summary.getCountUnstaged()); Iterator<RevCommit> log = geogig.command(LogOp.class).call(); assertTrue(log.hasNext()); assertEquals(oldHeadCommit, log.next()); }