Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2013-07-26 15:01:01 +0000
committerRobin Stocker2013-08-30 14:51:02 +0000
commit58db783700332964d837bd882bc6ceec76c81b12 (patch)
tree1f0163c19edfe80985a6fe927405b41108490d51 /org.eclipse.egit.core
parentebcf1b71b4cdcd3a707588484d2d426c7153ada3 (diff)
downloadegit-58db783700332964d837bd882bc6ceec76c81b12.tar.gz
egit-58db783700332964d837bd882bc6ceec76c81b12.tar.xz
egit-58db783700332964d837bd882bc6ceec76c81b12.zip
Fix inefficient implementation of GitScopeOperation
The problem before was that it executed an expensive "git status" operation for each resource, even when the resource was in the same repository. It now processes the resources grouped by repository and uses the cached index diff data from IndexDiffCache. Bug: 412503 Change-Id: Ic7b38a93f8675656c081361e32446528587e6d22 Signed-off-by: Robin Stocker <robin@nibor.org>
Diffstat (limited to 'org.eclipse.egit.core')
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/internal/util/ResourceUtil.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/util/ResourceUtil.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/util/ResourceUtil.java
index 0d362ee317..f4f770e14f 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/util/ResourceUtil.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/util/ResourceUtil.java
@@ -13,6 +13,7 @@ package org.eclipse.egit.core.internal.util;
import java.net.URI;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashSet;
@@ -106,7 +107,7 @@ public class ResourceUtil {
* occurring repository
*/
public static Map<Repository, Collection<String>> splitResourcesByRepository(
- IResource[] resources) {
+ Collection<IResource> resources) {
Map<Repository, Collection<String>> result = new HashMap<Repository, Collection<String>>();
for (IResource resource : resources) {
RepositoryMapping repositoryMapping = RepositoryMapping
@@ -120,6 +121,17 @@ public class ResourceUtil {
}
/**
+ * @see #splitResourcesByRepository(Collection)
+ * @param resources
+ * @return a map containing a list of repository relative paths for each
+ * occurring repository
+ */
+ public static Map<Repository, Collection<String>> splitResourcesByRepository(
+ IResource[] resources) {
+ return splitResourcesByRepository(Arrays.asList(resources));
+ }
+
+ /**
* The method splits the given paths by their repository. For each occurring
* repository a list is built containing the repository relative paths of
* the related resources.

Back to the top