summaryrefslogtreecommitdiff
path: root/notmuch-extract-patch
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-11-21 15:20:25 -0700
committerSean Whitton <spwhitton@spwhitton.name>2019-11-21 15:22:28 -0700
commit284392c2f70a65616af65f70575c6abe4b389288 (patch)
treeb3c7ed1eef29c2a6c0420c2134fcc8bd95d5d5ce /notmuch-extract-patch
parent8822515602bedcc4ce5b6a2428a2e506fdc0bf6d (diff)
downloadmailscripts-284392c2f70a65616af65f70575c6abe4b389288.tar.gz
notmuch-extract-patch: strip text in Subject: before '[PATCH nn/mm]'
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'notmuch-extract-patch')
-rwxr-xr-xnotmuch-extract-patch/notmuch-extract-patch10
1 files changed, 10 insertions, 0 deletions
diff --git a/notmuch-extract-patch/notmuch-extract-patch b/notmuch-extract-patch/notmuch-extract-patch
index 7eff31a..d67e542 100755
--- a/notmuch-extract-patch/notmuch-extract-patch
+++ b/notmuch-extract-patch/notmuch-extract-patch
@@ -60,6 +60,15 @@ def get_subject_prefix(s):
if match:
return match.group(1).split()
+# if Subject: contains [PATCH nn/mm] then any text before that should
+# be stripped, as it should not form part of the commit message. (The
+# debbugs system prepends 'Bug#nnnnnn: ')
+def munge_subject(msg):
+ match = re.search(r'''\[(.*PATCH.*)\].*$''', msg['subject'])
+ if match:
+ del msg['subject']
+ msg['subject'] = match.group(0)
+
def main():
try:
opts, query = getopt.getopt(sys.argv[1:], "v:", ["reroll-count="])
@@ -81,6 +90,7 @@ def main():
for m in in_mb:
if is_git_patch(m) and has_reroll_count(m, reroll_count):
sys.stderr.write(m['subject']+"\n")
+ munge_subject(m)
out_mb.add(m)
out_mb.flush()
print(open(out_mb_file.name).read())