Fix trivial usages of deprecated RefDatabase.getRefs method
getRefs(String) returns Map<String, Ref>; most callers only call its values() method and iterate over the list of Ref objects. It's trivial to replace those calls with getRefsByPrefix which returns a List<Ref>. Change-Id: Iad142ea8a0dec69b22fcec084bb66eafd79c2a0d
This commit is contained in:
@@ -18,7 +18,7 @@ import com.google.common.flogger.FluentLogger;
|
||||
import com.google.gerrit.common.data.Capable;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
|
||||
@@ -89,9 +89,9 @@ public final class MagicBranch {
|
||||
}
|
||||
|
||||
private static Capable checkMagicBranchRef(String branchName, Repository repo, Project project) {
|
||||
Map<String, Ref> blockingFors;
|
||||
List<Ref> blockingFors;
|
||||
try {
|
||||
blockingFors = repo.getRefDatabase().getRefs(branchName);
|
||||
blockingFors = repo.getRefDatabase().getRefsByPrefix(branchName);
|
||||
} catch (IOException err) {
|
||||
String projName = project.getName();
|
||||
logger.atWarning().withCause(err).log("Cannot scan refs in '%s'", projName);
|
||||
@@ -101,7 +101,7 @@ public final class MagicBranch {
|
||||
String projName = project.getName();
|
||||
logger.atSevere().log(
|
||||
"Repository '%s' needs the following refs removed to receive changes: %s",
|
||||
projName, blockingFors.keySet());
|
||||
projName, blockingFors);
|
||||
return new Capable("One or more " + branchName + " names blocks change upload");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user