Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2002-04-15 12:49:29 +0000
committerMichael Valenta2002-04-15 12:49:29 +0000
commit0c39e3d206a9cf29b8ef3adebbbf42a49755951a (patch)
treea3b2cf220baead0ce40d85cf4f89ed77f0aa7a68
parent656599753d5dd0106d878e7c0f8ed7ae28a5a5df (diff)
downloadeclipse.platform.team-0c39e3d206a9cf29b8ef3adebbbf42a49755951a.tar.gz
eclipse.platform.team-0c39e3d206a9cf29b8ef3adebbbf42a49755951a.tar.xz
eclipse.platform.team-0c39e3d206a9cf29b8ef3adebbbf42a49755951a.zip
10890: Support multiple sticky tags in single project
-rw-r--r--bundles/org.eclipse.team.cvs.ui/plugin.xml11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java63
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSMoveDeleteHook.java44
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java80
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java40
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties21
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java58
8 files changed, 238 insertions, 83 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/plugin.xml b/bundles/org.eclipse.team.cvs.ui/plugin.xml
index 6e6c4bad2..757998337 100644
--- a/bundles/org.eclipse.team.cvs.ui/plugin.xml
+++ b/bundles/org.eclipse.team.cvs.ui/plugin.xml
@@ -56,6 +56,17 @@
</filter>
</page>
<page
+ objectClass="org.eclipse.core.resources.IFolder"
+ adaptable="true"
+ name="%CVS"
+ class="org.eclipse.team.internal.ccvs.ui.CVSFolderPropertiesPage"
+ id="org.eclipse.team.ccvs.ui.propertyPages.CVSFolderPropertiesPage">
+ <filter
+ name="projectNature"
+ value="org.eclipse.team.cvs.core.cvsnature">
+ </filter>
+ </page>
+ <page
objectClass="org.eclipse.core.resources.IProject"
adaptable="true"
name="%CVS"
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java
new file mode 100644
index 000000000..1754edd0b
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/AvoidableMessageDialog.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2002 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ ******************************************************************************/
+package org.eclipse.team.internal.ccvs.ui;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+public class AvoidableMessageDialog extends MessageDialog {
+ Button dontShowAgain;
+ boolean dontShow;
+ boolean showOption;
+
+ public AvoidableMessageDialog(Shell shell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
+ this(shell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex, true);
+ }
+
+ public AvoidableMessageDialog(Shell shell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex, boolean showOption) {
+ super(shell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
+ this.showOption = showOption;
+ }
+
+ protected Control createCustomArea(Composite composite) {
+ if ( ! showOption) return null;
+ dontShow = false;
+ dontShowAgain = new Button(composite, SWT.CHECK);
+ GridData data = new GridData();
+ data.horizontalIndent = 50;
+ dontShowAgain.setLayoutData(data);
+ dontShowAgain.setText(Policy.bind("AvoidableMessageDialog.dontShowAgain")); //$NON-NLS-1$
+ dontShowAgain.setSelection(dontShow);
+ dontShowAgain.addSelectionListener(new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ dontShow = dontShowAgain.getSelection();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+
+ });
+ return dontShowAgain;
+ }
+
+ public boolean isDontShowAgain() {
+ return dontShow;
+ }
+
+}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSMoveDeleteHook.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSMoveDeleteHook.java
index fe0ffa308..fc1d5968e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSMoveDeleteHook.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSMoveDeleteHook.java
@@ -47,46 +47,6 @@ public class CVSMoveDeleteHook implements IMoveDeleteHook {
public interface IRunnableWithShell {
public void run(Shell shell);
}
-
- public class MoveDeleteMessageDialog extends MessageDialog {
- Button dontShowAgain;
- boolean dontShow;
- boolean showOption;
-
- public MoveDeleteMessageDialog(Shell shell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
- this(shell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex, true);
- }
-
- public MoveDeleteMessageDialog(Shell shell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex, boolean showOption) {
- super(shell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex);
- this.showOption = showOption;
- }
-
- protected Control createCustomArea(Composite composite) {
- if ( ! showOption) return null;
- dontShow = false;
- dontShowAgain = new Button(composite, SWT.CHECK);
- GridData data = new GridData();
- data.horizontalIndent = 50;
- dontShowAgain.setLayoutData(data);
- dontShowAgain.setText(Policy.bind("CVSMoveDeleteHook.dontShowAgain")); //$NON-NLS-1$
- dontShowAgain.setSelection(dontShow);
- dontShowAgain.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- dontShow = dontShowAgain.getSelection();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
-
- });
- return dontShowAgain;
- }
-
- public boolean isDontShowAgain() {
- return dontShow;
- }
- }
private void showDialog(final IRunnableWithShell runnable) {
Display.getDefault().syncExec(new Runnable() {
@@ -177,7 +137,7 @@ public class CVSMoveDeleteHook implements IMoveDeleteHook {
if ( ! performDelete[0]){
showDialog(new IRunnableWithShell() {
public void run(Shell shell) {
- MoveDeleteMessageDialog dialog = new MoveDeleteMessageDialog(
+ AvoidableMessageDialog dialog = new AvoidableMessageDialog(
shell,
title,
null, // accept the default window icon
@@ -237,7 +197,7 @@ public class CVSMoveDeleteHook implements IMoveDeleteHook {
dialogShown = true;
showDialog(new IRunnableWithShell() {
public void run(Shell shell) {
- MoveDeleteMessageDialog dialog = new MoveDeleteMessageDialog(
+ AvoidableMessageDialog dialog = new AvoidableMessageDialog(
shell,
title,
null, // accept the default window icon
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java
index 02436e600..2529d90da 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/RepositoryManager.java
@@ -172,11 +172,12 @@ public class RepositoryManager {
}
/**
- * Add the given branch tags to the list of known tags for the given
+ * Accept branch tags for any CVS resource. However, for the time being,
+ * the given branch tags are added to the list of known tags for the resource's
* remote root.
*/
- public void addBranchTags(ICVSFolder project, CVSTag[] tags) {
- ICVSRepositoryLocation location = getRepositoryLocationFor(project);
+ public void addBranchTags(ICVSResource resource, CVSTag[] tags) {
+ ICVSRepositoryLocation location = getRepositoryLocationFor(resource);
addBranchTags(location, tags);
}
@@ -235,28 +236,51 @@ public class RepositoryManager {
}
/**
- * Add the given version tags to the list of known tags for the given
- * remote project.
+ * Accept version tags for any CVS resource. However, for the time being,
+ * the given version tags are added to the list of known tags for the
+ * remote ancestor of the resource that is a direct child of the remote root
*/
- public void addVersionTags(ICVSFolder project, CVSTag[] tags) {
- ICVSRepositoryLocation location = getRepositoryLocationFor(project);
- Hashtable table = (Hashtable)versionTags.get(location);
- if (table == null) {
- table = new Hashtable();
- versionTags.put(location, table);
- }
- Set set = (Set)table.get(project.getName());
- if (set == null) {
- set = new HashSet();
- table.put(project.getName(), set);
- }
- for (int i = 0; i < tags.length; i++) {
- set.add(tags[i]);
- }
- Iterator it = listeners.iterator();
- while (it.hasNext() && notifyRepoView) {
- IRepositoryListener listener = (IRepositoryListener)it.next();
- listener.versionTagsAdded(tags, location);
+ public void addVersionTags(ICVSResource resource, CVSTag[] tags) {
+ try {
+
+ // Make sure there is a version tag table for the location
+ ICVSRepositoryLocation location = getRepositoryLocationFor(resource);
+ Hashtable table = (Hashtable)versionTags.get(location);
+ if (table == null) {
+ table = new Hashtable();
+ versionTags.put(location, table);
+ }
+
+ // Get the name to cache the version tags with
+ ICVSFolder parent;
+ if (resource.isFolder()) {
+ parent = (ICVSFolder)resource;
+ } else {
+ parent = resource.getParent();
+ }
+ if ( ! parent.isCVSFolder()) return;
+ String name = new Path(parent.getFolderSyncInfo().getRepository()).segment(0);
+
+ // Make sure there is a table for the ancestor that holds the tags
+ Set set = (Set)table.get(name);
+ if (set == null) {
+ set = new HashSet();
+ table.put(name, set);
+ }
+
+ // Store the tag with the appropriate ancestor
+ for (int i = 0; i < tags.length; i++) {
+ set.add(tags[i]);
+ }
+
+ // Notify any listeners
+ Iterator it = listeners.iterator();
+ while (it.hasNext() && notifyRepoView) {
+ IRepositoryListener listener = (IRepositoryListener)it.next();
+ listener.versionTagsAdded(tags, location);
+ }
+ } catch (CVSException e) {
+ CVSUIPlugin.log(e.getStatus());
}
}
@@ -696,8 +720,14 @@ public class RepositoryManager {
return (CVSTag[])tagSet.toArray(new CVSTag[0]);
}
- public ICVSRepositoryLocation getRepositoryLocationFor(ICVSFolder folder) {
+ public ICVSRepositoryLocation getRepositoryLocationFor(ICVSResource resource) {
try {
+ ICVSFolder folder;
+ if (resource.isFolder()) {
+ folder = (ICVSFolder)resource;
+ } else {
+ folder = resource.getParent();
+ }
if(folder.isCVSFolder()) {
ICVSRepositoryLocation location = CVSProvider.getInstance().getRepository(folder.getFolderSyncInfo().getRoot());
return location;
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
index 8306e6194..b90076f02 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
@@ -12,6 +12,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
+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;
import org.eclipse.team.internal.ccvs.ui.wizards.BranchWizard;
@@ -47,7 +48,8 @@ public class BranchAction extends TeamAction {
RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId());
if (provider == null) return false;
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
- if (resource.getType()!=IResource.PROJECT&&!cvsResource.isManaged()) return false;
+ if (resource.getType() == IResource.PROJECT && ((ICVSFolder)cvsResource).isCVSFolder()) return true;
+ if ( ! cvsResource.isManaged()) return false;
}
return true;
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
index 0c99ddd74..b123ab31a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
@@ -22,9 +22,12 @@ import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
+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.CVSTeamProvider;
+import org.eclipse.team.internal.ccvs.core.ICVSResource;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.TagSelectionDialog;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -53,6 +56,7 @@ public class ReplaceWithTagAction extends ReplaceWithAction {
}
}
+ // Confirm overwrite of locally modified resources
if (isAnyDirty) {
final Shell shell = getShell();
final boolean[] result = new boolean[] { false };
@@ -64,7 +68,7 @@ public class ReplaceWithTagAction extends ReplaceWithAction {
if (!result[0]) return;
}
- // show the tags for one of the selected resources
+ // show the tags for the projects of the selected resources
IProject[] projects = new IProject[resources.length];
for (int i = 0; i < resources.length; i++) {
projects[i] = resources[i].getProject();
@@ -75,6 +79,32 @@ public class ReplaceWithTagAction extends ReplaceWithAction {
return;
}
tag[0] = dialog.getResult();
+
+ // For non-projects determine if the tag being loaded is the same as the resource's parent
+ // If it's not, warn the user that they will have strange sync behavior
+ try {
+ for (int i = 0; i < resources.length; i++) {
+ if (resources[i].getType() != IResource.PROJECT) {
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
+ CVSTag parentTag = cvsResource.getParent().getFolderSyncInfo().getTag();
+ if ( ! equalTags(tag[0], parentTag)) {
+ final Shell shell = getShell();
+ final boolean[] result = new boolean[] { false };
+ shell.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ result[0] = MessageDialog.openQuestion(getShell(), Policy.bind("question"), Policy.bind("ReplaceWithTagAction.mixingTags")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
+ if (!result[0]) tag[0] = null;
+ // Only ask once!
+ return;
+ }
+ }
+
+ }
+ } catch (CVSException e) {
+ throw new InvocationTargetException(e);
+ }
}
}, Policy.bind("ReplaceWithTagAction.replace"), this.PROGRESS_BUSYCURSOR); //$NON-NLS-1$
@@ -119,9 +149,17 @@ public class ReplaceWithTagAction extends ReplaceWithAction {
return false;
}
type = resource.getType();
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource);
+ if ( ! cvsResource.isManaged()) return false;
}
return true;
}
return false;
}
+
+ protected boolean equalTags(CVSTag tag1, CVSTag tag2) {
+ if (tag1 == null) tag1 = CVSTag.DEFAULT;
+ if (tag2 == null) tag2 = CVSTag.DEFAULT;
+ return tag1.equals(tag2);
+ }
}
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 cf28c5745..c21cb10d4 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
@@ -26,9 +26,16 @@ AddToWorkspaceAction.confirmOverwrite=Confirm Overwrite
AutoDefineTagsAction.defineTags = Auto-discover tags
+AvoidableMessageDialog.dontShowAgain=Don't show this again
+
BranchWizard.createABranch=Creates a new CVS Branch
BranchWizard.title=Branch
BranchWizard.errorTagging=Error Tagging Resources
+BranchWizard.mixingTags=You are mixing tags within a project. \
+ This may cause confusion when synchronizing with the repository. \
+ Synchronize uses the tag information associated with each resource to determine the remote resource against which the local resource is compared. \
+ For branching, this means that the part(s) of your project that you are branching will be synchronized against branch tag ''{0}'' while others will be sychronized against ''HEAD'' (or whichever tag is associated with the other local resources). \
+ Do you wish to continue?
BranchWizardPage.pageDescription=Creates a new branch and a starting point version.
BranchWizardPage.pageDescriptionVersion=Creates a new branch based on the version in the workspace.
BranchWizardPage.specifyVersion=The version will provide a starting point for merging the branch back to the source branch.
@@ -110,6 +117,12 @@ CVSFilePropertiesPage.error=An error occurred while creating this page.
CVSFilePropertiesPage.permissions=Permissions:
CVSFilePropertiesPage.notAvailable=Not Available
+CVSFolderPropertiesPage.ignored=The folder is ignored by CVS.
+CVSFolderPropertiesPage.notManaged=The folder is not managed by CVS.
+CVSFolderPropertiesPage.root=Repository Root:
+CVSFolderPropertiesPage.repository=Repository Path:
+CVSFolderPropertiesPage.static=Static:
+
CVSMoveDeleteHook.deleteFileTitle=Deletion of CVS Controlled File
CVSMoveDeleteHook.deleteFileMessage=File ''{0}'' is under CVS control. In order to properly communicate the deletion to CVS, this file will be marked as an outgoing deletion.
CVSMoveDeleteHook.moveFileTitle=Move of CVS Controlled File
@@ -118,7 +131,6 @@ CVSMoveDeleteHook.deleteFolderTitle=Deletion of CVS Controlled Folder
CVSMoveDeleteHook.deleteFolderMessage=Folder ''{0}'' is under CVS control. Files are marked as outgoing deletions. The deletion of the folder and any subfolders will be postponed until you commit the file deletions.
CVSMoveDeleteHook.moveFolderTitle=Move of CVS Controlled Folder
CVSMoveDeleteHook.moveFolderMessage=Folder ''{0}'' is under CVS control. A move results in the deletion of the folder from its old location. In order to properly communicate this deletion to CVS, the old folder and any subfolders will remain and files contained in this folder will be marked as outgoing deletions. Any empty folders will be pruned when the deletions are committed.
-CVSMoveDeleteHook.dontShowAgain=Don't show this again
CVSMoveDeleteHook.Team_Private_Resource_1=Team Private Resource
CVSMoveDeleteHook.Deletion_of_team_private_resources_is_not_permitted_2=Deletion of team private resource ''{0}'' is not permitted
CVSMoveDeleteHook.folderDeletionFailure=Folder ''{0}'' was not deleted in order to properly communicate file deletions to CVS
@@ -346,6 +358,11 @@ RemoveModuleVersionAction.removeTag=Discard Version
ReplaceWithTagAction.replace=Error Replacing With Tag
ReplaceWithTagAction.replacing=Replacing with tag {0}
+ReplaceWithTagAction.mixingTags=You are mixing tags within a project. \
+ This may cause confusion when synchronizing with the repository. \
+ Synchronize uses the tag information associated with each resource to determine the remote resource against which the local resource is compared. \
+ For example, with version tags, the state of the tagged resources never change so you will not see changes made to the resources in HEAD (or other branches). \
+ Do you wish to continue?
ReplaceWithRemoteAction.replacing=Replacing
ReplaceWithRemoteAction.problemMessage=Error Replacing With Latest From Repository
@@ -466,6 +483,8 @@ TagAction.tagWarningTitle=Warnings Occured
TagAction.tagProblemsMessage=Problems reported during tag operation
TagAction.tagResources=Tag Resources
TagAction.enterTag=Please enter a version tag:
+TagAction.uncommittedChangesTitle=Uncommitted Changes
+TagAction.uncommittedChanges=You are tagging resources that have uncommitted changes. These changes are not in the repository and will not be included in the version your are creating.
UpdateAction.update=Problems encountered performing update
UpdateAction.updating=Updating...
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java
index b4b7ff59b..3a99bdc74 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/BranchWizard.java
@@ -18,8 +18,10 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.core.CVSException;
@@ -27,7 +29,6 @@ import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.CVSTeamProvider;
import org.eclipse.team.internal.ccvs.core.ICVSFolder;
-import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder;
import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
import org.eclipse.team.internal.ccvs.core.ICVSResource;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
@@ -37,7 +38,6 @@ import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.RepositoryManager;
-import org.eclipse.team.internal.ccvs.ui.model.BranchTag;
public class BranchWizard extends Wizard {
BranchWizardPage mainPage;
@@ -62,12 +62,10 @@ public class BranchWizard extends Wizard {
boolean update = mainPage.getUpdate();
String versionString = mainPage.getVersionTag();
CVSTag rootVersionTag = null;
- CVSTag branchTag = new CVSTag(tagString, CVSTag.BRANCH);
+ final CVSTag branchTag = new CVSTag(tagString, CVSTag.BRANCH);
if (versionString != null) {
rootVersionTag = new CVSTag(versionString, CVSTag.VERSION);
}
- boolean eclipseWay = true;
- //boolean eclipseWay = methodPage.getEclipseWay();
RepositoryManager manager = CVSUIPlugin.getPlugin().getRepositoryManager();
Hashtable table = getProviderMapping(resources);
@@ -80,24 +78,52 @@ public class BranchWizard extends Wizard {
CVSTeamProvider provider = (CVSTeamProvider)iterator.next();
List list = (List)table.get(provider);
IResource[] providerResources = (IResource[])list.toArray(new IResource[list.size()]);
+ // For non-projects determine if the tag being loaded is the same as the resource's parent
+ // If it's not, warn the user that they will have strange sync behavior
+ if (update) {
+ for (int i = 0; i < resources.length; i++) {
+ if (providerResources[i].getType() != IResource.PROJECT) {
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[i]);
+ CVSTag parentTag = cvsResource.getParent().getFolderSyncInfo().getTag();
+ if ( ! equalTags(branchTag, parentTag)) {
+ final Shell shell = getShell();
+ final boolean[] result = new boolean[] { false };
+ shell.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ result[0] = MessageDialog.openQuestion(getShell(), Policy.bind("question"), Policy.bind("BranchWizard.mixingTags", branchTag.getName())); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
+ if (!result[0]) return;
+ // Only ask once!
+ // XXX Should we ask once per provider or only once overall?
+ break;
+ }
+ }
+
+ }
+ }
+
ICVSRepositoryLocation root = provider.getCVSWorkspaceRoot().getRemoteLocation();
try {
+ // XXX This check is dangerous if you allow branching at the resource level
if(!areAllResourcesSticky(resources)) {
// version everything in workspace with the root version tag specified in dialog
- provider.makeBranch(providerResources, rootVersionTag, branchTag, update, eclipseWay, subMonitor);
+ provider.makeBranch(providerResources, rootVersionTag, branchTag, update, true, subMonitor);
} else {
// all resources are versions, use that version as the root of the branch
- provider.makeBranch(providerResources, null, branchTag, update, eclipseWay, subMonitor);
+ provider.makeBranch(providerResources, null, branchTag, update, true, subMonitor);
}
- if (rootVersionTag != null) {
+ if (rootVersionTag != null || update) {
for (int i = 0; i < providerResources.length; i++) {
- ICVSRemoteFolder remoteResource = (ICVSRemoteFolder) CVSWorkspaceRoot.getRemoteResourceFor(providerResources[i]);
- manager.addVersionTags(remoteResource, new CVSTag[] { rootVersionTag });
+ ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(providerResources[i]);
+ if (rootVersionTag != null) {
+ manager.addVersionTags(cvsResource, new CVSTag[] { rootVersionTag });
+ }
+ if (update) {
+ manager.addBranchTags(cvsResource, new CVSTag[] { branchTag });
+ }
}
}
- if (update) {
- manager.addBranchTags(root, new CVSTag[] { branchTag });
- }
} catch (TeamException e) {
status.merge(e.getStatus());
}
@@ -177,4 +203,10 @@ public class BranchWizard extends Wizard {
}
return false;
}
+
+ protected boolean equalTags(CVSTag tag1, CVSTag tag2) {
+ if (tag1 == null) tag1 = CVSTag.DEFAULT;
+ if (tag2 == null) tag2 = CVSTag.DEFAULT;
+ return tag1.equals(tag2);
+ }
}

Back to the top