Revert "Remove unused method to create change notes based on index lookup"
This reverts commit de14d8f091c7730feefdd4d3e39b18024da6c790.
Reason for revert: This method is still used by plugins, such as
https://gerrit.googlesource.com/plugins/depends-on/+/refs/heads/stable-3.9/src/main/java/com/googlesource/gerrit/plugins/depends/on/DependsOnOperator.java#44
Release-Notes: skip
Forward-Compatible: checked
Change-Id: Icd058896436e28c52c5f39b475e15fce02d1aa0f
diff --git a/java/com/google/gerrit/server/notedb/ChangeNotes.java b/java/com/google/gerrit/server/notedb/ChangeNotes.java
index 97d65be..a7da7ad 100644
--- a/java/com/google/gerrit/server/notedb/ChangeNotes.java
+++ b/java/com/google/gerrit/server/notedb/ChangeNotes.java
@@ -214,6 +214,25 @@
return changes.get(0).notes();
}
+ /**
+ * Create change notes based on a list of {@link com.google.gerrit.entities.Change.Id}s. This
+ * requires using the Change index and should only be used when {@link
+ * com.google.gerrit.entities.Project.NameKey} and the numeric change ID are not available.
+ */
+ @UsedAt(UsedAt.Project.PLUGINS_ALL)
+ @Deprecated(since = "3.10", forRemoval = true)
+ public List<ChangeNotes> createUsingIndexLookup(Collection<Change.Id> changeIds) {
+ List<ChangeNotes> notes = new ArrayList<>();
+ for (Change.Id changeId : changeIds) {
+ try {
+ notes.add(createCheckedUsingIndexLookup(changeId));
+ } catch (NoSuchChangeException e) {
+ // Ignore missing changes to match Access#get(Iterable) behavior.
+ }
+ }
+ return notes;
+ }
+
public List<ChangeNotes> create(
Repository repo,
Project.NameKey project,