Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2018-05-04 05:19:19 +0000
committerMatthias Sohn2018-05-05 23:12:36 +0000
commit5dc48274d0ef2d0e634fb0618bb5aef0bf3955dd (patch)
treeb5182cb9269b62dfc0b035767438c4e4dbb47109 /org.eclipse.egit.core
parent788e4174e4d4e04707c3de8fcdead4a00ad35e89 (diff)
downloadegit-5dc48274d0ef2d0e634fb0618bb5aef0bf3955dd.tar.gz
egit-5dc48274d0ef2d0e634fb0618bb5aef0bf3955dd.tar.xz
egit-5dc48274d0ef2d0e634fb0618bb5aef0bf3955dd.zip
Replace deprecated getRefs() calls
getRefs() was recently deprecated for a new method getRefsByPrefix() in I4c92f852e8c1558095dd460b5fd7b602c1d82df1. This change redirects the majority of calls to the new method. 12 calls have not been replaced, since they are either part of public API or they actually use the keys of the formerly returned maps. Change-Id: Ie975212e7ebe4225de920043522d8d63a9bea229 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Diffstat (limited to 'org.eclipse.egit.core')
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java16
-rw-r--r--org.eclipse.egit.core/src/org/eclipse/egit/core/internal/storage/GitFileHistory.java15
2 files changed, 14 insertions, 17 deletions
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java
index b8c84e0c38..f57fd4ab44 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/RepositoryUtil.java
@@ -253,9 +253,9 @@ public class RepositoryUtil {
Map<String, Date> tagMap = new HashMap<>();
try (RevWalk rw = new RevWalk(repository)) {
- Map<String, Ref> tags = repository.getRefDatabase().getRefs(
+ List<Ref> tags = repository.getRefDatabase().getRefsByPrefix(
Constants.R_TAGS);
- for (Ref tagRef : tags.values()) {
+ for (Ref tagRef : tags) {
RevObject any = rw.parseAny(repository.resolve(tagRef.getName()));
if (any instanceof RevTag) {
RevTag tag = (RevTag) any;
@@ -313,9 +313,9 @@ public class RepositoryUtil {
Set<String> branchNames = new TreeSet<>();
// put this into a sorted set
try {
- Map<String, Ref> remoteBranches = repository
- .getRefDatabase().getRefs(Constants.R_HEADS);
- for (Ref branch : remoteBranches.values()) {
+ List<Ref> remoteBranches = repository.getRefDatabase()
+ .getRefsByPrefix(Constants.R_HEADS);
+ for (Ref branch : remoteBranches) {
ObjectId objectId = branch.getObjectId();
if (objectId != null
&& objectId.name().equals(commitId)) {
@@ -337,9 +337,9 @@ public class RepositoryUtil {
Set<String> branchNames = new TreeSet<>();
// put this into a sorted set
try {
- Map<String, Ref> remoteBranches = repository
- .getRefDatabase().getRefs(Constants.R_REMOTES);
- for (Ref branch : remoteBranches.values()) {
+ List<Ref> remoteBranches = repository.getRefDatabase()
+ .getRefsByPrefix(Constants.R_REMOTES);
+ for (Ref branch : remoteBranches) {
ObjectId objectId = branch.getObjectId();
if (objectId != null
&& objectId.name().equals(commitId)) {
diff --git a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/storage/GitFileHistory.java b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/storage/GitFileHistory.java
index 8767fc546d..fe4187f65b 100644
--- a/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/storage/GitFileHistory.java
+++ b/org.eclipse.egit.core/src/org/eclipse/egit/core/internal/storage/GitFileHistory.java
@@ -13,7 +13,6 @@ package org.eclipse.egit.core.internal.storage;
import java.io.IOException;
import java.util.Collections;
-import java.util.Map.Entry;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -24,11 +23,6 @@ import org.eclipse.egit.core.internal.CoreText;
import org.eclipse.egit.core.internal.Utils;
import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.egit.core.synchronize.GitRemoteResource;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.core.history.IFileHistoryProvider;
-import org.eclipse.team.core.history.IFileRevision;
-import org.eclipse.team.core.history.provider.FileHistory;
-import org.eclipse.team.core.variants.IResourceVariant;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
import org.eclipse.jgit.lib.AnyObjectId;
@@ -40,6 +34,11 @@ import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.treewalk.filter.AndTreeFilter;
import org.eclipse.jgit.treewalk.filter.PathFilterGroup;
import org.eclipse.jgit.treewalk.filter.TreeFilter;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.team.core.history.IFileHistoryProvider;
+import org.eclipse.team.core.history.IFileRevision;
+import org.eclipse.team.core.history.provider.FileHistory;
+import org.eclipse.team.core.variants.IResourceVariant;
/**
* A list of revisions for a specific resource according to some filtering
@@ -158,9 +157,7 @@ class GitFileHistory extends FileHistory implements IAdaptable {
private void markStartAllRefs(RevWalk theWalk, String prefix)
throws IOException, MissingObjectException,
IncorrectObjectTypeException {
- for (Entry<String, Ref> refEntry : db.getRefDatabase().getRefs(prefix)
- .entrySet()) {
- Ref ref = refEntry.getValue();
+ for (Ref ref : db.getRefDatabase().getRefsByPrefix(prefix)) {
if (ref.isSymbolic())
continue;
markStartRef(theWalk, ref);

Back to the top