From 91380bf3e5488e710060dabf099d3a047050f0d1 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Tue, 24 Nov 2020 15:39:09 -0500 Subject: Fix crash on incomplete series thanks tracking Now that we do our best to track incomplete series, don't crash when we come across one. Signed-off-by: Konstantin Ryabitsev --- b4/mbox.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/b4/mbox.py b/b4/mbox.py index 93a5574..4736c24 100644 --- a/b4/mbox.py +++ b/b4/mbox.py @@ -254,11 +254,19 @@ def thanks_record_am(lser, cherrypick=None): patches = list() at = 0 padlen = len(str(lser.expected)) - for pmsg in lser.patches[1:]: - at += 1 + lmsg = None + + for pmsg in lser.patches: if pmsg is None: continue + if lmsg is None: + lmsg = pmsg + + if not pmsg.has_diff: + # Don't care about the cover letter + continue + if cherrypick is not None and at not in cherrypick: logger.debug('Skipped non-cherrypicked: %s', at) continue @@ -269,10 +277,11 @@ def thanks_record_am(lser, cherrypick=None): return prefix = '%s/%s' % (str(pmsg.counter).zfill(padlen), pmsg.expected) patches.append((pmsg.subject, pmsg.pwhash, pmsg.msgid, prefix)) + at += 1 - lmsg = lser.patches[0] if lmsg is None: - lmsg = lser.patches[1] + logger.debug('All patches missing, not tracking for thanks') + return allto = email.utils.getaddresses([str(x) for x in lmsg.msg.get_all('to', [])]) allcc = email.utils.getaddresses([str(x) for x in lmsg.msg.get_all('cc', [])]) -- cgit v1.2.3