Package org.locationtech.geogig.api.porcelain.MergeOp

Examples of org.locationtech.geogig.api.porcelain.MergeOp.MergeReport


            writeElement("Modified", Integer.toString(modified));
            writeElement("Removed", Integer.toString(removed));
        }
        if (result.getMergeReport().isPresent()
                && result.getMergeReport().get().getReport().isPresent()) {
            MergeReport report = result.getMergeReport().get();
            writeMergeResponse(Optional.fromNullable(report.getMergeCommit()), report.getReport()
                    .get(), geogig, report.getOurs(), report.getPairs().get(0).getTheirs(), report
                    .getPairs().get(0).getAncestor());
        }
        out.writeEndElement();
    }
View Full Code Here


        }

        assertEquals(expectedMaster, logged);

        // Merge branch1 into master
        MergeReport report = remoteGeogig.geogig.command(MergeOp.class)
                .addCommit(Suppliers.ofInstance(branch1commit.getId())).call();

        expectedMaster.addFirst(report.getMergeCommit());

        // Delete Branch1

        // Create and checkout branch1
        remoteGeogig.geogig.command(BranchDeleteOp.class).setName("Branch1").call();
View Full Code Here

            assertTrue(childObject.isPresent());
        }

        // Merge master into Branch1
        MergeOp merge = localGeogig.geogig.command(MergeOp.class);
        MergeReport report = merge.addCommit(Suppliers.ofInstance(masterCommit))
                .setMessage("Merge").call();

        // Update master to the new merge commit
        localGeogig.geogig.command(UpdateRef.class).setName("refs/heads/master")
                .setNewValue(report.getMergeCommit().getId()).call();

        // Checkout master
        localGeogig.geogig.command(CheckoutOp.class).setSource("master").call();

        PushOp push = push();
        push.addRefSpec("refs/heads/master").call();

        logs = remoteGeogig.geogig.command(LogOp.class).call();
        List<RevCommit> logged = new ArrayList<RevCommit>();
        for (; logs.hasNext();) {
            logged.add(logs.next());
        }

        assertEquals("Merge", logged.get(0).getMessage());
        assertFalse(report.getMergeCommit().getId().equals(logged.get(0).getId()));

        // Although we merged "Roads.2" commit into the "Roads.3" commit, making the "Roads.2"
        // commit the second parent, they should have been swapped when pushing to the full
        // repository to prevent any sparse data from being lost.
        ObjectId parent1Id = logged.get(0).getParentIds().get(0);
        ObjectId parent2Id = logged.get(0).getParentIds().get(1);

        RevCommit parent1 = remoteGeogig.geogig.getRepository().getCommit(parent1Id);
        assertNotNull(parent1);
        assertEquals("Roads.2", parent1.getMessage());
        RevCommit parent2 = remoteGeogig.geogig.getRepository().getCommit(parent2Id);
        assertNotNull(parent2);
        assertEquals("Roads.3", parent2.getMessage());

        // Verify they weren't swapped in the original
        parent1Id = report.getMergeCommit().getParentIds().get(0);
        parent2Id = report.getMergeCommit().getParentIds().get(1);

        parent1 = localGeogig.geogig.getRepository().getCommit(parent1Id);
        assertNotNull(parent1);
        assertEquals("Roads.3", parent1.getMessage());
        parent2 = localGeogig.geogig.getRepository().getCommit(parent2Id);
View Full Code Here

        // Checkout master
        localGeogig.geogig.command(CheckoutOp.class).setSource("master").call();

        // Merge Branch1 into master
        MergeOp merge = localGeogig.geogig.command(MergeOp.class);
        MergeReport report = merge.addCommit(Suppliers.ofInstance(expected.get(0).getId()))
                .setMessage("Merge").call();

        PushOp push = push();
        push.addRefSpec("refs/heads/master").call();

        logs = remoteGeogig.geogig.command(LogOp.class).call();
        List<RevCommit> logged = new ArrayList<RevCommit>();
        for (; logs.hasNext();) {
            logged.add(logs.next());
        }

        assertEquals("Merge", logged.get(0).getMessage());
        assertFalse(report.getMergeCommit().getId().equals(logged.get(0).getId()));

        // Because we merged Branch1 into the "sparse" master, we don't need to swap the parents, so
        // the history should look the same.
        ObjectId parent1Id = logged.get(0).getParentIds().get(0);
        ObjectId parent2Id = logged.get(0).getParentIds().get(1);

        RevCommit parent1 = remoteGeogig.geogig.getRepository().getCommit(parent1Id);
        assertNotNull(parent1);
        assertEquals("Roads.2", parent1.getMessage());
        RevCommit parent2 = remoteGeogig.geogig.getRepository().getCommit(parent2Id);
        assertNotNull(parent2);
        assertEquals("Roads.3", parent2.getMessage());

        // Verify they weren't swapped in the original
        parent1Id = report.getMergeCommit().getParentIds().get(0);
        parent2Id = report.getMergeCommit().getParentIds().get(1);

        parent1 = localGeogig.geogig.getRepository().getCommit(parent1Id);
        assertNotNull(parent1);
        assertEquals("Roads.2", parent1.getMessage());
        parent2 = localGeogig.geogig.getRepository().getCommit(parent2Id);
