### Eclipse Workspace Patch 1.0 #P org.eclipse.team.cvs.core Index: src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java,v retrieving revision 1.18 diff -u -r1.18 DiffListener.java --- src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java 24 Apr 2009 09:33:21 -0000 1.18 +++ src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java 1 Feb 2011 09:03:45 -0000 @@ -74,10 +74,10 @@ ICVSRepositoryLocation location, ICVSFolder commandRoot, IProgressMonitor monitor) { - // ignore server messages for now - this is used only with the diff - // request and the errors can be safely ignored. + // return all the server errors as CVSStatus.ERROR_LINE or + // CVSStatus.PROTOCOL_ERROR if (getServerMessage(line, location) != null) { - return OK; + return super.errorLine(line, location, commandRoot, monitor); } //Check to see if this is a no such directory message Index: src/org/eclipse/team/internal/ccvs/core/messages.properties =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties,v retrieving revision 1.172 diff -u -r1.172 messages.properties --- src/org/eclipse/team/internal/ccvs/core/messages.properties 24 Apr 2009 09:33:21 -0000 1.172 +++ src/org/eclipse/team/internal/ccvs/core/messages.properties 1 Feb 2011 09:03:45 -0000 @@ -261,4 +261,4 @@ PrepareForReplaceVisitor_DeletedFileWithoutHistoryCannotBeRestoredWhileRevertToBase=Deleted file does not have history and cannot be restored with BASE tag. PrepareForReplaceVisitor_FileCannotBeReplacedWithBase=File {0} cannot be replaced with BASE. ThePatchDoesNotContainChangesFor_0= The patch does not contain changes for {0} -ThePatchDoesNotContainAllTheChanges=The patch does not contain all the changes \ No newline at end of file +ThePatchDoesNotContainAllTheChanges=An error occurred while performing difference operation, the patch may not contain all the changes \ No newline at end of file #P org.eclipse.team.cvs.ui Index: src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java,v retrieving revision 1.19 diff -u -r1.19 DiffOperation.java --- src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java 21 Sep 2009 10:40:45 -0000 1.19 +++ src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java 1 Feb 2011 09:03:46 -0000 @@ -312,7 +312,10 @@ List toShow = new ArrayList(); IStatus children[] = status.getChildren(); for (int i = 0; i < children.length; i++) { - if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER) { + // ignore all errors except those found by DiffListener + if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER + || children[i].getCode() == CVSStatus.PROTOCOL_ERROR + || children[i].getCode() == CVSStatus.ERROR_LINE) { toShow.add(children[i]); } } #P org.eclipse.team.tests.cvs.core Index: patchdata/server_response_with_error.txt =================================================================== RCS file: patchdata/server_response_with_error.txt diff -N patchdata/server_response_with_error.txt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patchdata/server_response_with_error.txt 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +M Index: src/Test1.java +M =================================================================== +M RCS file: /Eclipse_home/CVSREPO/test/src/Test1.java,v +M retrieving revision 1.1 +M diff -u -r1.1 Test1.java +M --- src/Test1.java 31 Jan 2011 16:19:33 -0000 1.1 +M +++ src/Test1.java 31 Jan 2011 17:48:38 -0000 +M @@ -1,4 +1,6 @@ +M +M public class Test1 { +M + private void testMethod1() { +M +M + } +M } +E cvs server: cannot find revision control file for src/Test2.java +error \ No newline at end of file Index: src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java,v retrieving revision 1.2 diff -u -r1.2 CreatePatchTest.java --- src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java 25 Feb 2010 10:22:34 -0000 1.2 +++ src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java 1 Feb 2011 09:03:47 -0000 @@ -11,9 +11,11 @@ package org.eclipse.team.tests.ccvs.ui; import java.io.BufferedReader; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.PrintStream; import java.net.URL; import junit.framework.Test; @@ -26,7 +28,9 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.SWT; @@ -35,6 +39,12 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import org.eclipse.team.internal.ccvs.core.CVSException; +import org.eclipse.team.internal.ccvs.core.CVSStatus; +import org.eclipse.team.internal.ccvs.core.ICVSFolder; +import org.eclipse.team.internal.ccvs.core.client.Command; +import org.eclipse.team.internal.ccvs.core.client.Session; +import org.eclipse.team.internal.ccvs.core.client.listeners.DiffListener; import org.eclipse.team.internal.ccvs.ui.CVSUIMessages; import org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard; import org.eclipse.team.tests.ccvs.core.EclipseTest; @@ -279,4 +289,77 @@ return event; } + public void testBug31661() throws FileNotFoundException, CoreException { + + copyIntoWorkspace("server_response_with_error.txt", + "server_response_with_error.txt"); + + Session session = new Session(getRepository(), + (ICVSFolder) getCVSResource(testProject)) { + // Override the session so it always returns response with an error. + private BufferedReader serverResp = new BufferedReader( + new InputStreamReader(testProject.getFile( + "server_response_with_error.txt").getContents())); + + private boolean isOpened = false; + + public void open(IProgressMonitor monitor) throws CVSException { + super.open(monitor); + isOpened = true; + } + + public String readLine() throws CVSException { + if (!isOpened) { + return super.readLine(); + } + try { + return serverResp.readLine(); + } catch (IOException e) { + throw new CVSException(new Status(IStatus.ERROR, null, + null, e)); + } + } + + public void close() { + try { + super.close(); + serverResp.close(); + } catch (IOException e) { + fail(e.getMessage()); + } + } + }; + + PrintStream stream = new PrintStream(testProject + .getFile("/patch_with_error.txt").getLocation().toFile()); + + try { + session.open(getMonitor()); + + DiffListener diffListener = new DiffListener(stream); + + IStatus status = Command.DIFF.execute(session, + Command.NO_GLOBAL_OPTIONS, new Command.LocalOption[0], + new String[0], diffListener, getMonitor()); + + assertNotNull( + "Diff command did not report error when some changes were excluded", + status); + assertEquals("Diff command did not report server error", + CVSStatus.SERVER_ERROR, status.getCode()); + + IStatus children[] = status.getChildren(); + assertEquals("Diff command did not report any server errors", 1, + children.length); + + assertEquals("Diff command did not report error line", + CVSStatus.ERROR_LINE, children[0].getCode()); + + } finally { + session.close(); + stream.close(); + + } + } + }