Package org.locationtech.geogig.api.porcelain

Examples of org.locationtech.geogig.api.porcelain.RebaseOp


        checkParameter(!(skip && continueRebase), "Cannot use both --skip and --continue");
        checkParameter(!(skip && abort), "Cannot use both --skip and --abort");
        checkParameter(!(abort && continueRebase), "Cannot use both --abort and --continue");

        GeoGIG geogig = cli.getGeogig();
        RebaseOp rebase = geogig.command(RebaseOp.class).setSkip(skip).setContinue(continueRebase)
                .setAbort(abort).setSquashMessage(squash);
        rebase.setProgressListener(cli.getProgressListener());

        if (arguments == null || arguments.size() == 0) {
            if (abort || skip || continueRebase) {
            } else {
                // Rebase onto remote branch
                throw new UnsupportedOperationException("remote branch rebase not yet supported");
            }
        } else {
            checkParameter(arguments.size() < 3, "Too many arguments specified.");
            if (arguments.size() == 2) {
                // Make sure branch is valid
                Optional<ObjectId> branchRef = geogig.command(RevParse.class)
                        .setRefSpec(arguments.get(1)).call();
                checkParameter(branchRef.isPresent(), "The branch reference could not be resolved.");
                // Checkout <branch> prior to rebase
                try {
                    geogig.command(CheckoutOp.class).setSource(arguments.get(1)).call();
                } catch (CheckoutException e) {
                    throw new CommandFailedException(e.getMessage(), e);
                }

            }

            Optional<Ref> upstreamRef = geogig.command(RefParse.class).setName(arguments.get(0))
                    .call();
            checkParameter(upstreamRef.isPresent(), "The upstream reference could not be resolved.");
            rebase.setUpstream(Suppliers.ofInstance(upstreamRef.get().getObjectId()));
        }

        if (onto != null) {
            Optional<ObjectId> ontoId = geogig.command(RevParse.class).setRefSpec(onto).call();
            checkParameter(ontoId.isPresent(), "The onto reference could not be resolved.");
            rebase.setOnto(Suppliers.ofInstance(ontoId.get()));
        }

        try {
            rebase.call();
        } catch (RebaseConflictsException e) {
            StringBuilder sb = new StringBuilder();
            sb.append(e.getMessage() + "\n");
            sb.append("When you have fixed this conflicts, run 'geogig rebase --continue' to continue rebasing.\n");
            sb.append("If you would prefer to skip this commit, instead run 'geogig rebase --skip.\n");
View Full Code Here

TOP

Related Classes of org.locationtech.geogig.api.porcelain.RebaseOp

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.