Fix merge with a normal topic We were applying the same policy on normal topics than on crossrepo topics.
diff --git a/src/main/java/com/criteo/gerrit/plugins/automerge/AutomaticMerger.java b/src/main/java/com/criteo/gerrit/plugins/automerge/AutomaticMerger.java index 9bba6cc..e9779f5 100644 --- a/src/main/java/com/criteo/gerrit/plugins/automerge/AutomaticMerger.java +++ b/src/main/java/com/criteo/gerrit/plugins/automerge/AutomaticMerger.java
@@ -153,9 +153,8 @@ private void attemptToMerge(ChangeAttribute change) throws RestApiException, OrmException, NoSuchChangeException, IOException { final List<ChangeInfo> related = Lists.newArrayList(); - final String topic = change.topic; - if (topic != null) { - related.addAll(api.changes().query("status: open AND topic: " + topic) + if (atomicityHelper.isAtomicReview(change)) { + related.addAll(api.changes().query("status: open AND topic: " + change.topic) .withOption(ListChangesOption.CURRENT_REVISION).get()); } else { related.add(api.changes().id(change.id).get(EnumSet.of(ListChangesOption.CURRENT_REVISION)));