MCPcopy Create free account
hub / github.com/apache/solr / parse_gitlog_lines

Function parse_gitlog_lines

dev-tools/scripts/addDepsToChanges.py:162–184  ·  view source on GitHub ↗

Parse raw git log subject lines into ChangeEntry objects. - Extract pr_num and message - Strip '(branch_Nx)' noise - Remove optional leading 'chore(deps): ' - Normalize 'update dependency X' to 'Update X' (case-insensitive)

(lines, author: str)

Source from the content-addressed store, hash-verified

160
161
162def parse_gitlog_lines(lines, author: str):
163 """
164 Parse raw git log subject lines into ChangeEntry objects.
165 - Extract pr_num and message
166 - Strip '(branch_Nx)' noise
167 - Remove optional leading 'chore(deps): '
168 - Normalize 'update dependency X' to 'Update X' (case-insensitive)
169 """
170 entries = []
171 for line in lines:
172 match = line_re.search(line)
173 if not match:
174 print("Skipped un-parsable line: %s" % line)
175 continue
176 text = match.group(1)
177 pr_num = match.group(3)
178 # Clean message noise
179 msg = text
180 msg = re.sub(r"^chore\(deps\):\s*", "", msg, flags=re.IGNORECASE)
181 # Normalize 'update dependency' to 'Update '
182 msg = re.sub(r"(?i)^update\s+dependenc(y|ies)\s+", "Update ", msg)
183 entries.append(ChangeEntry(pr_num=pr_num, message=msg, author=author))
184 return entries
185
186
187def write_changelog_yaml(entries):

Callers 1

mainFunction · 0.85

Calls 4

ChangeEntryClass · 0.70
appendMethod · 0.65
searchMethod · 0.45
subMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…