View Full Code Here

        // o | - Lines 1 added
        // |/
        // o - master - HEAD - Merge commit

        Ref branch1 = geogig.command(RefParse.class).setName("branch1").call().get();
        MergeReport mergeReport = geogig.command(MergeOp.class)
                .addCommit(Suppliers.ofInstance(branch1.getObjectId()))
                .setMessage("My merge message.").call();

        RevCommit mergeCommit = mergeReport.getMergeCommit();

        Iterator<RevCommit> iterator = logOp.call();
        assertNotNull(iterator);
        assertTrue(iterator.hasNext());
        assertEquals(mergeCommit, iterator.next());
View Full Code Here

        // o | - Lines 1 added
        // |/
        // o - master - HEAD - Merge commit

        Ref branch1 = geogig.command(RefParse.class).setName("branch1").call().get();
        MergeReport mergeReport = geogig.command(MergeOp.class)
                .addCommit(Suppliers.ofInstance(branch1.getObjectId()))
                .setMessage("My merge message.").call();

        RevCommit mergeCommit = mergeReport.getMergeCommit();

        Iterator<RevCommit> iterator = logOp.addPath(pointsName + "/" + idP2).call();
        assertNotNull(iterator);
        assertTrue(iterator.hasNext());
        assertEquals(mergeCommit, iterator.next());
View Full Code Here

        // checkout master
        geogig.command(CheckoutOp.class).setSource("master").call();
        insertAndAdd(lines2);
        geogig.command(CommitOp.class).setMessage("commit for " + idL2).call();

        final MergeReport mergeReport = geogig.command(MergeOp.class)
                .addCommit(Suppliers.ofInstance(left.getId())).call();

        Optional<ObjectId> commonAncestor = geogig.command(FindCommonAncestor.class)
                .setLeft(mergeReport.getMergeCommit()).setRight(branch2).call();

        assertTrue(commonAncestor.isPresent());
        assertEquals(commonAncestor.get(), ancestor.getId());

    }
View Full Code Here

        RevCommit branch3 = geogig.command(CommitOp.class).setMessage("commit for " + idPG1).call();
        geogig.command(CheckoutOp.class).setSource("branch2").call();
        insertAndAdd(poly2);
        geogig.command(CommitOp.class).setMessage("commit for " + idPG2).call();

        MergeReport mergeReport = geogig.command(MergeOp.class)
                .addCommit(Suppliers.ofInstance(branch3.getId())).call();

        RevCommit branch2 = mergeReport.getMergeCommit();

        geogig.command(CheckoutOp.class).setSource("branch1").call();
        insertAndAdd(lines3);
        final RevCommit left = geogig.command(CommitOp.class).setMessage("commit for " + idL3)
                .call();

        // checkout master
        geogig.command(CheckoutOp.class).setSource("master").call();
        insertAndAdd(lines2);
        geogig.command(CommitOp.class).setMessage("commit for " + idL2).call();

        mergeReport = geogig.command(MergeOp.class).addCommit(Suppliers.ofInstance(left.getId()))
                .call();

        Optional<ObjectId> commonAncestor = geogig.command(FindCommonAncestor.class)
                .setLeft(mergeReport.getMergeCommit()).setRight(branch2).call();

        assertTrue(commonAncestor.isPresent());
        assertEquals(commonAncestor.get(), ancestor.getId());

    }
View Full Code Here

        insertAndAdd(poly3);
        RevCommit commit10 = geogig.command(CommitOp.class).setMessage("commit10").call();

        // commit11
        geogig.command(CheckoutOp.class).setSource("master").call();
        MergeReport report = geogig.command(MergeOp.class).setMessage("commit11")
                .addCommit(Suppliers.ofInstance(commit9)).call();

        Optional<ObjectId> commonAncestor = geogig.command(FindCommonAncestor.class)
                .setLeft(report.getMergeCommit()).setRight(commit10).call();

        assertTrue(commonAncestor.isPresent());
        assertEquals(commonAncestor.get(), commit4);
    }
View Full Code Here

        // o | - Lines 1 added
        // |/
        // o - master - HEAD - Merge commit

        Ref branch1 = geogig.command(RefParse.class).setName("branch1").call().get();
        MergeReport mergeReport = geogig.command(MergeOp.class)
                .addCommit(Suppliers.ofInstance(branch1.getObjectId()))
                .setMessage("My merge message.").call();

        RevTree mergedTree = repo.getTree(mergeReport.getMergeCommit().getTreeId());

        String path = appendChild(pointsName, points2.getIdentifier().getID());
        assertTrue(repo.command(FindTreeChild.class).setParent(mergedTree).setChildPath(path)
                .call().isPresent());
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.porcelain.MergeOp.MergeReport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.