Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Pogorzelski2009-04-24 09:33:21 +0000
committerPawel Pogorzelski2009-04-24 09:33:21 +0000
commit51b7ab210b42f4b6c2ff4945d8b3daeace028f5a (patch)
treee420de20cf912ed4e1673f1d24367ee4bbc9be3e /bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core
parent85d818926a8ed3839ae39db815941fd00f94cf1a (diff)
downloadeclipse.platform.team-51b7ab210b42f4b6c2ff4945d8b3daeace028f5a.tar.gz
eclipse.platform.team-51b7ab210b42f4b6c2ff4945d8b3daeace028f5a.tar.xz
eclipse.platform.team-51b7ab210b42f4b6c2ff4945d8b3daeace028f5a.zip
Bug 267817 - [Patch] Inform user if changes are not included in the patch
Diffstat (limited to 'bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core')
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMessages.java6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java5
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java34
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties4
4 files changed, 36 insertions, 13 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMessages.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMessages.java
index 9397ebc7c..eaf0eec57 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMessages.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -256,7 +256,9 @@ public class CVSMessages extends NLS {
public static String CVSTeamProviderType_0;
public static String CVSFileSystem_FetchTree;
public static String CVSURI_InvalidURI;
-
+ public static String ThePatchDoesNotContainChangesFor_0;
+ public static String ThePatchDoesNotContainAllTheChanges;
+
static {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, CVSMessages.class);
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java
index a5309084b..eedeae9ca 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -41,7 +41,8 @@ public class CVSStatus extends TeamStatus {
public static final int RESPONSE_HANDLING_FAILURE = -28;
public static final int COMMUNICATION_FAILURE = -29;
public static final int AUTHENTICATION_FAILURE = -30;
-
+ public static final int BINARY_FILES_DIFFER = -31;
+
// Path for resource related status
private ICVSFolder commandRoot;
// Server information
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java
index 7de08ec0d..0a319fd82 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/DiffListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,21 +12,29 @@ package org.eclipse.team.internal.ccvs.core.client.listeners;
import java.io.PrintStream;
+import java.util.regex.Pattern;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.client.CommandOutputListener;
import org.eclipse.team.internal.ccvs.core.client.Session;
public class DiffListener extends CommandOutputListener {
- PrintStream patchStream;
- boolean wroteToStream;
-
+
//Error Messages returned by CVS
static final String ERR_NOSUCHDIRECTORY = "cvs [diff aborted]: no such directory"; //$NON-NLS-1$
+
+ // Expressions for examining response lines
+ static final String INDEX = "Index: "; //$NON-NLS-1$
+ static final String BINARYFILESDIFFER = "Binary files .* and .* differ"; //$NON-NLS-1$
+ PrintStream patchStream;
+ boolean wroteToStream;
+
+ private String index = ""; //$NON-NLS-1$
+
public DiffListener(PrintStream patchStream) {
this.patchStream = patchStream;
wroteToStream=false;
@@ -46,8 +54,18 @@ public class DiffListener extends CommandOutputListener {
line = line.substring(0, line.length() - 1);
}
patchStream.println(line);
- wroteToStream=true;
-
+ wroteToStream = true;
+
+ if (line.startsWith(INDEX)) {
+ index = line.substring(INDEX.length());
+ } else if (Pattern.matches(BINARYFILESDIFFER, line)) {
+ String message = NLS.bind(
+ CVSMessages.ThePatchDoesNotContainChangesFor_0,
+ new String[] { index });
+ return new CVSStatus(IStatus.WARNING,
+ CVSStatus.BINARY_FILES_DIFFER, message, (Throwable) null);
+ }
+
return OK;
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
index 6270f969b..93166036d 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2007 IBM Corporation and others.
+# Copyright (c) 2000, 2009 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -260,3 +260,5 @@ EclipseFolder_0=Disconnecting {0}.
LogEntry_0=/
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

Back to the top