aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-03-30 11:20:09 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-03-30 11:20:09 -0400
commite110a35e7ea0a1c2bb3c350487a9fe34984592bf (patch)
tree9cfdc9f2aa01402b337711269e0713b6c50d948a
parent36296aa9306d1712777631dab01f8cd6ac348e65 (diff)
downloadb4-e110a35e7ea0a1c2bb3c350487a9fe34984592bf.tar.gz
Only add From: in the body if different
No need to add an extra From: into the body of the message if it's identical to the From in the original pull request. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/pr.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/b4/pr.py b/b4/pr.py
index 50b0f1d..24fbf64 100644
--- a/b4/pr.py
+++ b/b4/pr.py
@@ -184,8 +184,11 @@ def explode(gitdir, lmsg, savefile):
# Set the pull request message as cover letter
for msg in pmbx:
# Move the original From and Date into the body
- body = msg.get_payload(decode=True)
- body = 'From: %s\nDate: %s\n\n%s' % (msg['from'], msg['date'], body.decode('utf-8'))
+ prepend = list()
+ if msg['from'] != lmsg.msg['from']:
+ prepend.append('From: %s' % msg['from'])
+ prepend.append('Date: %s' % msg['date'])
+ body = '%s\n\n%s' % ('\n'.join(prepend), msg.get_payload(decode=True).decode('utf-8'))
msg.set_payload(body)
msubj = b4.LoreSubject(msg['subject'])
msg.replace_header('Subject', msubj.full_subject)