summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-11-24 15:39:09 -0500
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-11-24 15:39:09 -0500
commit09ed1462ff9ceb7615c812f6cb1a2f34ab768e59 (patch)
tree6d12aa6dff29ee2aad2300c96d30c25c25abf312
parent3c31185b4fd40b200aed014aec585a6cebee6816 (diff)
downloadb4-09ed1462ff9ceb7615c812f6cb1a2f34ab768e59.tar.gz
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 <konstantin@linuxfoundation.org>
-rw-r--r--b4/mbox.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/b4/mbox.py b/b4/mbox.py
index 8521c0c..86825f2 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', [])])