How to sync labels for both ways?

Originally asked by Yaakov Shamii on 05 May 2020 (original question)


Hi,

Is there a way to merge the labels of two issues in the connection? I need the same mechanism of mergeComments() or mergeAttachments() just in labels.

Thanks.


Answer by Francis Martens (Exalate) on 08 May 2020

Hello Yaakov Shamii

Here is an example of merging 2 string arrays. Performance wise not the best option, but I assume that the issues number of labels is limited

def leftArray = [ "a", "b", "c" ]
def rightArray = ["b","d","e"]


leftArray.addAll(rightArray.findAll {label -> ! leftArray.contains(label)})

assert leftArray == [ "a", "b", "c", "d", "e"]



Comments:

Yaakov Shamii commented on 11 May 2020

Thanks Francis.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.