From c267cc2ceb0252cc6a26aaf6d6f610212c1bdecd Mon Sep 17 00:00:00 2001 From: kwahlin Date: Wed, 20 Nov 2024 16:38:47 +0100 Subject: [PATCH] Make sure bulk:deprecate and bulk:keep does not point to the same resource --- .../src/main/resources/bulk-change-scripts/merge.groovy | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/whelktool/src/main/resources/bulk-change-scripts/merge.groovy b/whelktool/src/main/resources/bulk-change-scripts/merge.groovy index 8a4fa40dbe..c4a96bc897 100644 --- a/whelktool/src/main/resources/bulk-change-scripts/merge.groovy +++ b/whelktool/src/main/resources/bulk-change-scripts/merge.groovy @@ -16,6 +16,11 @@ if (!deprecateId || !keepId) return List obsoleteThingUris = [] selectByIds([deprecateId]) { obsolete -> + // Assert that the resource to deprecate is not the same as the one to be kept + if (obsolete.doc.getThingIdentifiers().first() == keepId) { + return + } + obsoleteThingUris = obsolete.doc.getThingIdentifiers() selectByIds(obsolete.getDependers()) { depender ->