Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 366016 | Differences between
and this patch

Collapse All | Expand All

(-)a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/model/CVSTagElement.java (-3 / +25 lines)
Lines 12-19 Link Here
12
12
13
import java.lang.reflect.InvocationTargetException;
13
import java.lang.reflect.InvocationTargetException;
14
import com.ibm.icu.text.SimpleDateFormat;
14
import com.ibm.icu.text.SimpleDateFormat;
15
import java.util.Date;
15
import java.util.*;
16
import java.util.Locale;
16
17
import com.ibm.icu.util.TimeZone;
17
import com.ibm.icu.util.TimeZone;
18
18
19
import org.eclipse.core.runtime.IProgressMonitor;
19
import org.eclipse.core.runtime.IProgressMonitor;
Lines 113-124 Link Here
113
			return null;
113
			return null;
114
		return ((CVSTagElement) o).root;
114
		return ((CVSTagElement) o).root;
115
	}
115
	}
116
	
117
	/*
118
	 * Filter out subfolders from cache, to prevent duplicated entries.
119
	 */
120
	private Object[] filterSubfolders(ICVSRemoteResource[] children){
121
		List filteredChildren = new ArrayList();
122
		for(int i=0; i<children.length; i++){
123
			ICVSRemoteResource child = children[i];
124
			boolean isSubfolderOfOtherChild = false;
125
			for(int j=0; j<children.length; j++){
126
				ICVSRemoteResource otherChild = children[j];
127
				if(!(i==j) && child.getRepositoryRelativePath().startsWith(otherChild.getRepositoryRelativePath())){
128
					isSubfolderOfOtherChild = true;
129
					break;
130
				}
131
			}
132
			if(!isSubfolderOfOtherChild){
133
				filteredChildren.add(child);
134
			}
135
		}
136
		return filteredChildren.toArray(new Object[filteredChildren.size()]);
137
	}
116
138
117
	protected Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException {
139
	protected Object[] fetchChildren(Object o, IProgressMonitor monitor) throws TeamException {
118
		ICVSRemoteResource[] children = CVSUIPlugin.getPlugin().getRepositoryManager().getFoldersForTag(root, tag, monitor);
140
		ICVSRemoteResource[] children = CVSUIPlugin.getPlugin().getRepositoryManager().getFoldersForTag(root, tag, monitor);
119
		if (getWorkingSet() != null)
141
		if (getWorkingSet() != null)
120
			children = CVSUIPlugin.getPlugin().getRepositoryManager().filterResources(getWorkingSet(), children);
142
			children = CVSUIPlugin.getPlugin().getRepositoryManager().filterResources(getWorkingSet(), children);
121
		return children;
143
		return filterSubfolders(children);
122
	}
144
	}
123
	
145
	
