[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.
This commit is contained in:
Xavier Morel 2023-04-17 08:27:57 +02:00
parent e3d87b5b5d
commit 6bc6dd77ab

View File

@ -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",