From 6bc6dd77ab91f58fe98696824af8fc5dfb279178 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 17 Apr 2023 08:27:57 +0200 Subject: [PATCH] [FIX] runbot_merge: mismatch can contain non-str values The mismatch diff attribute contains values from the in-db object and the github PR structure, some of which are explicitly *not* strings (e.g. the squash flag, possibly the commits # in the future). As a result, when the squash-flag of a PR differs from the actual the formatting for diffing blows up, because difflib can't handle non-strings. Stringify values between passing them to `format_items`, this way the string operations on names and values should work correctly. --- runbot_merge/models/pull_requests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runbot_merge/models/pull_requests.py b/runbot_merge/models/pull_requests.py index b7490aa9..8be1070b 100644 --- a/runbot_merge/models/pull_requests.py +++ b/runbot_merge/models/pull_requests.py @@ -2197,8 +2197,8 @@ class Batch(models.Model): yield from value.splitlines(keepends=True) yield '\n' - old = list(format_items((n, v) for n, v, _ in e.args[1])) - new = list(format_items((n, v) for n, _, v in e.args[1])) + old = list(format_items((n, str(v)) for n, v, _ in e.args[1])) + new = list(format_items((n, str(v)) for n, _, v in e.args[1])) diff = ''.join(Differ().compare(old, new)) _logger.warning( "data mismatch on %s:\n%s",