use of org.locationtech.geogig.api.porcelain.MergeConflictsException in project GeoGig by boundlessgeo.
the class AddOpTest method testAdditionFixesConflict.
@Test
public void testAdditionFixesConflict() throws Exception {
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000), "POINT(1 1)");
insertAndAdd(points1);
geogig.command(CommitOp.class).call();
geogig.command(BranchCreateOp.class).setName("TestBranch").call();
insertAndAdd(points1Modified);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("TestBranch").call();
insertAndAdd(points1ModifiedB);
insertAndAdd(points2);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("master").call();
Ref branch = geogig.command(RefParse.class).setName("TestBranch").call().get();
try {
geogig.command(MergeOp.class).addCommit(Suppliers.ofInstance(branch.getObjectId())).call();
fail();
} catch (MergeConflictsException e) {
assertTrue(true);
}
geogig.command(AddOp.class).call();
List<Conflict> conflicts = geogig.getRepository().stagingDatabase().getConflicts(null, null);
assertTrue(conflicts.isEmpty());
geogig.command(CommitOp.class).call();
Optional<Ref> ref = geogig.command(RefParse.class).setName(Ref.MERGE_HEAD).call();
assertFalse(ref.isPresent());
}
use of org.locationtech.geogig.api.porcelain.MergeConflictsException in project GeoGig by boundlessgeo.
the class ResetOpTest method testResetPathToHeadVersionFixesConflict.
@Test
public void testResetPathToHeadVersionFixesConflict() throws Exception {
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000), "POINT(1 1)");
insertAndAdd(points1);
geogig.command(CommitOp.class).call();
geogig.command(BranchCreateOp.class).setName("TestBranch").call();
insertAndAdd(points1Modified);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("TestBranch").call();
insertAndAdd(points1ModifiedB);
insertAndAdd(points2);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("master").call();
Ref branch = geogig.command(RefParse.class).setName("TestBranch").call().get();
try {
geogig.command(MergeOp.class).addCommit(Suppliers.ofInstance(branch.getObjectId())).call();
fail();
} catch (MergeConflictsException e) {
assertTrue(e.getMessage().contains("conflict"));
}
geogig.command(ResetOp.class).addPattern(pointsName + "/" + idP1).call();
List<Conflict> conflicts = geogig.getRepository().stagingDatabase().getConflicts(null, null);
assertTrue(conflicts.isEmpty());
}
use of org.locationtech.geogig.api.porcelain.MergeConflictsException in project GeoGig by boundlessgeo.
the class ResetOpTest method testResetPathFixesConflict.
@Test
public void testResetPathFixesConflict() throws Exception {
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000), "POINT(1 1)");
insertAndAdd(points1);
RevCommit resetCommit = geogig.command(CommitOp.class).call();
geogig.command(BranchCreateOp.class).setName("TestBranch").call();
insertAndAdd(points1Modified);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("TestBranch").call();
insertAndAdd(points1ModifiedB);
insertAndAdd(points2);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("master").call();
Ref branch = geogig.command(RefParse.class).setName("TestBranch").call().get();
try {
geogig.command(MergeOp.class).addCommit(Suppliers.ofInstance(branch.getObjectId())).call();
fail();
} catch (MergeConflictsException e) {
assertTrue(e.getMessage().contains("conflict"));
}
geogig.command(ResetOp.class).addPattern(pointsName + "/" + idP1).setCommit(Suppliers.ofInstance(resetCommit.getId())).call();
List<Conflict> conflicts = geogig.getRepository().stagingDatabase().getConflicts(null, null);
assertTrue(conflicts.isEmpty());
}
use of org.locationtech.geogig.api.porcelain.MergeConflictsException in project GeoGig by boundlessgeo.
the class AddOpTest method testInsertionAndAdditionFixesConflict.
@Test
public void testInsertionAndAdditionFixesConflict() throws Exception {
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000), "POINT(1 1)");
insertAndAdd(points1);
geogig.command(CommitOp.class).call();
geogig.command(BranchCreateOp.class).setName("TestBranch").call();
insertAndAdd(points1Modified);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("TestBranch").call();
insertAndAdd(points1ModifiedB);
insertAndAdd(points2);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("master").call();
Ref branch = geogig.command(RefParse.class).setName("TestBranch").call().get();
try {
geogig.command(MergeOp.class).addCommit(Suppliers.ofInstance(branch.getObjectId())).call();
fail();
} catch (MergeConflictsException e) {
assertTrue(e.getMessage().contains("conflict"));
}
insert(points1);
geogig.command(AddOp.class).call();
List<Conflict> conflicts = geogig.getRepository().stagingDatabase().getConflicts(null, null);
assertTrue(conflicts.isEmpty());
geogig.command(CommitOp.class).call();
Optional<Ref> ref = geogig.command(RefParse.class).setName(Ref.MERGE_HEAD).call();
assertFalse(ref.isPresent());
}
use of org.locationtech.geogig.api.porcelain.MergeConflictsException in project GeoGig by boundlessgeo.
the class ResetOpTest method testResetFixesConflict.
@Test
public void testResetFixesConflict() throws Exception {
Feature points1Modified = feature(pointsType, idP1, "StringProp1_2", new Integer(1000), "POINT(1 1)");
Feature points1ModifiedB = feature(pointsType, idP1, "StringProp1_3", new Integer(2000), "POINT(1 1)");
insertAndAdd(points1);
RevCommit resetCommit = geogig.command(CommitOp.class).call();
geogig.command(BranchCreateOp.class).setName("TestBranch").call();
insertAndAdd(points1Modified);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("TestBranch").call();
insertAndAdd(points1ModifiedB);
insertAndAdd(points2);
geogig.command(CommitOp.class).call();
geogig.command(CheckoutOp.class).setSource("master").call();
Ref branch = geogig.command(RefParse.class).setName("TestBranch").call().get();
try {
geogig.command(MergeOp.class).addCommit(Suppliers.ofInstance(branch.getObjectId())).call();
fail();
} catch (MergeConflictsException e) {
assertTrue(e.getMessage().contains("conflict"));
}
geogig.command(ResetOp.class).setMode(ResetMode.HARD).setCommit(Suppliers.ofInstance(resetCommit.getId())).call();
List<Conflict> conflicts = geogig.getRepository().stagingDatabase().getConflicts(null, null);
assertTrue(conflicts.isEmpty());
Optional<Ref> ref = geogig.command(RefParse.class).setName(Ref.MERGE_HEAD).call();
assertFalse(ref.isPresent());
}
Aggregations