Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 44993 Details for
Bug 148029
[Subscriber] Synchronize with fetch absent direcories disabled still fetches them
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch
patch148029.txt (text/plain), 9.68 KB, created by
Michael Valenta
on 2006-06-21 09:27:52 EDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Michael Valenta
Created:
2006-06-21 09:27:52 EDT
Size:
9.68 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.team.tests.cvs.core >Index: src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.tests.cvs.core/src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java,v >retrieving revision 1.42 >diff -u -r1.42 CVSWorkspaceSubscriberTest.java >--- src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java 10 May 2006 18:10:44 -0000 1.42 >+++ src/org/eclipse/team/tests/ccvs/core/subscriber/CVSWorkspaceSubscriberTest.java 21 Jun 2006 13:30:24 -0000 >@@ -1339,4 +1339,28 @@ > CVSProviderPlugin.getPlugin().setDefaultTextKSubstOption(option); > } > } >+ >+ public void testDisabledDirectoryDiscovery() throws CoreException { >+ // Create a project and disable new directory discovery >+ IProject project = createProject(new String[] { "file1.txt"}); >+ setFetchAbsentDirectories(project, false); >+ >+ IProject copy = checkoutCopy(project, "-copy"); >+ addResources(copy, new String[] { "added.txt", "folder2/", "folder2/added.txt" }, true); >+ >+ // The new subfolder (folder2) and its contents should not have sync info (i.e. in_sync) >+ assertSyncEquals("testDisabledDirectoryDiscovery", project, >+ new String[] {"file1.txt", "added.txt", "folder2/", "folder2/added.txt" }, >+ true, new int[] { >+ SyncInfo.IN_SYNC, >+ SyncInfo.INCOMING | SyncInfo.ADDITION, >+ SyncInfo.IN_SYNC, >+ SyncInfo.IN_SYNC >+ }); >+ } >+ >+ private void setFetchAbsentDirectories(IProject project, boolean fetch) throws CVSException { >+ RepositoryProvider provider = RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId()); >+ ((CVSTeamProvider) provider).setFetchAbsentDirectories(fetch); >+ } > } >#P org.eclipse.team.cvs.core >Index: src/org/eclipse/team/internal/ccvs/core/client/Update.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Update.java,v >retrieving revision 1.33 >diff -u -r1.33 Update.java >--- src/org/eclipse/team/internal/ccvs/core/client/Update.java 1 Nov 2005 18:05:36 -0000 1.33 >+++ src/org/eclipse/team/internal/ccvs/core/client/Update.java 21 Jun 2006 13:30:28 -0000 >@@ -103,6 +103,26 @@ > protected LocalOption[] filterLocalOptions(Session session, GlobalOption[] globalOptions, LocalOption[] localOptions) { > List newOptions = new ArrayList(Arrays.asList(localOptions)); > >+ if (shouldRetrieveAbsentDirectories(session) && ! RETRIEVE_ABSENT_DIRECTORIES.isElementOf(localOptions)) { >+ newOptions.add(Update.RETRIEVE_ABSENT_DIRECTORIES); >+ } >+ >+ // Prune empty directories if pruning is enabled and the command in not being run in non-update mode >+ if (CVSProviderPlugin.getPlugin().getPruneEmptyDirectories() && ! PRUNE_EMPTY_DIRECTORIES.isElementOf(localOptions)) { >+ if (! DO_NOT_CHANGE.isElementOf(globalOptions)) { >+ newOptions.add(Command.PRUNE_EMPTY_DIRECTORIES); >+ } >+ } >+ localOptions = (LocalOption[]) newOptions.toArray(new LocalOption[newOptions.size()]); >+ return super.filterLocalOptions(session, globalOptions, localOptions); >+ } >+ >+ /** >+ * Return whether the update command should retrieve absent directories. >+ * @param session the session >+ * @return whether the update command should retrieve absent directories >+ */ >+ protected boolean shouldRetrieveAbsentDirectories(Session session) { > // Look for absent directories if enabled and the option is not already included > IResource resource = null; > RepositoryProvider provider = null; >@@ -112,8 +132,8 @@ > if (resource != null) { > provider = RepositoryProvider.getProvider(resource.getProject(), CVSProviderPlugin.getTypeId()); > if (provider != null) { >- if (((CVSTeamProvider)provider).getFetchAbsentDirectories() && ! RETRIEVE_ABSENT_DIRECTORIES.isElementOf(localOptions)) { >- newOptions.add(Update.RETRIEVE_ABSENT_DIRECTORIES); >+ if (((CVSTeamProvider)provider).getFetchAbsentDirectories()) { >+ return true; > } > } > } >@@ -122,19 +142,11 @@ > } > // If there is no provider, use the global setting > if (provider == null) { >- if (CVSProviderPlugin.getPlugin().getFetchAbsentDirectories() && ! RETRIEVE_ABSENT_DIRECTORIES.isElementOf(localOptions)) { >- newOptions.add(Update.RETRIEVE_ABSENT_DIRECTORIES); >+ if (CVSProviderPlugin.getPlugin().getFetchAbsentDirectories()) { >+ return true; > } > } >- >- // Prune empty directories if pruning is enabled and the command in not being run in non-update mode >- if (CVSProviderPlugin.getPlugin().getPruneEmptyDirectories() && ! PRUNE_EMPTY_DIRECTORIES.isElementOf(localOptions)) { >- if (! DO_NOT_CHANGE.isElementOf(globalOptions)) { >- newOptions.add(Command.PRUNE_EMPTY_DIRECTORIES); >- } >- } >- localOptions = (LocalOption[]) newOptions.toArray(new LocalOption[newOptions.size()]); >- return super.filterLocalOptions(session, globalOptions, localOptions); >+ return false; > } > > /** >Index: src/org/eclipse/team/internal/ccvs/core/resources/UpdateContentCachingService.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/UpdateContentCachingService.java,v >retrieving revision 1.5 >diff -u -r1.5 UpdateContentCachingService.java >--- src/org/eclipse/team/internal/ccvs/core/resources/UpdateContentCachingService.java 13 Jun 2006 18:50:29 -0000 1.5 >+++ src/org/eclipse/team/internal/ccvs/core/resources/UpdateContentCachingService.java 21 Jun 2006 13:30:28 -0000 >@@ -13,10 +13,12 @@ > import java.util.ArrayList; > import java.util.Date; > >+import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.osgi.util.NLS; >+import org.eclipse.team.core.RepositoryProvider; > import org.eclipse.team.core.TeamException; > import org.eclipse.team.internal.ccvs.core.*; > import org.eclipse.team.internal.ccvs.core.client.*; >@@ -24,7 +26,8 @@ > import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener; > import org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation; > import org.eclipse.team.internal.ccvs.core.connection.CVSServerException; >-import org.eclipse.team.internal.ccvs.core.syncinfo.*; >+import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo; >+import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; > > /** > * This class can be used to fetch and cache file contents for remote files. >@@ -35,8 +38,17 @@ > private ICVSFolder remoteRoot; > private final CVSTag tag; > private final int depth; >+ private boolean fetchAbsentDirectories = true; > > public class SandboxUpdate extends Update { >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.core.client.Update#shouldRetrieveAbsentDirectories(org.eclipse.team.internal.ccvs.core.client.Session) >+ */ >+ protected boolean shouldRetrieveAbsentDirectories(Session session) { >+ return fetchAbsentDirectories; >+ } >+ > /* (non-Javadoc) > * @see org.eclipse.team.internal.ccvs.core.client.Command#commandFinished(org.eclipse.team.internal.ccvs.core.client.Session, org.eclipse.team.internal.ccvs.core.client.Command.GlobalOption[], org.eclipse.team.internal.ccvs.core.client.Command.LocalOption[], org.eclipse.team.internal.ccvs.core.ICVSResource[], org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IStatus) > */ >@@ -59,7 +71,7 @@ > > /** > * This class overrides the "Created" handler in order to configure the remote file >- * to recieve and cache the contents >+ * to receive and cache the contents > */ > public class SandboxUpdatedHandler extends UpdatedHandler { > public SandboxUpdatedHandler(int type) { >@@ -102,6 +114,7 @@ > try { > RemoteFolder tree = buildBaseTree(repository, root, tag, Policy.subMonitorFor(monitor, 50)); > UpdateContentCachingService service = new UpdateContentCachingService(repository, tree, tag, depth); >+ service.setFetchAbsentDirectories(getFetchAbsentDirectories(root)); > if (!service.cacheFileContents(Policy.subMonitorFor(monitor, 50))) > return null; > return tree; >@@ -110,6 +123,27 @@ > } > } > >+ private void setFetchAbsentDirectories(boolean fetchAbsentDirectories) { >+ this.fetchAbsentDirectories = fetchAbsentDirectories; >+ } >+ >+ private static boolean getFetchAbsentDirectories(ICVSFolder root) { >+ IResource resource = root.getIResource(); >+ if (resource != null) { >+ IProject project = resource.getProject(); >+ RepositoryProvider provider = RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId()); >+ if (provider instanceof CVSTeamProvider) { >+ CVSTeamProvider cp = (CVSTeamProvider) provider; >+ try { >+ return cp.getFetchAbsentDirectories(); >+ } catch (CVSException e) { >+ CVSProviderPlugin.log(e); >+ } >+ } >+ } >+ return CVSProviderPlugin.getPlugin().getFetchAbsentDirectories(); >+ } >+ > private static RemoteFolder buildBaseTree(final CVSRepositoryLocation repository, ICVSFolder root, CVSTag tag, IProgressMonitor progress) throws CVSException { > try { > RemoteFolderTreeBuilder builder = new RemoteFolderTreeBuilder(repository, root, tag) { >@@ -228,6 +262,9 @@ > if (depth != IResource.DEPTH_INFINITE ) > options.add(Command.DO_NOT_RECURSE); > >+ if (fetchAbsentDirectories) >+ options.add(Update.RETRIEVE_ABSENT_DIRECTORIES); >+ > if (!options.isEmpty()) > return (LocalOption[]) options.toArray(new LocalOption[options.size()]); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 148029
: 44993