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

Re: brockj and pkorros for committers

From: Brock Janiczak <brockj_eclipse_at_ihug.com.au>
Date: 2004-07-13 09:39:23 CEST

Don't worry, there is always room for more profiling :)
Can you please try the attached patch and let me know if it makes it any
quicker for you?

This solution is only temporary, as it will do a recursive status update
when any status update is required. It looks like the real problem is
that in the svnClientAdapter (javahl) getStatus(File[]) calls
getStatusSingle(File). Each of these calls seems to have the overhead
of establishing a connection to the server. I have noticed that the
command line client also takes a while to connect to the server.
Perhaps the real problem is inside the svn client libraries?

Does anyone know of a good (free) profiler? If not i can always use
work's copy of OptimizeIt :)

Index:
d:/data/eclipse/workspace/core/src/org/tigris/subversion/subclipse/core/resources/LocalResourceStatusCache.java
===================================================================

---
d:/data/eclipse/workspace/core/src/org/tigris/subversion/subclipse/core/resources/LocalResourceStatusCache.java 
(revision 742)
+++
d:/data/eclipse/workspace/core/src/org/tigris/subversion/subclipse/core/resources/LocalResourceStatusCache.java 
(working copy)
@@ -96,6 +96,52 @@
         return (IResource[])resourcesSet.toArray(new
IResource[resourcesSet.size()]);
     }
+    private static void recursiveUpdateStatus(IResource resource) 
throws SVNException {
+        IWorkspace workspace = ResourcesPlugin.getWorkspace();
+        IWorkspaceRoot workspaceRoot = workspace.getRoot();
+
+        // don't do getRepository().getSVNClient() as we can ask the
status of a file
+        // that is not associated with a known repository
+        // we don't need login & password so this is not a problem
+        ISVNStatus[] statuses = null;
+        try {
+            ISVNClientAdapter svnClientAdapterStatus =
SVNProviderPlugin.getPlugin().createSVNClient();
+            statuses =
svnClientAdapterStatus.getStatus(resource.getLocation().toFile(),true,
true);
+        } catch (SVNClientException e1) {
+            throw SVNException.wrapException(e1);
+        }
+
+        for (int i = 0; i < statuses.length;i++) {
+            ISVNStatus status = statuses[i];
+            IPath pathEclipse = null;
+            File file = status.getFile();
+            try {
+                String canonicalPath = file.getCanonicalPath();
+                pathEclipse = new Path(canonicalPath);
+            } catch (IOException e) {
+                // should never occur ...
+            }
+
+            IResource resourceStatus = null;
+            if (file.isDirectory()) {
+                resourceStatus =
workspaceRoot.getContainerForLocation(pathEclipse);
+            }
+            else
+            if (file.isFile()) {
+                resourceStatus =
workspaceRoot.getFileForLocation(pathEclipse);
+            }
+
+            if (resourceStatus != null) {
+                try {
+
resourceStatus.setSessionProperty(RESOURCE_SYNC_KEY, status);
+                } catch (CoreException e) {
+                    // can't set the property (because the resource
does not exist
+                    // for example)
+                }
+            }
+        }
+    }
+
     /**
      * update the status of resource and near resources that also need
to be updated
      * @param resource
@@ -171,7 +215,8 @@
         if (status == null)
         {
-            updateStatusSet(resource);
+//            updateStatusSet(resource);
+            recursiveUpdateStatus(resource);
             try {
                 status = (ISVNStatus)
resource.getSessionProperty(RESOURCE_SYNC_KEY);
Panayiotis Korros wrote:
>Brock, you are so quick... I wanted to profile the decorators myself but you
>did it first!
>Good work!
>
>By the way revision 743 is Brock's work not mine. Can someone fix it?
>  
>
Received on Tue Jul 13 17:39:23 2004

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