From 841f6a7624b023c80e498d9056670d9e4e0ebfdb Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mar 05 2010 10:28:48 +0000 Subject: - Cherry-pick r6418 from upstream --- diff --git a/svnkit-1.3.2-ISVNStatusFileProvider.patch b/svnkit-1.3.2-ISVNStatusFileProvider.patch new file mode 100644 index 0000000..c09892b --- /dev/null +++ b/svnkit-1.3.2-ISVNStatusFileProvider.patch @@ -0,0 +1,185 @@ +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@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 Examples + */ + public class SVNStatusClient extends SVNBasicClient { ++ private ISVNStatusFileProvider myFilesProvider; + + /** + * Constructs and initializes an SVNStatusClient 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 + diff --git a/svnkit.spec b/svnkit.spec index 45f7494..bed924d 100644 --- a/svnkit.spec +++ b/svnkit.spec @@ -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 Subversion client library. %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 1.3.2-2 +- Cherry-pick r6418 from upstream + * Thu Dec 3 2009 Alexander Kurtakov 1.3.2-1 - Update to 1.3.2.