Search in sources :

Example 21 with FetchOp

use of org.locationtech.geogig.api.porcelain.FetchOp in project GeoGig by boundlessgeo.

the class FetchOpTest method testFetchNewCommitsWithShallowClone.

@Test
public void testFetchNewCommitsWithShallowClone() throws Exception {
    prepareForFetch(false);
    // clone the repository
    CloneOp clone = clone();
    clone.setDepth(2);
    clone.setRepositoryURL(remoteGeogig.envHome.getCanonicalPath()).call();
    // Checkout master and commit some changes
    remoteGeogig.geogig.command(CheckoutOp.class).setSource("master").call();
    insertAndAdd(remoteGeogig.geogig, points1_modified);
    RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call();
    expectedMaster.addFirst(commit);
    FetchOp fetch = fetch();
    fetch.call();
    // Make sure the local repository got all of the commits from master
    localGeogig.geogig.command(CheckoutOp.class).setSource("refs/remotes/origin/master").call();
    Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call();
    List<RevCommit> logged = Lists.newArrayList(logs);
    assertEquals(3, logged.size());
    assertEquals(expectedMaster.get(0), logged.get(0));
    assertEquals(expectedMaster.get(1), logged.get(1));
    assertEquals(expectedMaster.get(2), logged.get(2));
}
Also used : CloneOp(org.locationtech.geogig.api.porcelain.CloneOp) FetchOp(org.locationtech.geogig.api.porcelain.FetchOp) LogOp(org.locationtech.geogig.api.porcelain.LogOp) CommitOp(org.locationtech.geogig.api.porcelain.CommitOp) RevCommit(org.locationtech.geogig.api.RevCommit) Test(org.junit.Test)

Aggregations

FetchOp (org.locationtech.geogig.api.porcelain.FetchOp)21 Test (org.junit.Test)15 CloneOp (org.locationtech.geogig.api.porcelain.CloneOp)6 RevCommit (org.locationtech.geogig.api.RevCommit)4 LsRemote (org.locationtech.geogig.api.plumbing.LsRemote)4 LogOp (org.locationtech.geogig.api.porcelain.LogOp)4 CommitOp (org.locationtech.geogig.api.porcelain.CommitOp)3 Remote (org.locationtech.geogig.api.Remote)2 SynchronizationException (org.locationtech.geogig.api.porcelain.SynchronizationException)2 TransferSummary (org.locationtech.geogig.api.porcelain.TransferSummary)2 ConsoleReader (jline.console.ConsoleReader)1 Context (org.locationtech.geogig.api.Context)1 Ref (org.locationtech.geogig.api.Ref)1 SendPack (org.locationtech.geogig.api.plumbing.SendPack)1 PullOp (org.locationtech.geogig.api.porcelain.PullOp)1 PushOp (org.locationtech.geogig.api.porcelain.PushOp)1 CommandFailedException (org.locationtech.geogig.cli.CommandFailedException)1 DeduplicationService (org.locationtech.geogig.storage.DeduplicationService)1 CommandContext (org.locationtech.geogig.web.api.CommandContext)1 CommandResponse (org.locationtech.geogig.web.api.CommandResponse)1