rpms/svnkit/F-13 svnkit-1.3.2-ISVNStatusFileProvider.patch, NONE, 1.1 svnkit.spec, 1.14, 1.15

Lubomir Rintel lkundrak at fedoraproject.org
Fri Mar 5 10:41:58 UTC 2010


Author: lkundrak

Update of /cvs/pkgs/rpms/svnkit/F-13
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv9458

Modified Files:
	svnkit.spec 
Added Files:
	svnkit-1.3.2-ISVNStatusFileProvider.patch 
Log Message:
Merge from devel

svnkit-1.3.2-ISVNStatusFileProvider.patch:
 internal/wc/SVNStatusEditor.java |   66 +++++++++++++++++++++++++++------------
 wc/ISVNStatusFileProvider.java   |   12 +++++++
 wc/SVNStatusClient.java          |    9 ++++-
 3 files changed, 66 insertions(+), 21 deletions(-)

--- NEW FILE svnkit-1.3.2-ISVNStatusFileProvider.patch ---
Merged into trunk in r6418.

------------------------------------------------------------------------
r5680 | semen | 2009-04-08 13:08:05 +0200 (Wed, 08 Apr 2009) | 1 line

Applied patch contributed by Irina Chernoushina
(Irina.Chernushina at jetbrains.com) - added callback for fetching
directory's children during the local status
---
 .../svn/core/internal/wc/SVNStatusEditor.java      |   66 ++++++++++++++------
 .../svn/core/wc/ISVNStatusFileProvider.java        |   12 ++++
 .../org/tmatesoft/svn/core/wc/SVNStatusClient.java |    8 +++
 3 files changed, 66 insertions(+), 20 deletions(-)
 create mode 100644 svnkit/src/org/tmatesoft/svn/core/wc/ISVNStatusFileProvider.java

diff --git a/svnkit/src/org/tmatesoft/svn/core/internal/wc/SVNStatusEditor.java b/svnkit/src/org/tmatesoft/svn/core/internal/wc/SVNStatusEditor.java
index a7b6626..3757752 100644
--- a/svnkit/src/org/tmatesoft/svn/core/internal/wc/SVNStatusEditor.java
+++ b/svnkit/src/org/tmatesoft/svn/core/internal/wc/SVNStatusEditor.java
@@ -11,14 +11,6 @@
  */
 package org.tmatesoft.svn.core.internal.wc;
 
-import java.io.File;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.TreeMap;
-
 import org.tmatesoft.svn.core.SVNCommitInfo;
 import org.tmatesoft.svn.core.SVNDepth;
 import org.tmatesoft.svn.core.SVNException;
@@ -34,11 +26,20 @@ import org.tmatesoft.svn.core.internal.wc.admin.SVNAdminAreaInfo;
 import org.tmatesoft.svn.core.internal.wc.admin.SVNEntry;
 import org.tmatesoft.svn.core.internal.wc.admin.SVNWCAccess;
 import org.tmatesoft.svn.core.wc.ISVNOptions;
+import org.tmatesoft.svn.core.wc.ISVNStatusFileProvider;
 import org.tmatesoft.svn.core.wc.ISVNStatusHandler;
 import org.tmatesoft.svn.core.wc.SVNStatus;
 import org.tmatesoft.svn.core.wc.SVNStatusType;
 import org.tmatesoft.svn.core.wc.SVNTreeConflictDescription;
 
