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

Re: Reproduction recipe for failing package rename

From: Gerco Ballintijn <gerco_at_cwi.nl>
Date: 2004-04-18 17:20:08 CEST

Hi,

Cédric Chabanois wrote:
>
> Thanks for your "recipe".
>
> I will try to correct this bug soon.
>
> Cédric
>

I've tracked down my rename problem to a synchronization issue of the
contents of the .svn directory. I've attached a patch that solves the
problem for me. It is tested on Linux with eclipse 3M7 and subversion
1.0.1. The patch against revision 560 of the subclipse-3 branch.

Gerco.

Index: core/src/org/tigris/subversion/subclipse/core/resources/LocalFolder.java
===================================================================
--- core/src/org/tigris/subversion/subclipse/core/resources/LocalFolder.java (revision 560)
+++ core/src/org/tigris/subversion/subclipse/core/resources/LocalFolder.java (working copy)
@@ -169,6 +169,10 @@
         if (!isManaged()) {
             return container.exists();
         }
+
+ ISVNStatus status = getStatus();
+ if (status.getTextStatus() == ISVNStatus.Kind.DELETED)
+ return true;
         
         ISVNLocalResource[] children = (ISVNLocalResource[])members(new NullProgressMonitor(),ALL_UNIGNORED_MEMBERS);
 
Index: core/src/org/tigris/subversion/subclipse/core/client/OperationManager.java
===================================================================
--- core/src/org/tigris/subversion/subclipse/core/client/OperationManager.java (revision 560)
+++ core/src/org/tigris/subversion/subclipse/core/client/OperationManager.java (working copy)
@@ -9,6 +9,7 @@
  * Cédric Chabanois (cchabanois@ifrance.com) - modified for Subversion
  *******************************************************************************/
 package org.tigris.subversion.subclipse.core.client;
+
 import java.io.*;
 import java.util.*;
 import org.eclipse.core.resources.*;
@@ -16,6 +17,7 @@
 import org.tigris.subversion.subclipse.core.*;
 import org.tigris.subversion.subclipse.core.util.*;
 import org.tigris.subversion.svnclientadapter.*;
+
 /**
  * This class manages jsvn operations. beginOperation must be called before a
  * batch of svn operations and endOperation after
@@ -26,13 +28,16 @@
         // track resources that have changed in a given operation
         private ReentrantLock lock = new ReentrantLock();
         private Set changedResources = new HashSet();
+ private Set changedSVNResources = new HashSet();
         private ISVNClientAdapter svnClient = null;
         private static OperationManager instance;
+
         /*
          * private contructor
          */
         private OperationManager() {
         }
+
         /**
          * Returns the singleton instance of the synchronizer.
          */
@@ -40,8 +45,10 @@
                 if (instance == null) {
                         instance = new OperationManager();
                 }
+
                 return instance;
         }
+
         /**
          * Begins a batch of operations.
          */
@@ -53,6 +60,7 @@
                         changedResources.clear();
                 }
         }
