RFR: checkout: sort marks before converting

Erik Helin ehelin at openjdk.java.net
Fri Jan 29 14:27:56 UTC 2021


On Fri, 29 Jan 2021 14:14:58 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Hi all,
>> 
>> please review this small patch that ensures that we sort the existing marks before passing them to the converter.
>> 
>> Thanks,
>> Erik
>
> bots/checkout/src/main/java/org/openjdk/skara/bots/checkout/CheckoutBot.java line 138:
> 
>> 136:                         new IllegalStateException("Repository vanished from " + to));
>> 137:                     var existing = new ArrayList<>(marks.current());
>> 138:                     Collections.sort(existing);
> 
> If the `convert` method relies on the marks being sorted, maybe it would be more robust to move the call to sort into there?

Yeah, I agree. Problem is that the `convert` method takes a `List<Mark>` (which might be an `UnmodifiableList`), so I can't just pass it to `Collections.sort` �� I would have to make a copy of the passed list and then sort _that_ list, and that just seems a bit annoying (give that we can have around 100,000 marks).

-------------

PR: https://git.openjdk.java.net/skara/pull/995


More information about the skara-dev mailing list