This is an automated email from the ASF dual-hosted git repository.
janhoy pushed a commit to branch branch_9_2
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9_2 by this push:
new 8feef4a0061 SOLR-16714: addDepsToChanges.py handle empty gitlog (#1552)
8feef4a0061 is described below
commit 8feef4a0061b866b695b84ed8179c58d038340aa
Author: Jan Høydahl <[email protected]>
AuthorDate: Mon Apr 10 17:58:35 2023 +0200
SOLR-16714: addDepsToChanges.py handle empty gitlog (#1552)
---
dev-tools/scripts/addDepsToChanges.py | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/dev-tools/scripts/addDepsToChanges.py
b/dev-tools/scripts/addDepsToChanges.py
index f82cc8fe58c..7220cb5a323 100755
--- a/dev-tools/scripts/addDepsToChanges.py
+++ b/dev-tools/scripts/addDepsToChanges.py
@@ -68,7 +68,8 @@ def gitlog_to_changes(line, user="solrbot"):
pr_num = match.group(2)
return "* PR#%s: %s (%s)\n" % (pr_num, text, user)
else:
- return None
+ print("Skipped un-parsable line: %s" % line)
+ return ""
def update_changes(filename, version, changes_lines):
@@ -78,6 +79,7 @@ def update_changes(filename, version, changes_lines):
buffer = []
found_ver = False
found_header = False
+ checked_no_changes = False
appended = False
with open(filename) as f:
version_re = re.compile(r' %s ===' % (version))
@@ -102,6 +104,13 @@ def update_changes(filename, version, changes_lines):
buffer.append(change_line)
buffer.append("\n")
continue
+ else:
+ print("Mismatch in CHANGES.txt, expected '----' line after
header, got: %s" % line)
+ exit(1)
+ if not checked_no_changes:
+ checked_no_changes = True
+ if re.compile(r'^\(No changes\)').search(line):
+ continue
buffer.append(line)
if appended:
with open(filename, 'w') as f:
@@ -124,8 +133,11 @@ def main():
gitlog_lines = run(
'git log --author=' + newconf.user + ' --oneline --no-merges
--pretty=format:"%s" ' + prev_tag + '..').split(
"\n")
- changes_lines = list(map(lambda l: gitlog_to_changes(l, newconf.user),
gitlog_lines))
- update_changes('solr/CHANGES.txt', newconf.version, changes_lines)
+ changes_lines = list(map(lambda l: gitlog_to_changes(l, newconf.user),
list(filter(None, gitlog_lines))))
+ if changes_lines and len(changes_lines) > 0:
+ update_changes('solr/CHANGES.txt', newconf.version, changes_lines)
+ else:
+ print("No changes found for version %s" % newconf.version.dot)
print("Done")
except subprocess.CalledProcessError:
print("Error running git log - check your --version")