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-25 16:43:10 -0500
commit91380bf3e5488e710060dabf099d3a047050f0d1 (patch)
treeb15936e0677c698ad7c8b94bd354b6b471bf934e
parente466c1a9e064b505e6b6485c605849d35c2fef8a (diff)
downloadb4-91380bf3e5488e710060dabf099d3a047050f0d1.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 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', [])])