Delete: Use hasSuperproject to check Use hasSuperproject to check if a branch is subscribed by other projects to avoid recalculation. Change-Id: I30d7796e48b09b48f2cfafc42a7bca2141db283e
diff --git a/src/main/java/com/googlesource/gerrit/plugins/deleteproject/DeletePreconditions.java b/src/main/java/com/googlesource/gerrit/plugins/deleteproject/DeletePreconditions.java index 417c968..de96ec1 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/deleteproject/DeletePreconditions.java +++ b/src/main/java/com/googlesource/gerrit/plugins/deleteproject/DeletePreconditions.java
@@ -158,7 +158,7 @@ .collect(toSet()); SubmoduleOp sub = subOpFactory.create(branches, mergeOp); for (BranchNameKey b : branches) { - if (!sub.superProjectSubscriptionsForSubmoduleBranch(b).isEmpty()) { + if (sub.hasSuperproject(b)) { throw new CannotDeleteProjectException("Project is subscribed by other projects."); } }