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

Collapse All | Expand All

(-)src/org/eclipse/team/internal/ccvs/core/CVSMessages.java (+1 lines)
Lines 258-263 Link Here
258
	public static String CVSURI_InvalidURI;
258
	public static String CVSURI_InvalidURI;
259
	public static String ThePatchDoesNotContainChangesFor_0;
259
	public static String ThePatchDoesNotContainChangesFor_0;
260
	public static String ThePatchDoesNotContainAllTheChanges;
260
	public static String ThePatchDoesNotContainAllTheChanges;
261
	public static String ThePatchMayNotContainAllTheChanges;
261
262
262
	static {
263
	static {
263
		// load message values from bundle file
264
		// load message values from bundle file
(-)src/org/eclipse/team/internal/ccvs/core/messages.properties (-2 / +3 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=The patch does not contain all the changes
265
ThePatchMayNotContainAllTheChanges=The patch may not contain all the changes
(-)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/ui/operations/DiffOperation.java (-5 / +13 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 311-326 Link Here
311
		IStatus status = ex.getStatus();
311
		IStatus status = ex.getStatus();
312
		List toShow = new ArrayList();
312
		List toShow = new ArrayList();
313
		IStatus children[] = status.getChildren();
313
		IStatus children[] = status.getChildren();
314
		boolean may = true;
314
		for (int i = 0; i < children.length; i++) {
315
		for (int i = 0; i < children.length; i++) {
315
			if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER) {
316
			// ignore all errors except those found by DiffListener
317
			if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER
318
					|| children[i].getCode() == CVSStatus.PROTOCOL_ERROR
319
					|| children[i].getCode() == CVSStatus.ERROR_LINE) {
316
				toShow.add(children[i]);
320
				toShow.add(children[i]);
321
				if (children[i].getCode() == CVSStatus.BINARY_FILES_DIFFER)
322
					// the patch does not contain some changes for sure
323
					may = false;
317
			}
324
			}
318
		}
325
		}
319
		if (toShow.size() > 0) {
326
		if (toShow.size() > 0) {
327
			String msg = may ? CVSMessages.ThePatchMayNotContainAllTheChanges
328
					: CVSMessages.ThePatchDoesNotContainAllTheChanges;
320
			status = new MultiStatus(CVSProviderPlugin.ID,
329
			status = new MultiStatus(CVSProviderPlugin.ID,
321
					CVSStatus.SERVER_ERROR, (IStatus[]) toShow
330
					CVSStatus.SERVER_ERROR,
322
							.toArray(new IStatus[0]),
331
					(IStatus[]) toShow.toArray(new IStatus[0]), msg, null);
323
					CVSMessages.ThePatchDoesNotContainAllTheChanges, null);
324
			CVSUIPlugin.openError(getShell(), null, null, status,
332
			CVSUIPlugin.openError(getShell(), null, null, status,
325
					CVSUIPlugin.PERFORM_SYNC_EXEC
333
					CVSUIPlugin.PERFORM_SYNC_EXEC
326
							| CVSUIPlugin.LOG_OTHER_EXCEPTIONS);
334
							| CVSUIPlugin.LOG_OTHER_EXCEPTIONS);
(-)launchConfigurations/One CVS Test.launch (-3 / +3 lines)
Lines 16-22 Link Here
16
<booleanAttribute key="onePlugin" value="false"/>
16
<booleanAttribute key="onePlugin" value="false"/>
17
<stringAttribute key="onePluginID" value=""/>
17
<stringAttribute key="onePluginID" value=""/>
18
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
18
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
19
<listEntry value="/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/ProjectSetImporterTests.java"/>
19
<listEntry value="/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/CreatePatchTest.java"/>
20
</listAttribute>
20
</listAttribute>
21
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
21
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
22
<listEntry value="1"/>
22
<listEntry value="1"/>
Lines 26-33 Link Here
26
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
26
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
27
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
27
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
28
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
28
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
29
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Java50"/>
29
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/Java60"/>
30
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.ui.ProjectSetImporterTests"/>
30
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.team.tests.ccvs.ui.CreatePatchTest"/>
31
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os win32 -ws win32 -arch x86 -nl en_CA"/>
31
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os win32 -ws win32 -arch x86 -nl en_CA"/>
32
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.team.tests.cvs.core"/>
32
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.team.tests.cvs.core"/>
33
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
33
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
(-)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