+import java.io.File;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.StringTokenizer;
+import java.util.TreeMap;
+
 
 /**
  * @version 1.3
@@ -61,7 +62,9 @@ public class SVNStatusEditor {
     private SVNURL myRepositoryRoot;
     private Map myRepositoryLocks;
     private long myTargetRevision;
-    
+    private ISVNStatusFileProvider myFileProvider;
+    private ISVNStatusFileProvider myDefaultFileProvider;
+
     public SVNStatusEditor(ISVNOptions options, SVNWCAccess wcAccess, SVNAdminAreaInfo info, boolean noIgnore, boolean reportAll, SVNDepth depth,
             ISVNStatusHandler handler) {
         myWCAccess = wcAccess;
@@ -73,6 +76,8 @@ public class SVNStatusEditor {
         myExternalsMap = new SVNHashMap();
         myGlobalIgnores = getGlobalIgnores(options);
         myTargetRevision = -1;
+        myDefaultFileProvider = new DefaultSVNStatusFileProvider();
+        myFileProvider = myDefaultFileProvider;
     }
     
     public long getTargetRevision() {
@@ -121,7 +126,7 @@ public class SVNStatusEditor {
             ISVNStatusHandler handler) throws SVNException {
         myWCAccess.checkCancelled();
         depth = depth == SVNDepth.UNKNOWN ? SVNDepth.INFINITY : depth;
-        Map childrenFiles = getChildrenFiles(dir.getRoot());
+        Map childrenFiles = myFileProvider.getChildrenFiles(dir.getRoot());
         SVNEntry dirEntry = myWCAccess.getEntry(dir.getRoot(), false);
 
         String externals = dir.getProperties(dir.getThisDirName()).getStringPropertyValue(SVNProperty.EXTERNALS);
@@ -397,17 +402,38 @@ public class SVNStatusEditor {
         }
         return false;
     }
-    
-    private static Map getChildrenFiles(File parent) {
-        File[] children = SVNFileListUtil.listFiles(parent);
-        if (children != null) {
-            Map map = new SVNHashMap();
-            for (int i = 0; i < children.length; i++) {
-                map.put(children[i].getName(), children[i]);
+
+    public void setFileProvider(ISVNStatusFileProvider fileProvider) {
+        myFileProvider = new WrapperSVNStatusFileProvider(myDefaultFileProvider, fileProvider);
+    }
+
+    private static class WrapperSVNStatusFileProvider implements ISVNStatusFileProvider {
+        private final ISVNStatusFileProvider myDefault;
+        private final ISVNStatusFileProvider myDelegate;
+
+        private WrapperSVNStatusFileProvider(ISVNStatusFileProvider defaultProvider, ISVNStatusFileProvider delegate) {
+            myDefault = defaultProvider;
+            myDelegate = delegate;
+        }
+
+        public Map getChildrenFiles(File parent) {
+            final Map result = myDelegate.getChildrenFiles(parent);
+            if (result != null) return result;
+            return myDefault.getChildrenFiles(parent);
+        }
+    }
+
+    private static class DefaultSVNStatusFileProvider implements ISVNStatusFileProvider {
+        public Map getChildrenFiles(File parent) {
+            File[] children = SVNFileListUtil.listFiles(parent);
+            if (children != null) {
+                Map map = new SVNHashMap();
+                for (int i = 0; i < children.length; i++) {
+                    map.put(children[i].getName(), children[i]);
+                }
+                return map;
             }
-            return map;
+            return Collections.EMPTY_MAP;
         }
-        return Collections.EMPTY_MAP;
     }
-    
 }
diff --git a/svnkit/src/org/tmatesoft/svn/core/wc/ISVNStatusFileProvider.java b/svnkit/src/org/tmatesoft/svn/core/wc/ISVNStatusFileProvider.java
new file mode 100644
index 0000000..d7a83f0
--- /dev/null
+++ b/svnkit/src/org/tmatesoft/svn/core/wc/ISVNStatusFileProvider.java
@@ -0,0 +1,12 @@
+package org.tmatesoft.svn.core.wc;
+
+import java.util.Map;
+import java.io.File;
+
+public interface ISVNStatusFileProvider {
+    /**
+     * Returns Map (key = file name, value = java.io.File) of files under dir that client is interested in
+     * @return should return null for the case when file list should be calculated outside
+     */
+    Map getChildrenFiles(File parent);
+}
diff --git a/svnkit/src/org/tmatesoft/svn/core/wc/SVNStatusClient.java b/svnkit/src/org/tmatesoft/svn/core/wc/SVNStatusClient.java
index 9e955d8..d8bb72e 100644
--- a/svnkit/src/org/tmatesoft/svn/core/wc/SVNStatusClient.java
+++ b/svnkit/src/org/tmatesoft/svn/core/wc/SVNStatusClient.java
@@ -77,6 +77,7 @@ import org.tmatesoft.svn.util.SVNLogType;
  * @see     <a target="_top" href="http://svnkit.com/kb/examples/">Examples</a>
  */
 public class SVNStatusClient extends SVNBasicClient {
+    private ISVNStatusFileProvider myFilesProvider;
 
     /**
      * Constructs and initializes an <b>SVNStatusClient</b> object
@@ -373,6 +374,9 @@ public class SVNStatusClient extends SVNBasicClient {
                 }
             } else {
                 editor = new SVNStatusEditor(getOptions(), wcAccess, info, includeIgnored, reportAll, depth, handler);
+                if (myFilesProvider != null) {
+                    editor.setFileProvider(myFilesProvider);
+                }
                 editor.closeEdit();
             }         
             if (!isIgnoreExternals() && (depth == SVNDepth.INFINITY || depth == SVNDepth.UNKNOWN)) {
@@ -472,4 +476,8 @@ public class SVNStatusClient extends SVNBasicClient {
         doStatus(absPath, SVNRevision.HEAD, SVNDepth.EMPTY, remote, true, true, collectParentExternals, handler, null);
         return result[0];
     }
+
+    public void setFilesProvider(ISVNStatusFileProvider filesProvider) {
+        myFilesProvider = filesProvider;
+    }
 }
-- 
1.6.6



Index: svnkit.spec
===================================================================
RCS file: /cvs/pkgs/rpms/svnkit/F-13/svnkit.spec,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -p -r1.14 -r1.15
--- svnkit.spec	3 Dec 2009 11:35:15 -0000	1.14
+++ svnkit.spec	5 Mar 2010 10:41:57 -0000	1.15
@@ -13,7 +13,7 @@
 
 Name:           svnkit
 Version:        1.3.2
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Pure Java Subversion client library
 
 Group:          Development/Tools
@@ -25,6 +25,7 @@ URL:            http://www.svnkit.com/
 # zip $FILE -d \*.jar
 Source0:        org.tmatesoft.svn_%{version}.src-CLEAN.zip
 Patch0:         svnkit-1.3.2-dependencies.patch
+Patch1:         svnkit-1.3.2-ISVNStatusFileProvider.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
@@ -72,6 +73,7 @@ Eclipse feature for SVNKit - Java Subver
 %prep
 %setup -q -n %{name}-src-%{version}.%{svn_revision}
 %patch0 
+%patch1 -p1
 
 # delete the jars that are in the archive
 JAR_files=""
@@ -167,6 +169,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Fri Mar 05 2010 Lubomir Rintel <lkundrak at v3.sk> 1.3.2-2
+- Cherry-pick r6418 from upstream
+
 * Thu Dec 3 2009 Alexander Kurtakov <akurtako at redhat.com> 1.3.2-1
 - Update to 1.3.2.
 



More information about the scm-commits mailing list