View | Details | Raw Unified | Return to bug 319661 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java (-4 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 74-83 Link Here
74
			ICVSRepositoryLocation location, 
74
			ICVSRepositoryLocation location, 
75
			ICVSFolder commandRoot,
75
			ICVSFolder commandRoot,
76
			IProgressMonitor monitor) {
76
			IProgressMonitor monitor) {
77
		// ignore server messages for now - this is used only with the diff
77
		// return all the server errors as CVSStatus.ERROR_LINE or
78
		// request and the errors can be safely ignored.
78
		// CVSStatus.PROTOCOL_ERROR
79
		if (getServerMessage(line, location) != null) {
79
		if (getServerMessage(line, location) != null) {
80
			return OK;
80
			return super.errorLine(line, location, commandRoot, monitor);
81
		}
81
		}
82
		
82
		
83
		//Check to see if this is a no such directory message
83
		//Check to see if this is a no such directory message
(-)src/org/eclipse/team/internal/ccvs/core/messages.properties (-2 / +2 lines)
Lines 1-5 Link Here
1
###############################################################################
1
###############################################################################
2
# Copyright (c) 2000, 2009 IBM Corporation and others.
2
# Copyright (c) 2000, 2011 IBM Corporation and others.
3
# All rights reserved. This program and the accompanying materials
3
# All rights reserved. This program and the accompanying materials
4
# are made available under the terms of the Eclipse Public License v1.0
4
# are made available under the terms of the Eclipse Public License v1.0
5
# which accompanies this distribution, and is available at
5
# which accompanies this distribution, and is available at
Lines 261-264 Link Here
261
PrepareForReplaceVisitor_DeletedFileWithoutHistoryCannotBeRestoredWhileRevertToBase=Deleted file does not have history and cannot be restored with BASE tag.
261
PrepareForReplaceVisitor_DeletedFileWithoutHistoryCannotBeRestoredWhileRevertToBase=Deleted file does not have history and cannot be restored with BASE tag.
262
PrepareForReplaceVisitor_FileCannotBeReplacedWithBase=File {0} cannot be replaced with BASE.
262
PrepareForReplaceVisitor_FileCannotBeReplacedWithBase=File {0} cannot be replaced with BASE.
263
ThePatchDoesNotContainChangesFor_0= The patch does not contain changes for {0}
263
ThePatchDoesNotContainChangesFor_0= The patch does not contain changes for {0}
264
ThePatchDoesNotContainAllTheChanges=The patch does not contain all the changes
264
ThePatchDoesNotContainAllTheChanges=An error occurred while performing CVS diff operation, the patch may not contain all the changes
(-)src/org/eclipse/team/internal/ccvs/ui/operations/DiffOperation.java (-2 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2009 IBM Corporation and others.
2
 * Copyright (c) 2005, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 312-318 Link Here
312
		List toShow = new ArrayList();
312
		List toShow = new ArrayList();
313
		IStatus children[] = status.getChildren();
313
		IStatus children[] = status.getChildren();
314
		for (int i = 0; i < children.length; i++) {
314
		for (int i = 0; i < children.length; i++) {
315
			if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER) {
315
			// ignore all errors except those found by DiffListener
316
			if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER
317
					|| children[i].getCode() == CVSStatus.PROTOCOL_ERROR
318
					|| children[i].getCode() == CVSStatus.ERROR_LINE) {
316
				toShow.add(children[i]);
319
				toShow.add(children[i]);
317
			}
320
			}
318
		}
321
		}
