use of org.locationtech.geogig.api.porcelain.PullOp in project GeoGig by boundlessgeo.
the class SparseCloneTest method testPullCommitThatPassesFilter.
@Test
public void testPullCommitThatPassesFilter() throws Exception {
setupSparseClone();
// Add a commit that passes our filter to the remote.
ObjectId oId = insertAndAdd(remoteGeogig.geogig, city1_modified);
final RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).setMessage(city1_modified.getIdentifier().toString()).call();
Optional<RevObject> childObject = remoteGeogig.geogig.command(RevObjectParse.class).setObjectId(oId).call();
assertTrue(childObject.isPresent());
assertEquals(commit, remoteGeogig.geogig.getRepository().objectDatabase().getCommit(commit.getId()));
PullOp pull = pull();
pull.call();
Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call();
List<RevCommit> logged = new ArrayList<RevCommit>();
for (; logs.hasNext(); ) {
logged.add(logs.next());
}
assertEquals("Cities.1", logged.get(0).getMessage());
assertFalse(commit.getId().equals(logged.get(0).getId()));
assertExists(localGeogig, oId);
}
use of org.locationtech.geogig.api.porcelain.PullOp in project GeoGig by boundlessgeo.
the class PullOpTest method testPullRebase.
@Test
public void testPullRebase() throws Exception {
// Add a commit to the remote
insertAndAdd(remoteGeogig.geogig, lines3);
RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call();
expectedMaster.addFirst(commit);
// Pull the commit
PullOp pull = pull();
pull.setRebase(true).setAll(true).call();
Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call();
List<RevCommit> logged = new ArrayList<RevCommit>();
for (; logs.hasNext(); ) {
logged.add(logs.next());
}
assertEquals(expectedMaster, logged);
}
use of org.locationtech.geogig.api.porcelain.PullOp in project GeoGig by boundlessgeo.
the class PullOpTest method testPullRefspecs.
@Test
public void testPullRefspecs() throws Exception {
// Add a commit to the remote
insertAndAdd(remoteGeogig.geogig, lines3);
RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call();
expectedMaster.addFirst(commit);
// Pull the commit
PullOp pull = pull();
pull.addRefSpec("master:newbranch");
pull.setRebase(true).call();
final Optional<Ref> currHead = localGeogig.geogig.command(RefParse.class).setName(Ref.HEAD).call();
assertTrue(currHead.isPresent());
assertTrue(currHead.get() instanceof SymRef);
final SymRef headRef = (SymRef) currHead.get();
final String currentBranch = Ref.localName(headRef.getTarget());
assertEquals("newbranch", currentBranch);
Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call();
List<RevCommit> logged = new ArrayList<RevCommit>();
for (; logs.hasNext(); ) {
logged.add(logs.next());
}
assertEquals(expectedMaster, logged);
}
use of org.locationtech.geogig.api.porcelain.PullOp in project GeoGig by boundlessgeo.
the class PullOpTest method testPullToCurrentBranch.
@Test
public void testPullToCurrentBranch() throws Exception {
// Add a commit to the remote
insertAndAdd(remoteGeogig.geogig, lines3);
RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call();
expectedMaster.addFirst(commit);
// Make sure the local master matches the remote
localGeogig.geogig.command(BranchCreateOp.class).setName("mynewbranch").setAutoCheckout(true).call();
// Pull the commit
PullOp pull = pull();
pull.addRefSpec("master");
pull.setRebase(true).call();
final Optional<Ref> currHead = localGeogig.geogig.command(RefParse.class).setName(Ref.HEAD).call();
assertTrue(currHead.isPresent());
assertTrue(currHead.get() instanceof SymRef);
final SymRef headRef = (SymRef) currHead.get();
final String currentBranch = Ref.localName(headRef.getTarget());
assertEquals("mynewbranch", currentBranch);
Iterator<RevCommit> logs = localGeogig.geogig.command(LogOp.class).call();
List<RevCommit> logged = new ArrayList<RevCommit>();
for (; logs.hasNext(); ) {
logged.add(logs.next());
}
assertEquals(expectedMaster, logged);
}
use of org.locationtech.geogig.api.porcelain.PullOp in project GeoGig by boundlessgeo.
the class PullOpTest method testPullTooManyRefs.
@Test
public void testPullTooManyRefs() throws Exception {
// Add a commit to the remote
insertAndAdd(remoteGeogig.geogig, lines3);
RevCommit commit = remoteGeogig.geogig.command(CommitOp.class).call();
expectedMaster.addFirst(commit);
// Pull the commit
PullOp pull = pull();
pull.addRefSpec("master:newbranch:newbranch2");
exception.expect(IllegalArgumentException.class);
pull.setRebase(true).call();
}
Aggregations