Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2010-08-16 14:37:49 +0000
committerTomasz Zarna2010-08-16 14:37:49 +0000
commit8d7caa7a713de8d5b9feb6281a53610567edfe04 (patch)
tree8ef91cf016e39083eec85013e6cf3c87b55e792d /bundles/org.eclipse.team.cvs.core
parent49d902c31b9be0f5e3c851b23df53e77de412cf8 (diff)
downloadeclipse.platform.team-8d7caa7a713de8d5b9feb6281a53610567edfe04.tar.gz
eclipse.platform.team-8d7caa7a713de8d5b9feb6281a53610567edfe04.tar.xz
eclipse.platform.team-8d7caa7a713de8d5b9feb6281a53610567edfe04.zip
bug 320686: Cannot compare locked revision with another regular revision
Diffstat (limited to 'bundles/org.eclipse.team.cvs.core')
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java5
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ResourceSyncInfo.java29
2 files changed, 23 insertions, 11 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java
index 0e8490828..b1d8741b3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java
@@ -21,6 +21,7 @@ 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.resources.RemoteFile;
+import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.Util;
/**
@@ -127,7 +128,9 @@ public class LogListener extends CommandOutputListener {
} else if (line.startsWith("symbolic names:")) { //$NON-NLS-1$
state = SYMBOLIC_NAMES;
} else if (line.startsWith("revision ")) { //$NON-NLS-1$
- revision = internAndCopyString(line.substring(9));
+ // if the revision has been locked, remove the "locked by" suffix
+ revision = line.substring(9).replaceFirst(ResourceSyncInfo.LOCKEDBY_REGEX, ""); //$NON-NLS-1$
+ revision = internAndCopyString(revision);
state = REVISION;
} else if (line.startsWith("total revisions:")){ //$NON-NLS-1$
//if there are no current revision selected and this is a branch then we are in the
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ResourceSyncInfo.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ResourceSyncInfo.java
index 06a3aecdb..09bbfb404 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ResourceSyncInfo.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/syncinfo/ResourceSyncInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -58,7 +58,7 @@ public class ResourceSyncInfo {
// revision can be locked in repository using "cvs admin -l<rev>" command
// entry looks like [M revision 1.2.2.3 locked by: igorf;]
- private static final String LOCKEDBY_SUFFIX = "\tlocked by"; //$NON-NLS-1$
+ public static final String LOCKEDBY_REGEX = "\\slocked by.+$"; //$NON-NLS-1$
// a sync element with a revision of '0' is considered a new file that has
// not been committed to the repo. Is visible so that clients can create sync infos
@@ -339,11 +339,16 @@ public class ResourceSyncInfo {
protected void setSyncType(int syncType) {
this.syncType = syncType;
}
+
/**
- * Sets the version and decides if the revision is for a deleted resource the revision field
- * will not include the deleted prefix '-'.
+ * Sets the version and decides if the revision is for a deleted resource.
+ * The revision field will not include the deleted prefix '-'. If the
+ * revision has been locked the "locked by" suffix it will be removed from
+ * the revision field.
*
- * @param version the version to set
+ * @param revision
+ * the revision to set
+ * @see #LOCKEDBY_REGEX
*/
protected void setRevision(String revision) {
if(revision==null || revision.equals(ADDED_REVISION)) {
@@ -358,6 +363,7 @@ public class ResourceSyncInfo {
this.revision = revision;
isDeleted = false;
}
+ this.revision = this.revision.replaceFirst(LOCKEDBY_REGEX, ""); //$NON-NLS-1$
}
/**
@@ -823,8 +829,14 @@ public class ResourceSyncInfo {
}
/**
- * Method getRevision.
+ * Return revision for the given synchronization bytes. The revision will
+ * not include the deleted prefix '-'. The "locked by" suffix it will not be
+ * included either.
+ *
* @param syncBytes
+ * the bytes that represent the synchronization information
+ * @return a revision string for the given bytes
+ * @see #LOCKEDBY_REGEX
*/
public static String getRevision(byte[] syncBytes) throws CVSException {
String revision = Util.getSubstring(syncBytes, SEPARATOR_BYTE, 2, false);
@@ -834,10 +846,7 @@ public class ResourceSyncInfo {
if(revision.startsWith(DELETED_PREFIX)) {
revision = revision.substring(DELETED_PREFIX.length());
}
- int lockedIdx = revision.indexOf(LOCKEDBY_SUFFIX);
- if (lockedIdx >= 0) {
- revision = revision.substring(0, lockedIdx);
- }
+ revision = revision.replaceFirst(LOCKEDBY_REGEX, ""); //$NON-NLS-1$
return revision;
}

Back to the top