Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalyan Prasad Tatavarthi2018-08-16 08:58:24 +0000
committerKalyan Prasad Tatavarthi2018-08-16 08:58:24 +0000
commit154cff5fcc463304350172e8655bc729c317df8e (patch)
treed3d2358d140a08d6bc93b4a93838ab61e70a44f7
parente0c6dbf15dc7a6f63d5511a85395138bddf2aece (diff)
downloadeclipse.platform.team-154cff5fcc463304350172e8655bc729c317df8e.tar.gz
eclipse.platform.team-154cff5fcc463304350172e8655bc729c317df8e.tar.xz
eclipse.platform.team-154cff5fcc463304350172e8655bc729c317df8e.zip
Bug 532617 - Replace headstream instead of branch
Change-Id: I5b8c35e14f3f7e4ffa37b1d4f3d4e1c40e5d1268 Signed-off-by: Kalyan Prasad Tatavarthi <kalyan_prasad@in.ibm.com>
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java47
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java19
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java5
6 files changed, 77 insertions, 12 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
index 937df4d1d..3a3d00b83 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/Util.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -15,8 +15,7 @@ import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.Socket;
import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.*;
@@ -439,6 +438,48 @@ public class Util {
}
/**
+ * Workaround for CVS "bug" where CVS ENTRIES file does not contain correct
+ * Branch vs. Version info. Entries files always record a Tv1 so all entries would
+ * appear as branches.
+ *
+ * By comparing the revision number to the tag name and to the existing tags
+ * you can determine if the tag is a branch or version.
+ *
+ * @param cvsResource the resource to test. Must nut be null.
+ * @return the correct cVSTag. May be null.
+ */
+ public static CVSTag getAccurateFileTag(ICVSResource cvsResource, CVSTag[] existing) throws CVSException {
+ List tags= Arrays.asList(existing);
+ CVSTag tag = null;
+ ResourceSyncInfo info = cvsResource.getSyncInfo();
+ if(info != null) {
+ tag = info.getTag();
+ }
+
+ FolderSyncInfo parentInfo = cvsResource.getParent().getFolderSyncInfo();
+ CVSTag parentTag = null;
+ if(parentInfo != null) {
+ parentTag = parentInfo.getTag();
+ }
+
+ if(tag != null) {
+ if(tag.getName().equals(info.getRevision())) {
+ tag = new CVSTag(tag.getName(), CVSTag.VERSION);
+ } else if(parentTag != null){
+ tag = new CVSTag(tag.getName(), parentTag.getType());
+ } else if (!tags.contains(tag)) {
+ if (!tags.contains(tag)) {
+ CVSTag newTag= new CVSTag(tag.getName(), CVSTag.VERSION);
+ if (tags.contains(newTag)) {
+ tag = newTag;
+ }
+ }
+ }
+ }
+ return tag;
+ }
+
+ /**
* Return the fullest path that we can obtain for the given resource
* @param resource
* @return
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java
index c7d18d8b6..f448349b5 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSFilePropertiesPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -25,7 +25,7 @@ import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSFile;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
-import org.eclipse.team.internal.ccvs.core.util.Util;
+import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
import org.eclipse.ui.PlatformUI;
import com.ibm.icu.text.DateFormat;
@@ -83,7 +83,7 @@ public class CVSFilePropertiesPage extends CVSPropertiesPage {
// Tag
createLabel(composite, CVSUIMessages.CVSFilePropertiesPage_tag);
- CVSTag tag = Util.getAccurateFileTag(cvsResource);
+ CVSTag tag = CVSAction.getAccurateFileTag(cvsResource);
createReadOnlyText(composite, getTagLabel(tag));
} catch (TeamException e) {
// Display error text
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
index a2fd881a4..cae90fdb9 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -33,8 +33,11 @@ import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.*;
import org.eclipse.team.internal.ccvs.core.filehistory.CVSFileRevision;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.core.util.Util;
import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.repo.RepositoryManager;
+import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
+import org.eclipse.team.internal.ccvs.ui.tags.TagSourceWorkbenchAdapter;
import org.eclipse.team.internal.ui.*;
import org.eclipse.team.internal.ui.actions.TeamAction;
import org.eclipse.team.internal.ui.dialogs.IPromptCondition;
@@ -644,4 +647,18 @@ abstract public class CVSAction extends TeamAction implements IEditorActionDeleg
}
return props.getCVSResourceFor(resource);
}
+
+ public static CVSTag getAccurateFileTag(ICVSResource cvsResource) throws CVSException {
+ CVSTag tag = null;
+ if (cvsResource != null) {
+ return Util.getAccurateFileTag(cvsResource, getTags(cvsResource));
+ }
+ return tag;
+ }
+
+ public static CVSTag[] getTags(ICVSResource cvsResource) {
+ TagSource tagSource= TagSource.create(new ICVSResource[] { cvsResource });
+ return tagSource.getTags(TagSource.convertIncludeFlaqsToTagTypes(TagSourceWorkbenchAdapter.INCLUDE_ALL_TAGS));
+
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
index c9a79db13..a6b811825 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -23,7 +23,7 @@ public class ReplaceWithRemoteAction extends WorkspaceTraversalAction {
public void execute(IAction action) throws InvocationTargetException, InterruptedException {
- final ReplaceOperation replaceOperation = new ReplaceOperation(getTargetPart(), getCVSResourceMappings(), null);
+ final ReplaceOperation replaceOperation = new ReplaceOperation(getTargetPart(), getCVSResourceMappings(), resourceCommonTag);
if (hasOutgoingChanges(replaceOperation)) {
final boolean[] keepGoing = new boolean[] { true };
Display.getDefault().syncExec(new Runnable() {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java
index cf614fbcb..0c322a791 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/WorkspaceAction.java
@@ -45,6 +45,8 @@ import org.eclipse.team.internal.ui.dialogs.PromptingDialog;
*/
public abstract class WorkspaceAction extends CVSAction {
+ protected CVSTag resourceCommonTag = null;
+
public interface IProviderAction {
public IStatus execute(CVSTeamProvider provider, IResource[] resources, IProgressMonitor monitor) throws CVSException;
}
@@ -459,6 +461,7 @@ public abstract class WorkspaceAction extends CVSAction {
*/
protected String calculateActionTagValue() {
try {
+ resourceCommonTag = null;
IResource[] resources = getSelectedResources();
CVSTag commonTag = null;
boolean sameTagType = true;
@@ -476,7 +479,7 @@ public abstract class WorkspaceAction extends CVSAction {
tag = Util.getAccurateFolderTag(resources[i], tag);
}
} else {
- tag = Util.getAccurateFileTag(cvsResource);
+ tag = CVSAction.getAccurateFileTag(cvsResource);
}
if(tag == null) {
tag = new CVSTag();
@@ -498,6 +501,9 @@ public abstract class WorkspaceAction extends CVSAction {
if(commonTag != null) {
int tagType = commonTag.getType();
String tagName = commonTag.getName();
+ if(tagType != CVSTag.HEAD) {
+ resourceCommonTag = commonTag;
+ }
// multiple tag names but of the same type
if(sameTagType && !multipleSameNames) {
if(tagType == CVSTag.BRANCH) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java
index ff7d93bb2..cc676af83 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/subscriber/LogEntryCacheUpdateHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -31,6 +31,7 @@ import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
import org.eclipse.team.internal.ccvs.core.util.Util;
import org.eclipse.team.internal.ccvs.ui.*;
import org.eclipse.team.internal.ccvs.ui.Policy;
+import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
import org.eclipse.team.internal.ccvs.ui.mappings.ModelCompareParticipant;
import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation;
import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache;
@@ -604,7 +605,7 @@ public class LogEntryCacheUpdateHandler extends BackgroundEventHandler {
tag = Util.getAccurateFolderTag(local, tag);
}
} else {
- tag = Util.getAccurateFileTag(cvsResource);
+ tag = CVSAction.getAccurateFileTag(cvsResource);
}
if(tag == null) {
tag = new CVSTag();

Back to the top