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)
| 160 | |
| 161 | |
| 162 | def 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 | |
| 187 | def write_changelog_yaml(entries): |
no test coverage detected
searching dependent graphs…