(-)patchdata/server_response_with_error.txt (+17 lines)
Added Link Here
1
ok
2
M Index: src/Test1.java
3
M ===================================================================
4
M RCS file: /Eclipse_home/CVSREPO/test/src/Test1.java,v
5
M retrieving revision 1.1
6
M diff -u -r1.1 Test1.java
7
M --- src/Test1.java	31 Jan 2011 16:19:33 -0000	1.1
8
M +++ src/Test1.java	31 Jan 2011 17:48:38 -0000
9
M @@ -1,4 +1,6 @@
10
M  
11
M  public class Test1 {
12
M +	private void testMethod1() {
13
M  
14
M +	}
15
M  }
16
E cvs server: cannot find revision control file for src/Test2.java
17
error  
(-)src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java (-1 / +80 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2009, 2010 IBM Corporation and others.
2
 * Copyright (c) 2009, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 11-19 Link Here
11
package org.eclipse.team.tests.ccvs.ui;
11
package org.eclipse.team.tests.ccvs.ui;
12
12
13
import java.io.BufferedReader;
13
import java.io.BufferedReader;
14
import java.io.FileNotFoundException;
15
import java.io.FileOutputStream;
14
import java.io.IOException;
16
import java.io.IOException;
15
import java.io.InputStream;
17
import java.io.InputStream;
16
import java.io.InputStreamReader;
18
import java.io.InputStreamReader;
19
import java.io.PrintStream;
17
import java.net.URL;
20
import java.net.URL;
18
21
19
import junit.framework.Test;
22
import junit.framework.Test;
Lines 26-32 Link Here
26
import org.eclipse.core.runtime.CoreException;
29
import org.eclipse.core.runtime.CoreException;
27
import org.eclipse.core.runtime.IPath;
30
import org.eclipse.core.runtime.IPath;
28
import org.eclipse.core.runtime.IProgressMonitor;
31
import org.eclipse.core.runtime.IProgressMonitor;
32
import org.eclipse.core.runtime.IStatus;
29
import org.eclipse.core.runtime.Path;
33
import org.eclipse.core.runtime.Path;
34
import org.eclipse.core.runtime.Status;
30
import org.eclipse.jface.wizard.IWizardPage;
35
import org.eclipse.jface.wizard.IWizardPage;
31
import org.eclipse.jface.wizard.WizardDialog;
36
import org.eclipse.jface.wizard.WizardDialog;
32
import org.eclipse.swt.SWT;
37
import org.eclipse.swt.SWT;
Lines 35-40 Link Here
35
import org.eclipse.swt.widgets.Event;
40
import org.eclipse.swt.widgets.Event;
36
import org.eclipse.swt.widgets.Shell;
41
import org.eclipse.swt.widgets.Shell;
37
import org.eclipse.swt.widgets.Text;
42
import org.eclipse.swt.widgets.Text;
43
import org.eclipse.team.internal.ccvs.core.CVSException;
44
import org.eclipse.team.internal.ccvs.core.CVSStatus;
45
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
46
import org.eclipse.team.internal.ccvs.core.client.Command;
47
import org.eclipse.team.internal.ccvs.core.client.Session;
48
import org.eclipse.team.internal.ccvs.core.client.listeners.DiffListener;
38
import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
49
import org.eclipse.team.internal.ccvs.ui.CVSUIMessages;
39
import org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard;
50
import org.eclipse.team.internal.ccvs.ui.wizards.GenerateDiffFileWizard;
40
import org.eclipse.team.tests.ccvs.core.EclipseTest;
51
import org.eclipse.team.tests.ccvs.core.EclipseTest;
Lines 279-282 Link Here
279
		return event;
290
		return event;
280
	}
291
	}
281
292
293
	public void testBug319661() throws FileNotFoundException, CoreException {
294
295
		Session session = new Session(getRepository(),
296
				(ICVSFolder) getCVSResource(testProject)) {
297
			// Override the session so it always returns response with an error.
298
			private BufferedReader serverResp = new BufferedReader(
299
					new InputStreamReader(
300
							asInputStream("server_response_with_error.txt")));
301
302
303
			public String readLine() throws CVSException {
304
				try {
305
					return serverResp.readLine();
306
				} catch (IOException e) {
307
					throw new CVSException(new Status(IStatus.ERROR, null,
308
							null, e));
309
				}
310
			}
311
312
			public void close() {
313
				try {
314
					super.close();
315
					serverResp.close();
316
				} catch (IOException e) {
317
					fail(e.getMessage());
318
				}
319
			}
320
		};
321
322
		PrintStream stream = new PrintStream(new FileOutputStream(testProject
323
				.getFile("/patch_with_error.txt").getLocation().toFile()));
324
325
		try {
326
			session.open(getMonitor());
327
328
			DiffListener diffListener = new DiffListener(stream);
329
330
			IStatus status = Command.DIFF.execute(session,
331
					Command.NO_GLOBAL_OPTIONS, new Command.LocalOption[0],
332
					new String[0], diffListener, getMonitor());
333
334
			assertNotNull(
335
					"Diff command did not report error when some changes were excluded",
336
					status);
337
			assertEquals("Diff command did not report server error",
338
					CVSStatus.SERVER_ERROR, status.getCode());
339
340
			IStatus children[] = status.getChildren();
341
			assertTrue("Diff command did not report any server errors",
342
					children.length > 0);
343
			
344
			boolean errorLineOccurred = false;
345
			for (int i = 0; i < children.length; i++) {
346
				if (children[i].getCode() == CVSStatus.ERROR_LINE) {
347
					errorLineOccurred = true;
348
					break;
349
				}
350
			}
351
352
			assertTrue("Diff command did not report error line",
353
					errorLineOccurred);
354
355
		} finally {
356
			session.close();
357
			stream.close();
358
		}
359
	}
360
	
282
}
361
}

Return to bug 319661