aboutsummaryrefslogtreecommitdiff
path: root/b4/__init__.py
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-03-23 13:58:04 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-03-23 13:58:04 -0400
commitf0074dfd57dc6238c730b462cdda6d048eaabbd3 (patch)
tree671b6bf3916fe5591f93aec06a0a24cfd180c2cb /b4/__init__.py
parentf168ac9ac958a60e3c8fd656649939061f617501 (diff)
downloadb4-f0074dfd57dc6238c730b462cdda6d048eaabbd3.tar.gz
Use more unique mbx names by adding subjects
When the same person sends multiple sets of patches on the same day, we risk colliding between them. Use mbx names with cover/1st-patch subjects in them, to help disambiguate in such cases. Reported-by: Mark Brown <broonie@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Diffstat (limited to 'b4/__init__.py')
-rw-r--r--b4/__init__.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index 467da13..ee5f1dc 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -337,7 +337,7 @@ class LoreSeries:
self.patches[lmsg.counter] = lmsg
self.complete = not (None in self.patches[1:])
- def get_slug(self):
+ def get_slug(self, extended=False):
# Find the first non-None entry
lmsg = None
for lmsg in self.patches:
@@ -349,8 +349,14 @@ class LoreSeries:
prefix = lmsg.date.strftime('%Y%m%d')
authorline = email.utils.getaddresses(lmsg.msg.get_all('from', []))[0]
- author = re.sub(r'\W+', '_', authorline[1]).strip('_').lower()
- slug = '%s_%s' % (prefix, author)
+ if extended:
+ local = authorline[1].split('@')[0]
+ unsafe = '%s_%s_%s' % (prefix, local, lmsg.subject)
+ slug = re.sub(r'\W+', '_', unsafe).strip('_').lower()
+ else:
+ author = re.sub(r'\W+', '_', authorline[1]).strip('_').lower()
+ slug = '%s_%s' % (prefix, author)
+
if self.revision != 1:
slug = 'v%s_%s' % (self.revision, slug)