124
	public void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor) {
146
	public void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor) {
(-)a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java (-15 / +7 lines)
Lines 25-31 Link Here
25
import org.eclipse.team.internal.ccvs.ui.Policy;
25
import org.eclipse.team.internal.ccvs.ui.Policy;
26
import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation;
26
import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation;
27
import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache;
27
import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache;
28
import org.eclipse.team.internal.ccvs.ui.tags.TagSource;
29
28
30
public class RepositoryRoot extends PlatformObject {
29
public class RepositoryRoot extends PlatformObject {
31
30
Lines 444-465 Link Here
444
		return (CVSTag[])tagSet.toArray(new CVSTag[0]);
443
		return (CVSTag[])tagSet.toArray(new CVSTag[0]);
445
	}
444
	}
446
	
445
	
447
	/**
446
	/*
448
	 * Return the cache key (path) for the given folder path. For root projects
447
	 * Return the cache key (path) for the given folder path.
449
	 * it returns the folder the project is mapped to as the tag source. For
448
	 * This has been changed to cache the tags directly 
450
	 * non-root projects it returns only the first segment of the path because
449
	 * with the folder to better support non-root projects.
451
	 * for the time being tag lists are kept for the remote ancestors of the
450
	 * However, resources in the local workspace use the folder
452
	 * resource that is a direct child of the remote root.
451
	 * the project is mapped to as the tag source (see TagSource)
453
	 *
454
	 * @see TagSource
455
	 * @see #addTags(String, CVSTag[])
456
	 *
457
	 * @param remotePath
458
	 *            the remote folder path
459
	 * @return the cache key (path) for the given folder path
460
	 */
452
	 */
461
	private String getCachePathFor(String remotePath) {
453
	private String getCachePathFor(String remotePath) {
462
		return new Path(null, remotePath).segment(0);
454
		return remotePath;
463
	}
455
	}
464
	
456
	
465
	/**
457
	/**
(-)a/tests/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/ui/RepositoriesViewTests.java (-5 / +13 lines)
Lines 82-102 Link Here
82
82
83
		// create project
83
		// create project
84
		IProject project = getUniqueTestProject("TestBranchSubmoduleChildrenProject");
84
		IProject project = getUniqueTestProject("TestBranchSubmoduleChildrenProject");
85
		buildResources(project, new String[] { "file1.txt" }, true);
86
		// share project under module
85
		// share project under module
87
		shareProject(getRepository(), project,
86
		shareProject(getRepository(), project,
88
				moduleName + "/" + project.getName(), DEFAULT_MONITOR);
87
				moduleName + "/" + project.getName(), DEFAULT_MONITOR);
89
		assertValidCheckout(project);
88
		assertValidCheckout(project);
90
89
91
		// make some changes
90
		// add some files
92
		addResources(project, new String[] { "folder1/c.txt" }, false);
91
		addResources(project, new String[] { "file1.txt" }, true);
93
92
94
		// make branch
93
		// make branch
95
		CVSTag version = new CVSTag(versionName, CVSTag.VERSION);
94
		CVSTag version = new CVSTag(versionName, CVSTag.VERSION);
96
		CVSTag branch = new CVSTag(branchName, CVSTag.BRANCH);
95
		CVSTag branch = new CVSTag(branchName, CVSTag.BRANCH);
97
96
98
		makeBranch(new IResource[] { project }, version, branch, true);
97
		makeBranch(new IResource[] { project }, version, branch, true);
99
		commitProject(project);
100
98
101
		// refresh branches
99
		// refresh branches
102
		CVSUIPlugin
100
		CVSUIPlugin
Lines 128-144 Link Here
128
126
129
		// create project
127
		// create project
130
		IProject project = getUniqueTestProject("TestTagSubmoduleChildrenProject");
128
		IProject project = getUniqueTestProject("TestTagSubmoduleChildrenProject");
131
		buildResources(project, new String[] { "file1.txt" }, true);
132
		// share project under module
129
		// share project under module
133
		shareProject(getRepository(), project,
130
		shareProject(getRepository(), project,
134
				moduleName + "/" + project.getName(), DEFAULT_MONITOR);
131
				moduleName + "/" + project.getName(), DEFAULT_MONITOR);
135
		assertValidCheckout(project);
132
		assertValidCheckout(project);
136
133
134
		// add some files
135
		addResources(project, new String[] { "file1.txt" }, true);
136
137
		// tag project
137
		// tag project
138
		CVSTag tag = new CVSTag(versionName, CVSTag.VERSION);
138
		CVSTag tag = new CVSTag(versionName, CVSTag.VERSION);
139
139
140
		tagProject(project, tag, true);
140
		tagProject(project, tag, true);
141
141
142
		// refresh branches
143
		CVSUIPlugin
144
				.getPlugin()
145
				.getRepositoryManager()
146
				.refreshDefinedTags(
147
						getRepository().getRemoteFolder(moduleName, null),
148
						true, true, DEFAULT_MONITOR);
149
142
		RemoteContentProvider rcp = new RemoteContentProvider();
150
		RemoteContentProvider rcp = new RemoteContentProvider();
143
		Object[] categories = rcp.getChildren(getRepositoryRoot());
151
		Object[] categories = rcp.getChildren(getRepositoryRoot());
144
		assertEquals(4, categories.length);
152
		assertEquals(4, categories.length);

Return to bug 366016