Package org.locationtech.geogig.api.porcelain

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


            throw new CommandSpecException(
                    "No transaction was specified, checkout requires a transaction to preserve the stability of the repository.");
        }

        final Context geogig = this.getCommandLocator(context);
        CheckoutOp command = geogig.command(CheckoutOp.class);
        if (branchOrCommit != null) {
            Optional<Ref> head = geogig.command(RefParse.class).setName(Ref.HEAD).call();

            if (!head.isPresent()) {
                throw new CommandSpecException("Repository has no HEAD, can't merge.");
            }

            final String target = ((SymRef) head.get()).getTarget();
            command.setSource(branchOrCommit).call();
            context.setResponseContent(new CommandResponse() {
                @Override
                public void write(ResponseWriter out) throws Exception {
                    out.start();
                    out.writeElement("OldTarget", target);
                    out.writeElement("NewTarget", branchOrCommit);
                    out.finish();
                }
            });
        } else if (path != null) {
            command.addPath(path);
            if (ours && !theirs) {
                command.setOurs(ours);
            } else if (theirs && !ours) {
                command.setTheirs(theirs);
            } else {
                throw new CommandSpecException(
                        "Please specify either ours or theirs to update the feature path specified.");
            }
            command.call();
            context.setResponseContent(new CommandResponse() {
                @Override
                public void write(ResponseWriter out) throws Exception {
                    out.start();
                    out.writeElement("Path", path);
View Full Code Here

TOP

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

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.