use of org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet in project egit by eclipse.
the class PushAction method runPushOperation.
private void runPushOperation() {
GitSynchronizeDataSet gsds = (GitSynchronizeDataSet) getConfiguration().getProperty(SYNCHRONIZATION_DATA);
for (GitSynchronizeData gsd : gsds) {
String remoteName = gsd.getDstRemoteName();
if (remoteName == null)
continue;
RemoteConfig rc;
Repository repo = gsd.getRepository();
StoredConfig config = repo.getConfig();
try {
rc = new RemoteConfig(config, remoteName);
} catch (URISyntaxException e) {
Activator.logError("Unable to create RemoteConfiguration for remote: " + remoteName, // $NON-NLS-1$
e);
continue;
}
if (rc.getPushRefSpecs().isEmpty())
// $NON-NLS-1$
rc.addPushRefSpec(new RefSpec(HEAD + ":" + gsd.getDstMerge()));
PushOperationUI push = new PushOperationUI(repo, rc, false);
push.setCredentialsProvider(new EGitCredentialsProvider());
push.start();
}
}
use of org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet in project egit by eclipse.
the class GitContainerMapping method getTraversals.
@Override
public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException {
GitModelObject[] children = ((GitModelObjectContainer) getModelObject()).getChildren();
Set<ResourceTraversal> result = new LinkedHashSet<>();
final GitSynchronizeDataSet dataSet;
if (context instanceof GitSubscriberResourceMappingContext)
dataSet = ((GitSubscriberResourceMappingContext) context).getSyncData();
else
dataSet = null;
for (GitModelObject child : children) {
if (child.isContainer())
result.addAll(createTraversalForContainer(child, dataSet));
else
result.add(createTraversalForFile(child, dataSet));
}
return result.toArray(new ResourceTraversal[result.size()]);
}
use of org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet in project egit by eclipse.
the class GitScopeUtil method createScopeManager.
/**
* Creates a new {@link SubscriberScopeManager} for the given set of
* {@link IResource}s
*
* @param resources
* @param monitor
* @return {@link SubscriberScopeManager}
*/
private static SubscriberScopeManager createScopeManager(final IResource[] resources, IProgressMonitor monitor) {
ResourceMapping[] mappings = GitScopeUtil.getResourceMappings(resources);
GitSynchronizeDataSet set = new GitSynchronizeDataSet();
final GitResourceVariantTreeSubscriber subscriber = new GitResourceVariantTreeSubscriber(set);
monitor.setTaskName(UIText.GitModelSynchronize_fetchGitDataJobName);
subscriber.init(monitor);
SubscriberScopeManager manager = new SubscriberScopeManager(UIText.GitScopeOperation_GitScopeManager, mappings, subscriber, true);
return manager;
}
use of org.eclipse.egit.core.synchronize.dto.GitSynchronizeDataSet in project egit by eclipse.
the class SynchronizeWorkspaceActionHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IResource[] resources = getSelectedResources(event);
Map<Repository, Set<IResource>> containerMap = mapContainerResources(resources);
if (containerMap.isEmpty())
return null;
boolean launchFetch = Activator.getDefault().getPreferenceStore().getBoolean(UIPreferences.SYNC_VIEW_FETCH_BEFORE_LAUNCH);
GitSynchronizeDataSet gsdSet = new GitSynchronizeDataSet();
for (Entry<Repository, Set<IResource>> entry : containerMap.entrySet()) try {
Repository repo = entry.getKey();
String dstRef = getDstRef(repo, launchFetch);
GitSynchronizeData data = new GitSynchronizeData(repo, HEAD, dstRef, true);
Set<IResource> containers = entry.getValue();
if (!containers.isEmpty())
data.setIncludedResources(containers);
gsdSet.add(data);
} catch (IOException e) {
Activator.handleError(e.getMessage(), e, true);
}
GitModelSynchronize.launch(gsdSet, getSelectedResources(event));
return null;
}
Aggregations