Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-04-11 14:22:42 +0000
committerJean Michel-Lemieux2002-04-11 14:22:42 +0000
commit873c348b7bb2be015ce262d165914f4627c9c271 (patch)
tree0e3aa9566fdf0a62eda29a22fb1f0e24a4b74ab8 /bundles/org.eclipse.team.cvs.core
parent6740ee3a87286ff5d04eeead548e10ca29e52dd9 (diff)
downloadeclipse.platform.team-873c348b7bb2be015ce262d165914f4627c9c271.tar.gz
eclipse.platform.team-873c348b7bb2be015ce262d165914f4627c9c271.tar.xz
eclipse.platform.team-873c348b7bb2be015ce262d165914f4627c9c271.zip
Bug 13178: Team: no CVS folder in file system when I check out CVSROOT
The problem was the way cancelled monitors were handled in endOperation(). The nesting count was not decremented and thus commitCache was never being called.
Diffstat (limited to 'bundles/org.eclipse.team.cvs.core')
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java2
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties6
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java133
3 files changed, 88 insertions, 53 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java
index 4f25fc20f..d5ae4774e 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSStatus.java
@@ -20,7 +20,7 @@ public class CVSStatus extends Status {
public static final int CONFLICT = -12;
public static final int ERROR_LINE = -14; // generic uninterpreted E line from the server
public static final int TAG_ALREADY_EXISTS = -15;
- public static final int DELETION_FAILED = -16;
+ public static final int COMMITTING_SYNC_INFO_FAILED = -16;
public static final int DOES_NOT_EXIST = -17;
public static final int FOLDER_NEEDED_FOR_FILE_DELETIONS = -18;
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
index a60771dc7..2231ab7e3 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties
@@ -237,11 +237,13 @@ EclipseFile_Problem_writing_resource=Problem writing resource: {1}
EclipseFile_Problem_appending_to_resource=Problem appending to resource: {1}
EclipseFolder_problem_creating=Problem creating folder: {1}
-EclipseSynchronizer_updatingSyncEndOperation=Updating CVS synchronization information...
+EclipseSynchronizer.UpdatingSyncEndOperation=Saving CVS synchronization information...
+EclipseSynchronizer.UpdatingSyncEndOperationCancelled=Operation cancelled: saving CVS synchronization information...
EclipseSynchronizer.ErrorSettingFolderSync=Cannot set folder sync info on {0}
EclipseSynchronizer.ErrorSettingResourceSync=Cannot set resource sync info on {0}
EclipseSynchronizer.ErrorSettingIgnorePattern=Cannot set ignored pattern on {0}
-EclipseSynchronizer.ErrorDeletingFolderSync=Could not delete all CVS folders
+EclipseSynchronizer.ErrorCommitting=Errors saving CVS synchronization information to disk. Please fix the problems listed below and then update the affected resources from the CVS repository.
+
SyncFileChangeListener.errorSettingTeamPrivateFlag=Error setting team-private flag on resource
PollingInputStream.readTimeout=Timeout while reading from input stream
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
index 09e0d7435..f1a34d36f 100644
--- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/EclipseSynchronizer.java
@@ -256,24 +256,6 @@ public class EclipseSynchronizer {
CVSProviderPlugin.broadcastResourceStateChanges((IResource[])possibleIgnores.toArray(new IResource[possibleIgnores.size()]));
}
- private void accumulateNonManagedChildren(IContainer folder, List possibleIgnores) throws CVSException {
- try {
- cacheResourceSyncForChildren(folder);
- IResource[] children = folder.members();
- for (int i = 0; i < children.length; i++) {
- IResource child = children[i];
- if(getCachedResourceSync(child)==null) {
- possibleIgnores.add(child);
- }
- if(child.getType()!=IResource.FILE) {
- accumulateNonManagedChildren((IContainer)child, possibleIgnores);
- }
- }
- } catch(CoreException e) {
- throw CVSException.wrapException(e);
- }
- }
-
/**
* Returns the members of this folder including deleted resources with sync info,
* but excluding special resources such as CVS subdirectories.
@@ -321,21 +303,26 @@ public class EclipseSynchronizer {
* Ends a batch of operations. Pending changes are committed only when
* the number of calls to endOperation() balances those to beginOperation().
* <p>
- * Will throw a CVS Exception with a status with code = CVSStatus.DELETION_FAILED
- * if the endOperation could not perform CVS folder deletions. In this case, all other
- * aspects of the operation succeeded.
+ * Progress cancellation is ignored while writting the cache to disk. This
+ * is to ensure cache to disk consistency.
* </p>
+ *
* @param monitor the progress monitor, may be null
+ * @exception CVSException with a status with code <code>COMMITTING_SYNC_INFO_FAILED</code>
+ * if all the CVS sync information could not be written to disk.
*/
- public void endOperation(IProgressMonitor monitor) throws CVSException {
- IStatus status = STATUS_OK;
- if (nestingCount == 1) {
- status = commitCache(monitor);
- }
- nestingCount -= 1;
- Assert.isTrue(nestingCount>= 0);
- if (status != STATUS_OK) {
- throw new CVSException(status);
+ public void endOperation(IProgressMonitor monitor) throws CVSException {
+ try {
+ IStatus status = STATUS_OK;
+ if (nestingCount == 1) {
+ status = commitCache(monitor);
+ }
+ if (status != STATUS_OK) {
+ throw new CVSException(status);
+ }
+ } finally {
+ nestingCount -= 1;
+ Assert.isTrue(nestingCount>= 0);
}
}
@@ -401,12 +388,14 @@ public class EclipseSynchronizer {
/**
* Commits the cache after a series of operations.
*
- * Will return STATUS_OK unless there were problems deleting the CVS folders, in
- * which case a status with code = CVSStatus.DELETION_FAILED is returned.
+ * Will return STATUS_OK unless there were problems writting sync
+ * information to disk. If an error occurs a multistatus is returned
+ * with the list of reasons for the failures. Failures are recovered,
+ * and all changed resources are given a chance to be written to disk.
*
* @param monitor the progress monitor, may be null
*/
- private IStatus commitCache(IProgressMonitor monitor) throws CVSException {
+ private IStatus commitCache(IProgressMonitor monitor) {
if (changedFolders.isEmpty() && changedResources.isEmpty()) return STATUS_OK;
List errors = new ArrayList();
try {
@@ -423,28 +412,36 @@ public class EclipseSynchronizer {
int numDirty = dirtyParents.size();
int numResources = changedFolders.size() + numDirty;
monitor.beginTask(null, numResources);
- monitor.subTask(Policy.bind("EclipseSynchronizer_updatingSyncEndOperation")); //$NON-NLS-1$
+ if(monitor.isCanceled()) {
+ monitor.subTask(Policy.bind("EclipseSynchronizer.UpdatingSyncEndOperationCancelled")); //$NON-NLS-1$
+ } else {
+ monitor.subTask(Policy.bind("EclipseSynchronizer.UpdatingSyncEndOperation")); //$NON-NLS-1$
+ }
/*** write sync info to disk ***/
// folder sync info changes
for(Iterator it = changedFolders.iterator(); it.hasNext();) {
IContainer folder = (IContainer) it.next();
if (folder.exists() && folder.getType() != IResource.ROOT) {
- FolderSyncInfo info = getCachedFolderSync(folder);
- if (info == null) {
- // deleted folder sync info since we loaded it
- try {
+ try {
+ FolderSyncInfo info = getCachedFolderSync(folder);
+ if (info == null) {
+ // deleted folder sync info since we loaded it
SyncFileWriter.deleteFolderSync(folder);
- } catch (CVSException e) {
- errors.add(e.getStatus());
+ dirtyParents.remove(folder);
+ } else {
+ // modified or created new folder sync info since we loaded it
+ SyncFileWriter.writeFolderSync(folder, info);
}
- dirtyParents.remove(folder);
- } else {
- // modified or created new folder sync info since we loaded it
- SyncFileWriter.writeFolderSync(folder, info);
+ } catch(CVSException e) {
+ try {
+ purgeCache(folder, true /* deep */);
+ } catch(CVSException pe) {
+ errors.add(pe.getStatus());
+ }
+ errors.add(e.getStatus());
}
}
- Policy.checkCanceled(monitor);
monitor.worked(1);
}
@@ -456,11 +453,19 @@ public class EclipseSynchronizer {
IContainer folder = (IContainer) it.next();
if (folder.exists() && folder.getType() != IResource.ROOT) {
// write sync info for all children in one go
- Collection infos = getCachedResourceSyncForChildren(folder);
- SyncFileWriter.writeAllResourceSync(folder,
- (ResourceSyncInfo[]) infos.toArray(new ResourceSyncInfo[infos.size()]));
+ try {
+ Collection infos = getCachedResourceSyncForChildren(folder);
+ SyncFileWriter.writeAllResourceSync(folder,
+ (ResourceSyncInfo[]) infos.toArray(new ResourceSyncInfo[infos.size()]));
+ } catch(CVSException e) {
+ try {
+ purgeCache(folder, false /* depth 1 */);
+ } catch(CVSException pe) {
+ errors.add(pe.getStatus());
+ }
+ errors.add(e.getStatus());
+ }
}
- Policy.checkCanceled(monitor);
monitor.worked(1);
}
@@ -472,7 +477,10 @@ public class EclipseSynchronizer {
changedResources.clear();
changedFolders.clear();
if ( ! errors.isEmpty()) {
- MultiStatus status = new MultiStatus(CVSProviderPlugin.ID, CVSStatus.DELETION_FAILED, Policy.bind("EclipseSynchronizer.ErrorDeletingFolderSync"), null);//$NON-NLS-1$
+ MultiStatus status = new MultiStatus(CVSProviderPlugin.ID,
+ CVSStatus.COMMITTING_SYNC_INFO_FAILED,
+ Policy.bind("EclipseSynchronizer.ErrorCommitting"), //$NON-NLS-1$
+ null);
for (int i = 0; i < errors.size(); i++) {
status.merge((IStatus)errors.get(i));
}
@@ -725,4 +733,29 @@ public class EclipseSynchronizer {
throw CVSException.wrapException(e);
}
}
+
+ /**
+ * Recursively adds to the possibleIgnores list all children of the given
+ * folder that can be ignored.
+ *
+ * @param folder the folder to be searched
+ * @param possibleIgnores the list of IResources that can be ignored
+ */
+ private void accumulateNonManagedChildren(IContainer folder, List possibleIgnores) throws CVSException {
+ try {
+ cacheResourceSyncForChildren(folder);
+ IResource[] children = folder.members();
+ for (int i = 0; i < children.length; i++) {
+ IResource child = children[i];
+ if(getCachedResourceSync(child)==null) {
+ possibleIgnores.add(child);
+ }
+ if(child.getType()!=IResource.FILE) {
+ accumulateNonManagedChildren((IContainer)child, possibleIgnores);
+ }
+ }
+ } catch(CoreException e) {
+ throw CVSException.wrapException(e);
+ }
+ }
} \ No newline at end of file

Back to the top