Package org.locationtech.geogig.api.porcelain

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


    protected TransferSummary _call() {
        checkState(remote != null, "no remote specified");
        checkState(!refsToPush.isEmpty(), "no refs to push specified");

        final IRemoteRepo remoteRepo = openRemoteRepo(remote);
        TransferSummary transferResult;
        try {
            transferResult = callInternal(remoteRepo);
            checkState(transferResult != null);
        } finally {
            try {
View Full Code Here


        String localRefSpec;
        @Nullable
        String remoteRefSpec;
        boolean force;

        TransferSummary result = new TransferSummary();

        for (TransferableRef ref : this.refsToPush) {
            localRefSpec = ref.getLocalRef();
            remoteRefSpec = ref.getRemoteRef();
            force = ref.isForceUpdate();

            if (ref.isDelete()) {
                Optional<Ref> deleted = remoteRepo.deleteRef(remoteRefSpec);
                if (deleted.isPresent()) {
                    ChangedRef deleteResult = new ChangedRef(deleted.get(), null, REMOVED_REF);
                    result.add(remote.getPushURL(), deleteResult);
                }
            } else {
                Optional<Ref> localRef = refParse(localRefSpec);
                checkState(localRef.isPresent(), "RefSpec %s does not exist", localRefSpec);

                Optional<Ref> newRef = push(remoteRepo, remote, localRef.get(), remoteRefSpec);

                if (newRef.isPresent()) {
                    ChangeTypes changeType = remoteRefSpec == null ? ADDED_REF : CHANGED_REF;
                    ChangedRef deleteResult = new ChangedRef(localRef.get(), newRef.get(),
                            changeType);
                    result.add(remote.getPushURL(), deleteResult);
                }
            }
        }
        return result;
    }
View Full Code Here

                push.addRefSpec(args.get(i));
            }
        }
        try {
            // TODO: listen on progress?
            TransferSummary dataPushed = push.call();
            if (dataPushed.isEmpty()) {
                cli.getConsole().println("Nothing to push.");
            }
        } catch (SynchronizationException e) {
            switch (e.statusCode) {
            case REMOTE_HAS_CHANGES:
View Full Code Here

        if (depth > 0 || fulldepth) {
            checkParameter(cli.getGeogig().getRepository().getDepth().isPresent(),
                    "Depth operations can only be used on a shallow clone.");
        }

        TransferSummary result;
        try {
            FetchOp fetch = cli.getGeogig().command(FetchOp.class);
            fetch.setProgressListener(cli.getProgressListener());
            fetch.setAll(all).setPrune(prune).setFullDepth(fulldepth);
            fetch.setDepth(depth);

            if (args != null) {
                for (String repo : args) {
                    fetch.addRemote(repo);
                }
            }

            result = fetch.call();
        } catch (SynchronizationException e) {
            switch (e.statusCode) {
            case HISTORY_TOO_SHALLOW:
            default:
                throw new CommandFailedException("Unable to fetch, the remote history is shallow.",
                        e);
            }
        } catch (IllegalArgumentException iae) {
            throw new CommandFailedException(iae.getMessage(), iae);
        } catch (IllegalStateException ise) {
            throw new CommandFailedException(ise.getMessage(), ise);
        }

        ConsoleReader console = cli.getConsole();
        if (result.getChangedRefs().isEmpty()) {
            console.println("Already up to date.");
        } else {
            FetchResultPrinter.print(result, console);
        }
    }
View Full Code Here

        try {
            final PullResult result = pull.call();

            ConsoleReader console = cli.getConsole();
            TransferSummary fetchResult = result.getFetchResult();
            FetchResultPrinter.print(fetchResult, console);

            final Ref oldRef = result.getOldRef();
            final Ref newRef = result.getNewRef();
View Full Code Here

        if (refSpec != null) {
            command.addRefSpec(refSpec);
        }

        try {
            final TransferSummary dataPushed = command.setAll(pushAll).setRemote(remoteName).call();
            context.setResponseContent(new CommandResponse() {
                @Override
                public void write(ResponseWriter out) throws Exception {
                    out.start();
                    out.writeElement("Push", "Success");
                    out.writeElement("dataPushed", String.valueOf(!dataPushed.isEmpty()));
                    out.finish();
                }
            });
        } catch (SynchronizationException e) {
            switch (e.statusCode) {
View Full Code Here

        FetchOp command = geogig.command(FetchOp.class);

        command.addRemote(remote);

        try {
            final TransferSummary result = command.setAll(fetchAll).setPrune(prune).call();
            context.setResponseContent(new CommandResponse() {
                @Override
                public void write(ResponseWriter out) throws Exception {
                    out.start();
                    out.writeFetchResponse(result);
View Full Code Here

TOP

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

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.