use of org.tigris.subversion.subclipse.core.commands.UpdateResourcesCommand in project subclipse by subclipse.
the class UpdateSynchronizeOperation method doUpdate.
private void doUpdate(SVNTeamProvider provider, IProgressMonitor monitor, IResource[] resourceArray, SVNRevision revision) {
try {
SVNWorkspaceSubscriber.getInstance().updateRemote(resourceArray);
if (changeSetSelected) {
List<IResource> existingResources = new ArrayList<IResource>();
for (IResource resource : resourceArray) {
if (resource.exists()) {
existingResources.add(resource);
} else {
UpdateResourcesCommand command = new UpdateResourcesCommand(provider.getSVNWorkspaceRoot(), new IResource[] { resource }, revision);
command.setConflictResolver(new SVNConflictResolver());
command.run(Policy.subMonitorFor(monitor, 100));
}
}
if (!existingResources.isEmpty()) {
IResource[] existingResourceArray = new IResource[existingResources.size()];
existingResources.toArray(existingResourceArray);
UpdateResourcesCommand command = new UpdateResourcesCommand(provider.getSVNWorkspaceRoot(), existingResourceArray, revision);
command.setDepth(Depth.empty);
command.setSetDepth(false);
command.setConflictResolver(new SVNConflictResolver());
command.run(Policy.subMonitorFor(monitor, 100));
}
} else {
UpdateResourcesCommand command = new UpdateResourcesCommand(provider.getSVNWorkspaceRoot(), resourceArray, revision);
command.setConflictResolver(new SVNConflictResolver());
command.run(Policy.subMonitorFor(monitor, 100));
}
} catch (SVNException e) {
if (!e.operationInterrupted()) {
collectStatus(e.getStatus());
}
} catch (TeamException e) {
collectStatus(e.getStatus());
} finally {
monitor.done();
}
}
use of org.tigris.subversion.subclipse.core.commands.UpdateResourcesCommand in project subclipse by subclipse.
the class OverrideAndUpdateSynchronizeOperation method run.
protected void run(SVNTeamProvider provider, SyncInfoSet set, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
if (!revertAndUpdate)
return;
if (!prompted) {
getShell().getDisplay().syncExec(new Runnable() {
public void run() {
revertAndUpdate = MessageDialog.openQuestion(getShell(), Policy.bind("SyncAction.override.title"), // $NON-NLS-1$ //$NON-NLS-2$
Policy.bind("SyncAction.override.confirm"));
}
});
prompted = true;
}
if (!revertAndUpdate)
return;
IResource[] modifiedResourceArray = extractResources(modifiedResources, set);
IResource[] resourceArray = extractResources(resources, set);
if (modifiedResourceArray != null && modifiedResourceArray.length > 0) {
monitor.beginTask(null, 100);
try {
new RevertResourcesCommand(provider.getSVNWorkspaceRoot(), modifiedResourceArray).run(Policy.subMonitorFor(monitor, 100));
} catch (SVNException e) {
collectStatus(e.getStatus());
} finally {
monitor.done();
}
}
if (monitor.isCanceled()) {
return;
}
SVNRevision revision = SVNRevision.HEAD;
monitor.beginTask(null, 100);
try {
IResource[] incomingResources = getIncoming(resourceArray);
SVNWorkspaceSubscriber.getInstance().updateRemote(incomingResources);
if (changeSetSelected) {
List<IResource> existingResources = new ArrayList<IResource>();
for (IResource resource : incomingResources) {
if (resource.exists()) {
existingResources.add(resource);
} else {
UpdateResourcesCommand command = new UpdateResourcesCommand(provider.getSVNWorkspaceRoot(), new IResource[] { resource }, revision);
command.setConflictResolver(new SVNConflictResolver());
command.run(Policy.subMonitorFor(monitor, 100));
}
}
if (!existingResources.isEmpty()) {
IResource[] existingResourceArray = new IResource[existingResources.size()];
existingResources.toArray(existingResourceArray);
UpdateResourcesCommand command = new UpdateResourcesCommand(provider.getSVNWorkspaceRoot(), existingResourceArray, revision);
command.setDepth(Depth.empty);
command.setSetDepth(false);
command.setConflictResolver(new SVNConflictResolver());
command.run(Policy.subMonitorFor(monitor, 100));
}
} else {
UpdateResourcesCommand command = new UpdateResourcesCommand(provider.getSVNWorkspaceRoot(), incomingResources, revision);
command.setConflictResolver(new SVNConflictResolver());
command.run(Policy.subMonitorFor(monitor, 100));
}
} catch (SVNException e) {
collectStatus(e.getStatus());
} catch (TeamException e) {
collectStatus(e.getStatus());
} finally {
monitor.done();
}
}
use of org.tigris.subversion.subclipse.core.commands.UpdateResourcesCommand in project subclipse by subclipse.
the class UpdateOperation method execute.
/* (non-Javadoc)
* @see org.tigris.subversion.subclipse.ui.operations.RepositoryProviderOperation#execute(org.tigris.subversion.subclipse.core.SVNTeamProvider, org.eclipse.core.resources.IResource[], org.eclipse.core.runtime.IProgressMonitor)
*/
protected void execute(SVNTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws SVNException, InterruptedException {
monitor.beginTask(null, 100);
try {
if (conflictResolver != null && conflictResolver instanceof SVNConflictResolver) {
((SVNConflictResolver) conflictResolver).setPart(getPart());
}
SVNWorkspaceSubscriber.getInstance().updateRemote(resources);
UpdateResourcesCommand command = new UpdateResourcesCommand(provider.getSVNWorkspaceRoot(), resources, revision);
command.setDepth(depth);
command.setSetDepth(setDepth);
command.setIgnoreExternals(ignoreExternals);
command.setForce(force);
command.setConflictResolver(conflictResolver);
command.run(Policy.subMonitorFor(monitor, 100));
// updateWorkspaceSubscriber(provider, resources, Policy.subMonitorFor(monitor, 5));
} catch (SVNException e) {
if (e.operationInterrupted()) {
showCancelledMessage();
} else {
collectStatus(e.getStatus());
}
} catch (TeamException e) {
collectStatus(e.getStatus());
} finally {
SVNProviderPlugin.broadcastSyncInfoChanges(resources, false);
monitor.done();
}
}
Aggregations