+
         /**
          * Ends a batch of operations. Pending changes are committed only when the
          * number of calls to endOperation() balances those to beginOperation().
@@ -61,64 +69,106 @@
                 try {
                         if (lock.getNestingCount() == 1) {
                                 svnClient.removeNotifyListener(this);
+
                                 for (Iterator it = changedResources.iterator(); it.hasNext();) {
                                         IResource resource = (IResource) it.next();
                                         try {
                                                 resource.refreshLocal(IResource.DEPTH_ZERO,
- new NullProgressMonitor());
+ new NullProgressMonitor());
                                         } catch (CoreException e) {
                                                 throw SVNException.wrapException(e);
                                         }
                                 }
+
+ for (Iterator it = changedSVNResources.iterator(); it.hasNext();) {
+ IResource resource = (IResource) it.next();
+ try {
+ resource.refreshLocal(IResource.DEPTH_INFINITE,
+ new NullProgressMonitor());
+ } catch (CoreException e) {
+ throw SVNException.wrapException(e);
+ }
+ }
                         }
                 } finally {
                         lock.release();
                 }
         }
+
         public void onNotify(File path, SVNNodeKind kind) {
                 IWorkspace workspace = ResourcesPlugin.getWorkspace();
                 IWorkspaceRoot workspaceRoot = workspace.getRoot();
- IPath pathEclipse;
                 try {
- pathEclipse = new Path(path.getCanonicalPath());
+ IResource resource;
+ IResource dotSVN;
+ IResource entries;
+
+ IPath pathEclipse = new Path(path.getCanonicalPath());
                         if (kind == SVNNodeKind.UNKNOWN) { // delete, revert
- IPath pathEntries = pathEclipse.removeLastSegments(1).append(
- ".svn/entries");
- IResource entries = workspaceRoot
- .getFileForLocation(pathEntries);
- changedResources.add(entries);
- } else {
- IResource resource = null;
- if (kind == SVNNodeKind.DIR)
- resource = workspaceRoot
- .getContainerForLocation(pathEclipse);
- else if (kind == SVNNodeKind.FILE)
- resource = workspaceRoot.getFileForLocation(pathEclipse);
- IResource entries = null;
- if (resource != null)
- entries = resource.getParent().getFile(
- new Path(".svn/entries"));
- if (resource != null) {
- // this is not really necessary because as .svn/entries is
- // added, the
- // corresponding directory will be refreshed
- changedResources.add(resource);
+ IPath pathDotSVN = pathEclipse.removeLastSegments(1).append(".svn");
+ dotSVN = workspaceRoot.getContainerForLocation(pathDotSVN);
+ if (dotSVN != null)
+ changedSVNResources.add(dotSVN);
+
+ IPath pathEntries = pathEclipse.removeLastSegments(1).append(".svn/entries");
+ entries = workspaceRoot.getFileForLocation(pathEntries);
+ if (entries != null)
+ changedSVNResources.add(entries);
+ } else if (kind == SVNNodeKind.DIR) {
+ resource = workspaceRoot.getContainerForLocation(pathEclipse);
+ if (resource.getType() == IResource.FOLDER) {
+ dotSVN = resource.getParent().getFolder(new Path(".svn"));
+ if (dotSVN != null)
+ changedSVNResources.add(dotSVN);
+
+ entries = resource.getParent().getFile(new Path(".svn/entries"));
+ if (entries != null)
+ changedSVNResources.add(entries);
                                 }
+
+ // this is not really necessary because as .svn/entries is
+ // added, the corresponding directory will be refreshed
+ changedResources.add(resource);
+
+ // Add meta data of directory/folder
+ dotSVN = ((IContainer)resource).getFolder(new Path(".svn"));
+ if (dotSVN != null)
+ changedSVNResources.add(dotSVN);
+
+ entries = ((IContainer)resource).getFile(new Path(".svn/entries"));
                                 if (entries != null)
- changedResources.add(entries);
+ changedSVNResources.add(entries);
+ } else if (kind == SVNNodeKind.FILE) {
+ resource = workspaceRoot.getFileForLocation(pathEclipse);
+ dotSVN = resource.getParent().getFolder(new Path(".svn"));
+ if (dotSVN != null)
+ changedSVNResources.add(dotSVN);
+
+ entries = resource.getParent().getFile(new Path(".svn/entries"));
+ if (entries != null)
+ changedSVNResources.add(entries);
+
+ // this is not really necessary because as .svn/entries is
+ // added, the corresponding directory will be refreshed
+ changedResources.add(resource);
                         }
                 } catch (IOException e) {
- e.printStackTrace();//shouldn't happen?
+ e.printStackTrace(); //shouldn't happen?
                 }
         }
+
         public void logCommandLine(String commandLine) {
         }
+
         public void logCompleted(String message) {
         }
+
         public void logError(String message) {
         }
+
         public void logMessage(String message) {
         }
+
         public void setCommand(int command) {
         }
 }
Received on Mon Apr 19 01:20:08 2004

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

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