@Override public IStatus runInWorkspace(IProgressMonitor monitor) { monitor.beginTask(UIText.SynchronizeFetchJob_TaskName, gsdSet.size()); for (GitSynchronizeData gsd : gsdSet) { Repository repo = gsd.getRepository(); StoredConfig repoConfig = repo.getConfig(); String remoteName = gsd.getDstRemoteName(); if (remoteName == null) continue; monitor.subTask(NLS.bind(UIText.SynchronizeFetchJob_SubTaskName, remoteName)); RemoteConfig config; try { config = new RemoteConfig(repoConfig, remoteName); } catch (URISyntaxException e) { Activator.logError(e.getMessage(), e); continue; } FetchOperationUI fetchOperationUI = new FetchOperationUI(repo, config, timeout, false); fetchOperationUI.setCredentialsProvider(new EGitCredentialsProvider()); SubMonitor subMonitor = SubMonitor.convert(monitor); try { fetchOperationUI.execute(subMonitor); gsd.updateRevs(); } catch (Exception e) { showInformationDialog(remoteName); Activator.logError(e.getMessage(), e); } monitor.worked(1); } monitor.done(); return Status.OK_STATUS; }
public void openSynchronization(String baseRef, String targetRef) throws IOException { GitSynchronizeData data = new GitSynchronizeData(repository, baseRef, targetRef, false); GitModelSynchronize.launch(data, data.getProjects().toArray(new IResource[0])); }