diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2019-08-28 14:59:33 +0200 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2019-08-28 14:59:33 +0200 |
commit | ffcfdbbf9c63ac2b10976970171ce07f20455e63 (patch) | |
tree | ac4bd1141d9e10be4c4f450ebbb336c451bd3297 | |
parent | e3a2424c111e9c88cc518b1f1dc3ff30b32e92a8 (diff) | |
download | quilttools-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-x | mb2q | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -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: |