[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: MoveDeleteHook cleanup questions

From: lamikr <lamikr_at_cc.jyu.fi>
Date: 2005-01-22 13:43:08 CET

Ok I did some tests and almost everything was ok. (I could not test the
new exception handling put it also seemed to be ok)

- I did have a project containing class Test.java
- I renamed it to Test2.java
- I synchronized the tree which showed that Test.java will be committed
to removed and Test2.java will be added
- Commit went ok
- I selected Test2.java from the project tree and started comparing it
with the local history files
    --> It was ok and showed that the current version is Test2.java but
ealier version in the history was Test.java

The problem was in the outgoing synchronization view, it was showing
that the Test.java should go in the repository even
it was just committed to be removed. (Properties showed that it was
unnumbered version and subclipse was willing to add it
in the repository)

Mika

Brock Janiczak wrote:

> I have attached the patch for those that are interested.
>
> Moved references to internal classes and removed unneeded processing
>
> * SVNMoveDeleteHoook.java
> Don't extend DefaultMoveDeleteHook because it is internal. Implement
> IMoveDeleteHook directly
> Removed out of sync checks as the workbench does this check for us
> already
> Don't create local history entries for moved files as the workbench
> des this too
> Don't set the task name as it is no more descriptive than the one
> already provided "Processing changes..."
> Use status from inital exception instead of creating a new one
>
>
>------------------------------------------------------------------------
>
>Index: d:/data/eclipse/workspace/core/src/org/tigris/subversion/subclipse/core/resources/SVNMoveDeleteHook.java
>===================================================================
>--- d:/data/eclipse/workspace/core/src/org/tigris/subversion/subclipse/core/resources/SVNMoveDeleteHook.java (revision 1211)
>+++ d:/data/eclipse/workspace/core/src/org/tigris/subversion/subclipse/core/resources/SVNMoveDeleteHook.java (working copy)
>@@ -10,19 +10,18 @@
>
> import java.io.File;
>
>-import org.eclipse.core.internal.resources.ResourceStatus;
> import org.eclipse.core.resources.IFile;
> import org.eclipse.core.resources.IFolder;
>+import org.eclipse.core.resources.IProject;
>+import org.eclipse.core.resources.IProjectDescription;
> import org.eclipse.core.resources.IResource;
>-import org.eclipse.core.resources.IResourceStatus;
>+import org.eclipse.core.resources.team.IMoveDeleteHook;
> import org.eclipse.core.resources.team.IResourceTree;
> import org.eclipse.core.runtime.CoreException;
> import org.eclipse.core.runtime.IProgressMonitor;
>-import org.eclipse.core.runtime.IStatus;
> import org.eclipse.core.runtime.NullProgressMonitor;
> import org.eclipse.team.core.RepositoryProvider;
> import org.eclipse.team.core.TeamException;
>-import org.eclipse.team.internal.core.DefaultMoveDeleteHook;
> import org.tigris.subversion.subclipse.core.ISVNLocalFile;
> import org.tigris.subversion.subclipse.core.ISVNLocalFolder;
> import org.tigris.subversion.subclipse.core.SVNException;
>@@ -31,13 +30,13 @@
> import org.tigris.subversion.svnclientadapter.ISVNClientAdapter;
> import org.tigris.subversion.svnclientadapter.SVNClientException;
>
>-public class SVNMoveDeleteHook extends DefaultMoveDeleteHook {
>+public class SVNMoveDeleteHook implements IMoveDeleteHook {
>
> public boolean deleteFile(IResourceTree tree, IFile file, int updateFlags,
> IProgressMonitor monitor) {
>
> if (SVNWorkspaceRoot.isLinkedResource(file))
>- return super.deleteFile(tree, file, updateFlags, monitor);
>+ return false;
>
> ISVNLocalFile resource = new LocalFile(file);
> try {
>@@ -46,16 +45,11 @@
> }
>
> monitor.beginTask(null, 1000);
>- monitor.setTaskName("Working..");
> resource.delete();
> tree.deletedFile(file);
>
> } catch (SVNException e) {
>- tree.failed(new org.eclipse.core.runtime.Status(
>- org.eclipse.core.runtime.Status.ERROR, "SUBCLIPSE", 0,
>- "Error removing file", e));
>- e.printStackTrace();
>- return true; // we attempted
>+ tree.failed(e.getStatus());
> } finally {
> monitor.done();
> }
>@@ -67,7 +61,7 @@
> int updateFlags, IProgressMonitor monitor) {
>
> if (SVNWorkspaceRoot.isLinkedResource(folder))
>- return super.deleteFolder(tree, folder, updateFlags, monitor);
>+ return false;
>
> ISVNLocalFolder resource = new LocalFolder(folder);
> try {
>@@ -76,16 +70,11 @@
> return false;
> }
> monitor.beginTask(null, 1000);
>- monitor.setTaskName("Working..");
> resource.delete();
> tree.deletedFolder(folder);
>
> } catch (SVNException e) {
>- tree.failed(new org.eclipse.core.runtime.Status(
>- org.eclipse.core.runtime.Status.ERROR, "SUBCLIPSE", 0,
>- "Error removing folder", e));
>- e.printStackTrace();
>- return true; // we attempted
>+ tree.failed(e.getStatus());
> } finally {
> monitor.done();
> }
>@@ -104,7 +93,7 @@
> IFile destination, int updateFlags, IProgressMonitor monitor) {
>
> if (SVNWorkspaceRoot.isLinkedResource(source))
>- return super.moveFile(tree, source, destination, updateFlags, monitor);
>+ return false;
>
> try {
> ISVNLocalFile resource = new LocalFile(source);
>@@ -115,31 +104,7 @@
> ISVNClientAdapter svnClient = resource.getRepository()
> .getSVNClient();
> monitor.beginTask(null, 1000);
>- monitor.setTaskName("Working..");
>
>- boolean force = (updateFlags & IResource.FORCE) != 0;
>- boolean keepHistory = (updateFlags & IResource.KEEP_HISTORY) != 0;
>-
>- // If the file is not in sync with the local file system and force
>- // is false,
>- // then signal that we have an error.
>- if (!force
>- && !tree.isSynchronized(source, IResource.DEPTH_INFINITE)) {
>- String message = org.eclipse.core.internal.utils.Policy
>- .bind(
>- "localstore.resourceIsOutOfSync", source.getFullPath().toString()); //$NON-NLS-1$
>- IStatus status = new ResourceStatus(
>- IResourceStatus.OUT_OF_SYNC_LOCAL,
>- source.getFullPath(), message);
>- tree.failed(status);
>- return true; // we attempted even if we failed
>- }
>-
>- // Add the file contents to the local history if requested by the
>- // user.
>- if (keepHistory)
>- tree.addToLocalHistory(source);
>-
> try {
> OperationManager.getInstance().beginOperation(svnClient);
>
>@@ -163,7 +128,7 @@
> // location
> //remove old location, add new location
> //fix for issue 87 -mml
>- source.copy(destination.getFullPath(), force, monitor);
>+ source.copy(destination.getFullPath(), updateFlags, monitor);
>
> svnClient.addFile(destination.getLocation().toFile());
> svnClient.remove(
>@@ -190,11 +155,7 @@
> }
>
> } catch (SVNException e) {
>- tree.failed(new org.eclipse.core.runtime.Status(
>- org.eclipse.core.runtime.Status.ERROR, "SUBCLIPSE", 0,
>- "Error move file", e));
>- e.printStackTrace();
>- return true; // we attempted
>+ tree.failed(e.getStatus());
> } finally {
> monitor.done();
> }
>@@ -205,7 +166,7 @@
> IFolder destination, int updateFlags, IProgressMonitor monitor) {
>
> if (SVNWorkspaceRoot.isLinkedResource(source))
>- return super.moveFolder(tree, source, destination, updateFlags, monitor);
>+ return false;
>
> try {
> ISVNLocalFolder resource = new LocalFolder(source);
>@@ -213,28 +174,9 @@
> return false;
>
> monitor.beginTask(null, 1000);
>- monitor.setTaskName("Working..");
>
>- // Check to see if we are synchronized with the local file system.
>- // If we are in sync then we can
>- // short circuit this method and do a file system only move.
>- // Otherwise we have to recursively
>- // try and move all resources, doing it in a best-effort manner.
>- boolean force = (updateFlags & IResource.FORCE) != 0;
>- if (!force
>- && !tree.isSynchronized(source, IResource.DEPTH_INFINITE)) {
>- String message = org.eclipse.core.internal.utils.Policy
>- .bind(
>- "localstore.resourceIsOutOfSync", source.getFullPath().toString());//$NON-NLS-1$
>- IStatus status = new ResourceStatus(IResourceStatus.ERROR,
>- source.getFullPath(), message);
>- tree.failed(status);
>- return true;
>- }
>+ ISVNClientAdapter svnClient = resource.getRepository().getSVNClient();
>
>- ISVNClientAdapter svnClient = resource.getRepository()
>- .getSVNClient();
>-
> try {
> OperationManager.getInstance().beginOperation(svnClient);
> // add destination directory to version control if necessary
>@@ -253,7 +195,7 @@
> // new location
> //remove old location, add new location
> //fix for issue 87 -mml
>- source.copy(destination.getFullPath(), force, monitor);
>+ source.copy(destination.getFullPath(), updateFlags, monitor);
> svnClient.remove(
> new File[] { source.getLocation().toFile() }, true);
> tree.deletedFolder(source);
>@@ -275,15 +217,25 @@
> }
>
> } catch (SVNException e) {
>- tree.failed(new org.eclipse.core.runtime.Status(
>- org.eclipse.core.runtime.Status.ERROR, "SUBCLIPSE", 0,
>- "Error move Folder " + source.getLocation(), e));
>- e.printStackTrace();
>- return true; // we attempted
>+ tree.failed(e.getStatus());
> } finally {
> monitor.done();
> }
> return true;
> }
>
>+ /* (non-Javadoc)
>+ * @see org.eclipse.core.resources.team.IMoveDeleteHook#deleteProject(org.eclipse.core.resources.team.IResourceTree, org.eclipse.core.resources.IProject, int, org.eclipse.core.runtime.IProgressMonitor)
>+ */
>+ public boolean deleteProject(IResourceTree tree, IProject project, int updateFlags, IProgressMonitor monitor) {
>+ return false;
>+ }
>+
>+ /* (non-Javadoc)
>+ * @see org.eclipse.core.resources.team.IMoveDeleteHook#moveProject(org.eclipse.core.resources.team.IResourceTree, org.eclipse.core.resources.IProject, org.eclipse.core.resources.IProjectDescription, int, org.eclipse.core.runtime.IProgressMonitor)
>+ */
>+ public boolean moveProject(IResourceTree tree, IProject source, IProjectDescription description, int updateFlags, IProgressMonitor monitor) {
>+ return false;
>+ }
>+
> }
>\ No newline at end of file
>
>
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@subclipse.tigris.org
>For additional commands, e-mail: dev-help@subclipse.tigris.org
>
Received on Sat Jan 22 23:43:08 2005

This is an archived mail posted to the Subclipse Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.