Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java1
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/UpdateListener.java87
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java11
5 files changed, 99 insertions, 3 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
index ee3a65fde..3d5c315de 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java
@@ -606,7 +606,7 @@ public class CVSProviderPlugin extends Plugin {
public org.osgi.service.prefs.Preferences getInstancePreferences() {
IPreferencesService service = Platform.getPreferencesService();
IEclipsePreferences root = service.getRootNode();
- return root.node(InstanceScope.SCOPE).node(getDescriptor().getUniqueIdentifier());
+ return root.node(InstanceScope.SCOPE).node(getBundle().getSymbolicName());
}
/**
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 524148e81..e426d19ca 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
@@ -30,6 +30,7 @@ public class CVSStatus extends Status {
public static final int PROTOCOL_ERROR = -23;
public static final int ERROR_LINE_PARSE_FAILURE = -24;
public static final int FAILED_TO_CACHE_SYNC_INFO = -25;
+ public static final int UNMEGERED_BINARY_CONFLICT = -26;
// Path for resource related status
private ICVSFolder commandRoot;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/UpdateListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/UpdateListener.java
index f57ff4530..de02d09a3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/UpdateListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/UpdateListener.java
@@ -10,19 +10,58 @@
*******************************************************************************/
package org.eclipse.team.internal.ccvs.core.client.listeners;
+import java.util.Map;
+
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.team.internal.ccvs.core.CVSException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSStatus;
+import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.core.Policy;
import org.eclipse.team.internal.ccvs.core.client.CommandOutputListener;
import org.eclipse.team.internal.ccvs.core.client.Update;
+import org.eclipse.team.internal.ccvs.core.util.Util;
public class UpdateListener extends CommandOutputListener {
+ // Pattern matchers
+ private static ServerMessageLineMatcher MERGED_BINARY_FILE_LINE_1;
+ private static ServerMessageLineMatcher MERGED_BINARY_FILE_LINE_2;
+
+ // Pattern Variables
+ private static final String REVISION_VARIABLE_NAME = "revision"; //$NON-NLS-1$
+ private static final String LOCAL_FILE_PATH_VARIABLE_NAME = "localFilePath"; //$NON-NLS-1$
+ private static final String BACKUP_FILE_VARIABLE_NAME = "backupFile"; //$NON-NLS-1$
+
+ static {
+ try {
+ String line1 = "revision " //$NON-NLS-1$
+ + Util.getVariablePattern(IMessagePatterns.REVISION_PATTERN, REVISION_VARIABLE_NAME)
+ + " from repository is now in " //$NON-NLS-1$
+ + Util.getVariablePattern(IMessagePatterns.FILE_PATH_PATTERN, LOCAL_FILE_PATH_VARIABLE_NAME);
+ MERGED_BINARY_FILE_LINE_1 = new ServerMessageLineMatcher(
+ line1,
+ new String[] {REVISION_VARIABLE_NAME, LOCAL_FILE_PATH_VARIABLE_NAME});
+ String line2 = "file from working directory is now in " //$NON-NLS-1$
+ + Util.getVariablePattern(IMessagePatterns.REVISION_PATTERN, BACKUP_FILE_VARIABLE_NAME);
+ MERGED_BINARY_FILE_LINE_2 = new ServerMessageLineMatcher(
+ line2,
+ new String[] {BACKUP_FILE_VARIABLE_NAME});
+
+ } catch (CVSException e) {
+ // Shouldn't happen
+ CVSProviderPlugin.log(e);
+ }
+ }
+
IUpdateMessageListener updateMessageListener;
boolean merging = false;
+ boolean mergingBinary = false;
+ String mergedBinaryFileRevision, mergedBinaryFilePath;
public UpdateListener(IUpdateMessageListener updateMessageListener) {
this.updateMessageListener = updateMessageListener;
@@ -30,6 +69,7 @@ public class UpdateListener extends CommandOutputListener {
public IStatus messageLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot,
IProgressMonitor monitor) {
+ mergingBinary = false;
if (updateMessageListener == null) return OK;
if(line.startsWith("Merging differences")) { //$NON-NLS-1$
merging = true;
@@ -96,11 +136,18 @@ public class UpdateListener extends CommandOutputListener {
* cvs [server aborted]: no such tag
* Merge contained conflicts
* rcsmerge: warning: conflicts during merge
+ * Binary file conflict
+ * cvs server: nonmergeable file needs merge
+ * cvs server: revision 1.4 from repository is now in a1/a2/test
+ * cvs server: file from working directory is now in .#test.1.3
*/
public IStatus errorLine(String line, ICVSRepositoryLocation location, ICVSFolder commandRoot,
IProgressMonitor monitor) {
try {
+ // Reset flag globally here because we have to many exit points
+ boolean wasMergingBinary = mergingBinary;
+ mergingBinary = false;
String serverMessage = getServerMessage(line, location);
if (serverMessage != null) {
// Strip the prefix from the line
@@ -162,10 +209,46 @@ public class UpdateListener extends CommandOutputListener {
} else if (message.startsWith("conflicts")) { //$NON-NLS-1$
// This line is info only. The server doesn't report an error.
return new CVSStatus(IStatus.INFO, CVSStatus.CONFLICT, commandRoot, line);
- } else if (!message.startsWith("cannot open directory") //$NON-NLS-1$
+ } else if (message.startsWith("nonmergeable file needs merge")) { //$NON-NLS-1$
+ mergingBinary = true;
+ mergedBinaryFileRevision = null;
+ mergedBinaryFilePath = null;
+ return OK;
+ } else if (wasMergingBinary) {
+ Map variables = MERGED_BINARY_FILE_LINE_1.processServerMessage(message);
+ if (variables != null) {
+ mergedBinaryFileRevision = (String)variables.get(REVISION_VARIABLE_NAME);
+ mergedBinaryFilePath = (String)variables.get(LOCAL_FILE_PATH_VARIABLE_NAME);
+ mergingBinary = true;
+ return OK;
+ }
+ variables = MERGED_BINARY_FILE_LINE_2.processServerMessage(message);
+ if (variables != null) {
+ String backupFile = (String)variables.get(BACKUP_FILE_VARIABLE_NAME);
+ try {
+ if (mergedBinaryFileRevision != null && mergedBinaryFilePath != null) {
+ ICVSFile file = commandRoot.getFile(mergedBinaryFilePath);
+ IResource resource = file.getIResource();
+ if (resource != null) {
+ return new CVSStatus(IStatus.ERROR, CVSStatus.UNMEGERED_BINARY_CONFLICT,
+ Policy.bind("UpdateListener.0", new Object[] { //$NON-NLS-1$
+ resource.getFullPath().toString(),
+ mergedBinaryFileRevision,
+ resource.getFullPath().removeLastSegments(1).append(backupFile).toString()}));
+ }
+ }
+ } catch (CVSException e1) {
+ CVSProviderPlugin.log(e1);
+ }
+ return OK;
+ }
+ }
+
+ // Fallthrough case for "cvs server" messages
+ if (!message.startsWith("cannot open directory") //$NON-NLS-1$
&& !message.startsWith("nothing known about")) { //$NON-NLS-1$
return super.errorLine(line, location, commandRoot, monitor);
- }
+ }
} else {
String serverAbortedMessage = getServerAbortedMessage(line, location);
if (serverAbortedMessage != null) {
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 aa8165871..36f75f315 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
@@ -179,6 +179,7 @@ Tag.notVersionOrBranchError=Error applying tag: the tag provided is not a versio
DefaultHandler.connectionClosed=The connection to the server has been closed
ModTimeHandler.invalidFormat=The server modification time {0} is in an unknown format
Updated.numberFormat=Server did not send length of the file
+UpdateListener.0=An unmergable conflict has occurred for binary file {0}. Revision {1} has been loaded and overwritten local changes have been saved in file {2}
UnsupportedHandler.message=Unsupported response received from server
RemovedHandler.invalid=Invalid removed response received from CVS server for {0}
CheckInHandler.checkedIn= Receiving confirmation for file {0}.
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java
index bf09a103b..21a0b5dd8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/UpdateOperation.java
@@ -106,6 +106,17 @@ public class UpdateOperation extends SingleCommandOperation {
IStatus status = errors[i];
if (status.getCode() == CVSStatus.SERVER_ERROR) {
serverErrors.add(status);
+ } else if (status.getCode() == CVSStatus.UNMEGERED_BINARY_CONFLICT) {
+ serverErrors.add(status);
+ } else if (status.isMultiStatus()) {
+ IStatus[] children = status.getChildren();
+ for (int j = 0; j < children.length; j++) {
+ IStatus child = children[j];
+ if (child.getCode() == CVSStatus.UNMEGERED_BINARY_CONFLICT) {
+ serverErrors.add(status);
+ break;
+ }
+ }
}
}
if (serverErrors.isEmpty()) return;

Back to the top