From 78d27842cfb1cdc2e779cd089487207db4ca91c9 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 8 Nov 2025 09:26:33 -0500 Subject: [PATCH] Internals: Recogize "fixes" strings in `log-changes` --- nodist/log_changes | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/nodist/log_changes b/nodist/log_changes index 2a042d205..61bb6bdc4 100755 --- a/nodist/log_changes +++ b/nodist/log_changes @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # mypy: disallow-untyped-defs -# pylint: disable=C0114,C0116,C0209,R0911,R0912,R0915 +# pylint: disable=C0114,C0116,C0209,R0911,R0912,R0914,R0915 ###################################################################### import argparse @@ -13,17 +13,17 @@ import re def message_section(msg: str) -> int: """Return sorting-section number for given commit message""" - if re.match(r'^Support', msg): + if re.match(r'^Support', msg, flags=re.IGNORECASE): return 10 - if re.match(r'^Add', msg): + if re.match(r'^Add', msg, flags=re.IGNORECASE): return 20 - if re.match(r'^Improve', msg): + if re.match(r'^Improve', msg, flags=re.IGNORECASE): return 30 - if re.match(r'^Fix', msg): + if re.match(r'^Fix', msg, flags=re.IGNORECASE): return 40 - if re.match(r'^(Internals|CI|Tests)', msg): + if re.match(r'^(Internals|CI|Tests)', msg, flags=re.IGNORECASE): return -1 - if re.match(r'^Bump.* from .* to .*', msg): # dependabot + if re.match(r'^Bump.* from .* to .*', msg, flags=re.IGNORECASE): # dependabot return -1 return 0 @@ -32,15 +32,20 @@ def process() -> None: cmd = "git log" msgs = {} + msg_authors = {} with os.popen(cmd) as fh: author = "" lineno = 0 + key = None for line in fh: lineno += 1 line = line.rstrip() + # print("l %s" % line) if re.match(r'^Date', line): + key = None continue if re.match(r'^commit', line): + key = None continue if re.search(r'Commentary: Changes update', line): break @@ -59,9 +64,6 @@ def process() -> None: elif author != "" and dm: msg = dm.group(1) - if not re.search(r'\.$', msg): - msg += '.' - msg += ' [' + author + ']' mid = re.search(r'\(#([0-9][0-9][0-9][0-9]+)', line) if mid: @@ -73,10 +75,19 @@ def process() -> None: if section >= 0: key = "%06s_%06s_%06d" % (section, bug_id, lineno) msgs[key] = '* ' + msg - # print("i [%s] %s" % (key, msg)) + msg_authors[key] = author + # print("i [%s] %s [%s]" % (key, msg, author)) author = "" + elif key: + m = re.search(r'(fix|fixes) *#\(?([0-9][0-9][0-9][0-9]+)', + line, + flags=re.IGNORECASE) + if m: + # print("K %s" % line) + msgs[key] += ' (#' + m.group(2) + ')' + if not msgs: print("No Changes need to be inserted.") return @@ -89,7 +100,10 @@ def process() -> None: for key in sorted(msgs.keys()): if msgs[key] not in dedup: dedup[msgs[key]] = True - print(msgs[key]) + msg = msgs[key] + if not re.search(r'\.$', msg): + msg += '.' + print(msg + ' [' + msg_authors[key] + ']') print() print("You may now want to clean up spelling, and commit:")