aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2019-08-28 14:59:33 +0200
committerThomas Gleixner <tglx@linutronix.de>2019-08-28 14:59:33 +0200
commitffcfdbbf9c63ac2b10976970171ce07f20455e63 (patch)
treeac4bd1141d9e10be4c4f450ebbb336c451bd3297
parente3a2424c111e9c88cc518b1f1dc3ff30b32e92a8 (diff)
downloadquilttools-ffcfdbbf9c63ac2b10976970171ce07f20455e63.tar.gz
mb2q: Handle same subject in a thread and no SOB in patch proper
The code only checks whether a patch file exists already, but it does not handle the case when the same subject is there for two mails, which can happen when there is a V$N+1 reply in the thread. While patches which lack a SOB are correctly detected, the code fails later because is assumes that there is always a SOB. Fixup both. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rwxr-xr-xmb2q18
1 files changed, 17 insertions, 1 deletions
diff --git a/mb2q b/mb2q
index d14d332..291a4b6 100755
--- a/mb2q
+++ b/mb2q
@@ -166,7 +166,9 @@ class mailaddrs(object):
return self.addrs[self.order[0]]
def get_last(self):
- return self.addrs[self.order[-1]]
+ if len(self.order):
+ return self.addrs[self.order[-1]]
+ return None
def remove(self, addr):
raw = get_raw_mailaddr(addr)
@@ -493,6 +495,20 @@ class quilter(object):
p.sanitize_ccs()
def write_series(self, pdir):
+ # Prevent duplicates in the series. i.e. somebody sent a V3 in
+ # reply to V2 of 5/N. So the filename generated from the subject
+ # after stripping '[PATCH...]' is the same.
+
+ fnames = []
+ for pmsg in self.patches:
+ i = 0
+ fname = pmsg.fname
+ while fname in fnames:
+ i += 1
+ fname = pmsg.fname + '_%d' %i
+ pmsg.fname = fname
+ fnames.append(fname)
+
# Write the series file
with open(os.path.join(pdir, 'series'), 'a') as fd:
for pmsg in self.patches: