Index: .classpath =================================================================== --- .classpath (revision 4139) +++ .classpath (working copy) @@ -11,5 +11,6 @@ + Index: plugin.properties =================================================================== --- plugin.properties (revision 4139) +++ plugin.properties (working copy) @@ -36,6 +36,8 @@ SwitchAction.label=&Switch to another Branch/Tag/Revision... SwitchAction.tooltip=Switch SwitchCommand.label=Switch to another Branch/Tag... +MixWorkingCopy.label=&Mix with another Branch/Tag/Revision... +MixWorkingCopy.tooltip=Mix trunk with changed branch files BranchTagAction.label=Branch/Tag... BranchTagAction.tooltip=Branch/Tag... CommentTemplatesPreferencePage.name=Comment Templates Index: plugin.xml =================================================================== --- plugin.xml (revision 4139) +++ plugin.xml (working copy) @@ -394,7 +394,7 @@ class="org.tigris.subversion.subclipse.ui.actions.SwitchAction" menubarPath="replaceWithMenu/replaceWithGroup" id="org.tigris.subversion.subclipse.ui.replaceWithBranchTag"> - + + + 0 && resources[0] instanceof IFile && !resources[0].isSynchronized(Depth.immediates)) { + if (MessageDialog.openQuestion(getShell(), Policy.bind("DifferencesDialog.compare"), Policy.bind("CompareWithRemoteAction.fileChanged"))) { + try { + resources[0].refreshLocal(Depth.immediates, new NullProgressMonitor()); + } catch (CoreException e) { + throw new InvocationTargetException(e); + } + } + } + ShowDifferencesAsUnifiedDiffDialogWC dialog = new ShowDifferencesAsUnifiedDiffDialogWC(getShell(), resources[0], getTargetPart()); + if (dialog.open() == ShowDifferencesAsUnifiedDiffDialogWC.OK && !dialog.isDiffToOutputFile()) { + try { + if (resources[0] instanceof IContainer) { + ISVNRemoteFolder remoteFolder = new RemoteFolder(dialog.getSvnResource().getRepository(), dialog.getToUrl(), dialog.getToRevision()); + + SVNUrl url = remoteFolder.getUrl(); + SVNRevision revision = remoteFolder.getRevision(); + ISVNRepositoryLocation repository = remoteFolder.getRepository(); + ISVNClientAdapter client = repository.getSVNClient(); + ISVNDirEntry[] list = client.getList(url, revision, SVNRevision.HEAD, false); + this.result = new ArrayList(list.length); + getRemoteUrls(root,localPath,repository,url,revision); + + } else { + ISVNRemoteFile remoteFile = new RemoteFile(dialog.getSvnResource().getRepository(), dialog.getToUrl(), dialog.getToRevision()); + ((RemoteFile)remoteFile).setPegRevision(dialog.getToRevision()); + this.result.add(remoteFile); + + } + + // now, at the end switch to every file! + + IResource[] localResources = new IResource[this.result.size()]; + SVNUrl[] remoteUrls = new SVNUrl[this.result.size()]; + int counter = 0; + Iterator i = this.result.iterator(); + while(i!=null && i.hasNext()){ + + Vector info = (Vector) i.next(); + LocalFile local = (LocalFile) info.get(0); + RemoteFile file = (RemoteFile) info.get(1); + localResources[counter]=local.getResource(); + remoteUrls[counter] = file.getUrl(); + counter++; + } + + /* Makes one shot switch*/ + SwitchOperation switchOperation = new SwitchOperation(getTargetPart(), localResources, remoteUrls, dialog.getToRevision()); + switchOperation.setDepth(-2); + switchOperation.setSetDepth(false); + switchOperation.setIgnoreExternals(false); + switchOperation.setForce(true); + switchOperation.setCanRunAsJob(true); + switchOperation.run(); + + + + } catch (Exception e) { + MessageDialog.openError(getShell(), Policy.bind("ShowDifferencesAsUnifiedDiffDialog.branchTag"), e.getMessage()); + } + } + } + + + private void getRemoteUrls(IWorkspaceRoot root, IPath localPath, ISVNRepositoryLocation repository, SVNUrl url, SVNRevision revision) { + ISVNClientAdapter client=null; + try { + + + + + client = repository.getSVNClient(); + ISVNDirEntry[] list = client.getList(url, revision, SVNRevision.HEAD, false); + + // directories first + for (int i=0;i