aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2020-01-09 15:43:43 +0100
committerThomas Gleixner <tglx@linutronix.de>2020-01-09 15:47:30 +0100
commit453fcb5a5f1323d1be1187ab0499dfd14dd9c6bb (patch)
tree0fbaaa2a19dcb6139a714d7fc3938ae9b5055ec6
parent377b1b57fcc1809384f2f35a14158045ad58d400 (diff)
downloadquilttools-453fcb5a5f1323d1be1187ab0499dfd14dd9c6bb.tar.gz
mb2q: Handle notmuch message ordering correctly
Notmuch provides the messages in a thread in reverse order, except for the message which is the first one in a thread. This causes the patch ordering in the resulting patch queue to be reverse. Insert the mails into the list after thread starting message instead of queueing them at the end. Reported-by: Kurt Kanzenbach <kurt@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rwxr-xr-xmb2q7
1 files changed, 6 insertions, 1 deletions
diff --git a/mb2q b/mb2q
index 48bfad3..6974f91 100755
--- a/mb2q
+++ b/mb2q
@@ -645,7 +645,12 @@ class nm_mbox(object):
sys.stderr.write('Failed to read %s (%s)\n' %(fpath, mid))
raise
- self.msgs.append((mid, msg))
+ # The message iterator is in reverse order
+ # except for the first mail in the thread
+ if len(self.msgs) > 0:
+ self.msgs.insert(1, (mid, msg))
+ else:
+ self.msgs.append((mid, msg))
nmmsg.remove_tag(realtag)
except notmuch.NotmuchError as ex: