Use change notes when available to load messages
Preferring change-notes over change-id eliminates the extra step of
determining the change project.
Change-Id: I892ab143557340c4218418c44b39859a5087c392
diff --git a/src/main/java/com/googlesource/gerrit/plugins/depends/on/DependsOnOperator.java b/src/main/java/com/googlesource/gerrit/plugins/depends/on/DependsOnOperator.java
index 5761248..871fb46 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/depends/on/DependsOnOperator.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/depends/on/DependsOnOperator.java
@@ -14,6 +14,7 @@
package com.googlesource.gerrit.plugins.depends.on;
+import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.index.query.PostFilterPredicate;
import com.google.gerrit.index.query.Predicate;
import com.google.gerrit.index.query.QueryParseException;
@@ -39,7 +40,12 @@
@Override
public boolean match(ChangeData change) {
- Set<DependsOn> dependOns = changeMessageStore.load(change.getId());
+ Set<DependsOn> dependOns;
+ try {
+ dependOns = changeMessageStore.load(change.notes());
+ } catch (StorageException e) {
+ dependOns = changeMessageStore.load(change.getId());
+ }
List<ChangeNotes> changeNotes =
changeNotesFactory.createUsingIndexLookup(
dependOns.stream()