18167: Can't commit changes after replacing with revision
diff --git a/bundles/org.eclipse.team.cvs.ui/help_contexts.xml b/bundles/org.eclipse.team.cvs.ui/help_contexts.xml
index 0a8ea7b..05a70ec 100644
--- a/bundles/org.eclipse.team.cvs.ui/help_contexts.xml
+++ b/bundles/org.eclipse.team.cvs.ui/help_contexts.xml
@@ -124,4 +124,22 @@
       <description>This view shows the incoming, outgoing and conflicting changes.
       </description>
    	</context>
+   	   <context  id="compare_revisions_view_context" >
+      <description>This view allows the comparision of the local copy of a file with the revisions from the respoitory.
+      Actions availabel of a revision are "Get Contents" and "Get Revision". Although both replace the local file with the contents of the remote rvision, "Get Revision" will make the local file "sticky". This means that changes to the file cannot be committed back to the repository.
+      </description>
+   	</context>
+   	
+   	<!-- ********************************** -->
+ 	<!-- Actions					            -->
+ 	<!-- ********************************** -->
+ 	
+ 	<context  id="get_file_revision_action_context" >
+      <description>Load the revision of the file into the workspace. The file will be "sticky" and the user will be unable to commit changes to the repository.
+      </description>
+   	</context>
+ 	<context  id="get_file_contents_action_context" >
+      <description>Load the contents of the file into the workspace. The base revision of the local file will not change and the file will become dirty. Perform this action if you wich to revert to the contents of an older revision of the file.
+      </description>
+   	</context>
 </contexts>
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
index 71ded5a..d11a8e7 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSCompareRevisionsInput.java
@@ -64,6 +64,7 @@
 import org.eclipse.team.internal.ccvs.ui.actions.CVSAction;
 import org.eclipse.team.internal.core.TeamPlugin;
 import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.help.WorkbenchHelp;
 
 public class CVSCompareRevisionsInput extends CompareEditorInput {
 	IFile resource;
@@ -293,6 +294,12 @@
 				getRevisionAction.setEnabled(ss.size() == 1);
 			}	
 		});
+		
+		// Add F1 help.
+		WorkbenchHelp.setHelp(table, IHelpContextIds.COMPARE_REVISIONS_VIEW);
+		WorkbenchHelp.setHelp(getContentsAction, IHelpContextIds.GET_FILE_CONTENTS_ACTION);
+		WorkbenchHelp.setHelp(getRevisionAction, IHelpContextIds.GET_FILE_REVISION_ACTION);
+		
 		return viewer;
 	}
 	/**
@@ -418,7 +425,7 @@
 				// recompute the labels on the viewer
 				viewer.refresh();
 			}
-		};		
+		};
 	}
 	public boolean isSaveNeeded() {
 		return false;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
index 2b6900c..56a6604 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/IHelpContextIds.java
@@ -68,10 +68,16 @@
 	public static final String CONSOLE_VIEW = PREFIX + "console_view_context"; //$NON-NLS-1$
 	public static final String REPOSITORIES_VIEW = PREFIX + "repositories_view_context"; //$NON-NLS-1$
 	public static final String RESOURCE_HISTORY_VIEW = PREFIX + "resource_history_view_context"; //$NON-NLS-1$
+	public static final String COMPARE_REVISIONS_VIEW = PREFIX + "compare_revision_view_context"; //$NON-NLS-1$
 	
 	// Viewers
 	public static final String CATCHUP_RELEASE_VIEWER = PREFIX + "catchup_release_viewer_context"; //$NON-NLS-1$
 	
 	// Add to .cvsignor dialog
-	public static final String ADD_TO_CVSIGNORE = PREFIX + "add_to_cvsignore_context"; //$NON-NLS-1$	
+	public static final String ADD_TO_CVSIGNORE = PREFIX + "add_to_cvsignore_context"; //$NON-NLS-1$
+	
+	// Actions
+	public static final String GET_FILE_REVISION_ACTION = PREFIX + "get_file_revision_action_context"; //$NON-NLS-1$
+	public static final String GET_FILE_CONTENTS_ACTION = PREFIX + "get_file_contents_action_context"; //$NON-NLS-1$
+
 }
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
index 427edfa..7efcd0a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
@@ -6,6 +6,7 @@
  */
  
 import org.eclipse.compare.CompareUI;
+import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.dialogs.ErrorDialog;
@@ -13,6 +14,7 @@
 import org.eclipse.team.internal.ccvs.core.CVSException;
 import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
 import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.ICVSFile;
 import org.eclipse.team.internal.ccvs.core.ICVSFolder;
 import org.eclipse.team.internal.ccvs.core.ICVSResource;
 import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
@@ -78,6 +80,16 @@
 					if(getTag(resource) == null) {
 						return false;
 					}
+					// Don't enable if there are sticky file revisions in the lineup
+					if (resources[i].getType() == IResource.FILE) {
+						ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile)resources[i]);
+						ResourceSyncInfo info = file.getSyncInfo();
+						if (info != null && info.getTag() != null) {
+							String revision = info.getRevision();
+							String tag = info.getTag().getName();
+							if (revision.equals(tag)) return false;
+						}
+					}
 				} catch(CVSException e) {
 					return false;
 				}
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 181a0d0..46dea2c 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
@@ -11,6 +11,7 @@
 import java.util.List;
 import java.util.Set;
 
+import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.SubProgressMonitor;
@@ -19,6 +20,9 @@
 import org.eclipse.team.core.TeamException;
 import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
 import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
+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.ui.Policy;
 import org.eclipse.team.internal.ui.IPromptCondition;
 import org.eclipse.team.internal.ui.PromptingDialog;
@@ -65,6 +69,16 @@
 			CVSTeamProvider provider = (CVSTeamProvider)RepositoryProvider.getProvider(resources[i].getProject(), CVSProviderPlugin.getTypeId());
 			if (provider == null) return false;
 			if (!provider.hasRemote(resources[i])) return false;
+			// Don't enable if there are sticky file revisions in the lineup
+			if (resources[i].getType() == IResource.FILE) {
+				ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile)resources[i]);
+				ResourceSyncInfo info = file.getSyncInfo();
+				if (info != null && info.getTag() != null) {
+					String revision = info.getRevision();
+					String tag = info.getTag().getName();
+					if (revision.equals(tag)) return false;
+				}
+			}
 		}
 		return true;
 	}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index 07c1cf0..702da23 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -310,7 +310,7 @@
 HistoryFilterDialog.toDate = &To date (M/D/Y) : 
 
 HistoryView.getContentsAction=&Get Contents
-HistoryView.getRevisionAction=Get &Revision
+HistoryView.getRevisionAction=Get Sticky &Revision
 HistoryView.copy=&Copy
 HistoryView.revision=Revision
 HistoryView.tags=Tags