Extracts relnotes from a commit message (passed in as a list of lines).
(commit_message_lines)
| 34 | |
| 35 | |
| 36 | def extract_relnotes(commit_message_lines): |
| 37 | """Extracts relnotes from a commit message (passed in as a list of lines).""" |
| 38 | relnote_lines = [] |
| 39 | in_relnote = False |
| 40 | |
| 41 | title = extract_title(commit_message_lines) |
| 42 | issue_id = re.search(r"\(\#[0-9]+\)$", title.strip().split()[-1]) |
| 43 | |
| 44 | for line in commit_message_lines: |
| 45 | line = line.strip() |
| 46 | if ( |
| 47 | not line |
| 48 | or line.startswith("PiperOrigin-RevId:") |
| 49 | or re.match(r"^\s*(Fixes|Closes)\s+#\d+\.?\s*$", line) |
| 50 | ): |
| 51 | in_relnote = False |
| 52 | m = re.match(r"^RELNOTES(?:\[(INC|NEW)\])?:", line) |
| 53 | if m is not None: |
| 54 | in_relnote = True |
| 55 | line = line[len(m[0]) :] |
| 56 | if line.strip().lower().rstrip(".") in ["n/a", "na", "none"]: |
| 57 | return None |
| 58 | if m[1] == "INC": |
| 59 | line = "**[Incompatible]** " + line.strip() |
| 60 | line = line.strip() |
| 61 | if in_relnote and line: |
| 62 | relnote_lines.append(line) |
| 63 | relnote = " ".join(relnote_lines) |
| 64 | |
| 65 | if issue_id and relnote: |
| 66 | relnote += " " + issue_id.group(0).strip() |
| 67 | |
| 68 | return relnote |
| 69 | |
| 70 | |
| 71 | def get_relnotes_between(base, head, is_patch_release): |
no test coverage detected
searching dependent graphs…