Example usage for org.eclipse.jgit.api SubmoduleSyncCommand call

List of usage examples for org.eclipse.jgit.api SubmoduleSyncCommand call

Introduction

In this page you can find the example usage for org.eclipse.jgit.api SubmoduleSyncCommand call.

Prototype

@Override
public Map<String, String> call() throws GitAPIException 

Source Link

Usage

From source file:org.eclipse.egit.core.op.SubmoduleSyncOperation.java

License:Open Source License

public void execute(final IProgressMonitor monitor) throws CoreException {
    IWorkspaceRunnable action = new IWorkspaceRunnable() {

        public void run(IProgressMonitor pm) throws CoreException {
            pm.beginTask("", 1); //$NON-NLS-1$
            Map<String, String> updates = null;
            try {
                SubmoduleSyncCommand sync = Git.wrap(repository).submoduleSync();
                for (String path : paths)
                    sync.addPath(path);//from ww  w .j a v a 2 s .c  o  m
                updates = sync.call();
            } catch (GitAPIException e) {
                throw new TeamException(e.getLocalizedMessage(), e.getCause());
            } finally {
                if (updates != null && !updates.isEmpty())
                    repository.notifyIndexChanged();
                pm.done();
            }
        }
    };
    ResourcesPlugin.getWorkspace().run(action, monitor != null ? monitor : new NullProgressMonitor());
}

From source file:org.eclipse.orion.server.git.servlets.GitSubmoduleHandlerV1.java

License:Open Source License

public static boolean syncSubmodules(Repository repo) throws GitAPIException {
    SubmoduleSyncCommand sync = new SubmoduleSyncCommand(repo);
    Map<String, String> synced = sync.call();
    SubmoduleStatusCommand status = new SubmoduleStatusCommand(repo);
    Map<String, SubmoduleStatus> statusResult = status.call();
    return synced.size() == statusResult.size();
}