use of org.locationtech.geogig.api.porcelain.FetchOp in project GeoGig by boundlessgeo.
the class FetchOpTest method testFetchNoChanges.
@Test
public void testFetchNoChanges() throws Exception {
prepareForFetch(true);
// fetch from the remote
FetchOp fetch = fetch();
fetch.addRemote("origin").setAll(true).call();
verifyFetch();
// fetch again
fetch.call();
verifyFetch();
}
use of org.locationtech.geogig.api.porcelain.FetchOp in project GeoGig by boundlessgeo.
the class FetchOpTest method testFetchNewCommitsWithShallowClone2.
@Test
public void testFetchNewCommitsWithShallowClone2() throws Exception {
insertAndAdd(remoteGeogig.geogig, points1);
RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).setMessage("1").call();
insertAndAdd(remoteGeogig.geogig, points2);
commit = remoteGeogig.geogig.command(CommitOp.class).setMessage("2").call();
insertAndAdd(remoteGeogig.geogig, points3);
commit = remoteGeogig.geogig.command(CommitOp.class).setMessage("3").call();
// 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, lines1);
commit = remoteGeogig.geogig.command(CommitOp.class).setMessage("4").call();
insertAndAdd(remoteGeogig.geogig, points1_modified);
commit = remoteGeogig.geogig.command(CommitOp.class).setMessage("5").call();
insertAndAdd(remoteGeogig.geogig, lines2);
commit = remoteGeogig.geogig.command(CommitOp.class).setMessage("6").call();
insertAndAdd(remoteGeogig.geogig, lines3);
commit = remoteGeogig.geogig.command(CommitOp.class).setMessage("7").call();
FetchOp fetch = fetch();
// fetch.setDepth(2);
fetch.call();
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);
// Should have the previous 2 commits, plus all 4 new commits.
assertEquals(6, logged.size());
}
use of org.locationtech.geogig.api.porcelain.FetchOp in project GeoGig by boundlessgeo.
the class FetchOpTest method testFetchWithPruneAndBranchAdded.
@Test
public void testFetchWithPruneAndBranchAdded() throws Exception {
prepareForFetch(true);
// fetch from the remote
FetchOp fetch = fetch();
fetch.addRemote("origin").setAll(true).call();
verifyFetch();
// Remove a branch from the remote
remoteGeogig.geogig.command(BranchDeleteOp.class).setName("Branch1").call();
// Add another branch
remoteGeogig.geogig.command(BranchCreateOp.class).setName("Branch2").call();
// fetch again
fetch = fetch();
fetch.setPrune(true).call();
verifyPrune();
// Make sure the local repository has Branch2
Optional<Ref> missing = localGeogig.geogig.command(RefParse.class).setName("refs/remotes/origin/Branch2").call();
assertTrue(missing.isPresent());
}
use of org.locationtech.geogig.api.porcelain.FetchOp in project GeoGig by boundlessgeo.
the class RemoteRepositoryTestCase method pull.
protected PullOp pull() {
PullOp pull = spy(localGeogig.geogig.command(PullOp.class));
FetchOp fetch = fetch();
// when(pull.command(eq(FetchOp.class))).thenReturn(fetch);
doReturn(fetch).when(pull).command(eq(FetchOp.class));
LsRemote lsRemote = lsremote();
// when(pull.command(eq(LsRemote.class))).thenReturn(lsRemote);
doReturn(lsRemote).when(pull).command(eq(LsRemote.class));
return pull;
}
use of org.locationtech.geogig.api.porcelain.FetchOp in project GeoGig by boundlessgeo.
the class RemoteRepositoryTestCase method fetch.
protected FetchOp fetch() {
FetchOp remoteRepoFetch = spy(localGeogig.geogig.command(FetchOp.class));
doReturn(Optional.of(remoteRepo)).when(remoteRepoFetch).getRemoteRepo(any(Remote.class), any(DeduplicationService.class));
LsRemote lsRemote = lsremote();
doReturn(lsRemote).when(remoteRepoFetch).command(eq(LsRemote.class));
return remoteRepoFetch;
}
Aggregations