diff options
author | Kalyan Prasad Tatavarthi | 2018-08-16 09:48:46 +0000 |
---|---|---|
committer | Kalyan Prasad Tatavarthi | 2018-08-16 09:48:46 +0000 |
commit | 788001f340d6c20d6c3752c408bd87d1fe2b6c65 (patch) | |
tree | fb82312ded7f7187c56e374b7e67460646fb27d5 | |
parent | 966b8a4fb860e10599af7ebd65c3652ff3c68759 (diff) | |
download | eclipse.platform.team-R4_5_maintenance.tar.gz eclipse.platform.team-R4_5_maintenance.tar.xz eclipse.platform.team-R4_5_maintenance.zip |
Bug 532617 - Replace headstream instead of branchR4_5_maintenance
Change-Id: I637835cc4ef37f95fa7e1a665ad2eb2d2bc27b5e
Signed-off-by: Kalyan Prasad Tatavarthi <kalyan_prasad@in.ibm.com>
10 files changed, 82 insertions, 17 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.team.cvs.core/META-INF/MANIFEST.MF index 7189a4f98..ce77745f4 100644 --- a/bundles/org.eclipse.team.cvs.core/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.team.cvs.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.team.cvs.core; singleton:=true -Bundle-Version: 3.3.700.qualifier +Bundle-Version: 3.3.701.qualifier Bundle-Activator: org.eclipse.team.internal.ccvs.core.CVSProviderPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/bundles/org.eclipse.team.cvs.core/pom.xml b/bundles/org.eclipse.team.cvs.core/pom.xml index 92b1d963b..1b894ef29 100644 --- a/bundles/org.eclipse.team.cvs.core/pom.xml +++ b/bundles/org.eclipse.team.cvs.core/pom.xml @@ -19,6 +19,6 @@ </parent> <groupId>org.eclipse.team</groupId> <artifactId>org.eclipse.team.cvs.core</artifactId> - <version>3.3.700-SNAPSHOT</version> + <version>3.3.701-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> 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/META-INF/MANIFEST.MF b/bundles/org.eclipse.team.cvs.ui/META-INF/MANIFEST.MF index 36b85ce1e..594f1170d 100644 --- a/bundles/org.eclipse.team.cvs.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.team.cvs.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.team.cvs.ui; singleton:=true -Bundle-Version: 3.3.700.qualifier +Bundle-Version: 3.3.701.qualifier Bundle-Activator: org.eclipse.team.internal.ccvs.ui.CVSUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/bundles/org.eclipse.team.cvs.ui/pom.xml b/bundles/org.eclipse.team.cvs.ui/pom.xml index 228d6a5a0..4217545ed 100644 --- a/bundles/org.eclipse.team.cvs.ui/pom.xml +++ b/bundles/org.eclipse.team.cvs.ui/pom.xml @@ -19,6 +19,6 @@ </parent> <groupId>org.eclipse.team</groupId> <artifactId>org.eclipse.team.cvs.ui</artifactId> - <version>3.3.700-SNAPSHOT</version> + <version>3.3.701-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> 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 2b538d3e1..cca2ace8d 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 @@ -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 @@ -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(); |