MCPcopy Create free account
hub / github.com/bazelbuild/bazel / extract_relnotes

Function extract_relnotes

scripts/release/relnotes.py:36–68  ·  view source on GitHub ↗

Extracts relnotes from a commit message (passed in as a list of lines).

(commit_message_lines)

Source from the content-addressed store, hash-verified

34
35
36def 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
71def get_relnotes_between(base, head, is_patch_release):

Callers 1

get_relnotes_betweenFunction · 0.85

Calls 7

extract_titleFunction · 0.85
splitMethod · 0.80
rstripMethod · 0.80
lowerMethod · 0.80
stripMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…