annotate contrib/relnotes @ 39352:035517d48865

contrib: import the relnotes script from the release-tools repo I figure this makes more sense to keep in the main repo, as it's a guide of sorts on how to use the releasenotes extension in the presence of commits that don't get relnotes annotations. Ported to Python 3, cleaned up some logic in a few places, but for the most part it's what we've been using for years. Differential Revision: https://phab.mercurial-scm.org/D4291
author Augie Fackler <augie@google.com>
date Wed, 25 Jul 2018 13:28:36 -0400
parents
children 659e2bbd0c20
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39352
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
1 #!/usr/bin/env python3
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
2 """Generate release notes from our commit log.
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
3
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
4 This uses the relnotes extension directives when they're available,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
5 and falls back to our old pre-relnotes logic that used to live in the
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
6 release-tools repo.
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
7 """
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
8 import argparse
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
9 import re
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
10 import subprocess
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
11
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
12 # Regenerate this list with
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
13 # hg export 'grep("\.\. [a-z]+::")' | grep '^\.\.' | \
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
14 # sed 's/.. //;s/::.*//' | sort -u
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
15 rnsections = ["api", "bc", "container", "feature", "fix", "note", "perf"]
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
16
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
17 rules = {
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
18 # keep
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
19 r"\(issue": 100,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
20 r"\(BC\)": 100,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
21 r"\(API\)": 100,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
22 # core commands, bump up
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
23 r"(commit|files|log|pull|push|patch|status|tag|summary)(|s|es):": 20,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
24 r"(annotate|alias|branch|bookmark|clone|graft|import|verify).*:": 20,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
25 # extensions, bump up
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
26 r"(mq|shelve|rebase):": 20,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
27 # newsy
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
28 r": deprecate": 20,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
29 r"(option|feature|command|support)": 10,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
30 # bug-like?
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
31 r"(fix|don't break|improve)": 7,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
32 # boring stuff, bump down
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
33 r"^contrib": -5,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
34 r"debug": -5,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
35 r"help": -5,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
36 r"(doc|bundle2|obsolete|obsmarker|rpm|setup|debug\S+:)": -15,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
37 r"(check-code|check-commit|import-checker)": -20,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
38 # cleanups and refactoring
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
39 r"(cleanup|whitespace|nesting|indent|spelling|comment)": -20,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
40 r"(typo|hint|note|style:|correct doc)": -20,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
41 r"_": -10,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
42 r"(argument|absolute_import|attribute|assignment|mutable)": -15,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
43 r"(unused|useless|unnecessary|duplicate|deprecated|scope|True|False)": -10,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
44 r"(redundant|pointless|confusing|uninitialized|meaningless|dead)": -10,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
45 r": (drop|remove|inherit|rename|simplify|naming|inline)": -10,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
46 r"(docstring|document .* method)": -20,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
47 r"(factor|extract|prepare|split|replace| import)": -20,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
48 r": add.*(function|method|implementation|test|example)": -10,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
49 r": (move|extract) .* (to|into|from)": -20,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
50 r": implement ": -5,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
51 r": use .* implementation": -20,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
52 r"\S\S\S+\.\S\S\S\S+": -5,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
53 r": use .* instead of": -20,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
54 r"__": -5,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
55 # dumb keywords
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
56 r"\S+/\S+:": -10,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
57 r"\S+\.\S+:": -10,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
58 # drop
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
59 r"^i18n-": -50,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
60 r"^i18n:.*(hint|comment)": -50,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
61 r"perf:": -50,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
62 r"check-code:": -50,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
63 r"Added.*for changeset": -50,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
64 r"tests?:": -50,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
65 r"test-": -50,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
66 r"add.* tests": -50,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
67 r"^_": -50,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
68 }
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
69
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
70 cutoff = 10
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
71 commits = []
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
72
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
73 groupings = [
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
74 (r"util|parsers|repo|ctx|context|revlog|filelog|alias|cmdutil", "core"),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
75 (r"revset|templater|ui|dirstate|hook|i18n|transaction|wire", "core"),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
76 (r"color|pager", "core"),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
77 (r"hgweb|paper|coal|gitweb", "hgweb"),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
78 (r"pull|push|revert|resolve|annotate|bookmark|branch|clone", "commands"),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
79 (r"commands|commit|config|files|graft|import|log|merge|patch", "commands"),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
80 (r"phases|status|summary|amend|tag|help|verify", "commands"),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
81 (r"rebase|mq|convert|eol|histedit|largefiles", "extensions"),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
82 (r"shelve|unshelve", "extensions"),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
83 ]
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
84
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
85 def main():
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
86 ap = argparse.ArgumentParser()
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
87 ap.add_argument(
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
88 "startrev",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
89 metavar="REV",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
90 type=str,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
91 nargs=1,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
92 help=(
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
93 "Starting revision for the release notes. This revision "
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
94 "won't be included, but later revisions will."
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
95 ),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
96 )
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
97 ap.add_argument(
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
98 "--stoprev",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
99 metavar="REV",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
100 type=str,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
101 default="@",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
102 nargs=1,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
103 help=(
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
104 "Stop revision for release notes. This revision will be included,"
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
105 " but no later revisions will. This revision needs to be "
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
106 "a descendant of startrev."
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
107 ),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
108 )
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
109 args = ap.parse_args()
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
110 fromext = subprocess.check_output(
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
111 [
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
112 "hg",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
113 "releasenotes",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
114 "-r",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
115 "%s::%s" % (args.startrev[0], args.stoprev[0]),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
116 ]
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
117 ).decode("utf-8")
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
118 # Find all release notes from un-relnotes-flagged commits.
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
119 for entry in sorted(
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
120 subprocess.check_output(
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
121 [
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
122 "hg",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
123 "log",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
124 "-r",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
125 r'%s::%s - merge() - grep("\n\.\. (%s)::")'
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
126 % (args.startrev[0], args.stoprev[0], "|".join(rnsections)),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
127 "-T",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
128 r"{desc|firstline}\n",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
129 ]
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
130 )
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
131 .decode("utf-8")
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
132 .splitlines()
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
133 ):
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
134 desc = entry.replace("`", "'")
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
135
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
136 score = 0
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
137 for rule, val in rules.items():
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
138 if re.search(rule, desc):
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
139 score += val
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
140
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
141 desc = desc.replace("(issue", "(Bts:issue")
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
142
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
143 if score >= cutoff:
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
144 commits.append(desc)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
145 # Group unflagged notes.
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
146 groups = {}
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
147 bcs = []
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
148 apis = []
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
149
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
150 for d in commits:
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
151 if "(BC)" in d:
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
152 bcs.append(d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
153 if "(API)" in d:
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
154 apis.append(d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
155 for rule, g in groupings:
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
156 if re.match(rule, d):
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
157 groups.setdefault(g, []).append(d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
158 break
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
159 else:
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
160 groups.setdefault("unsorted", []).append(d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
161 print(fromext)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
162 # print legacy release notes sections
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
163 for g in sorted(groups):
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
164 print("\n=== %s ===" % g)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
165 for d in sorted(groups[g]):
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
166 print(" * %s" % d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
167
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
168 print("\n=== BC ===\n")
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
169
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
170 for d in sorted(bcs):
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
171 print(" * %s" % d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
172
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
173 print("\n=== API Changes ===\n")
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
174
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
175 for d in sorted(apis):
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
176 print(" * %s" % d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
177
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
178 if __name__ == "__main__":
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
179 main()