Mercurial > hg
annotate contrib/relnotes @ 39599:a5da906306c9
templatekw: add option to include ignored/clean/unknown files in cache
They will be necessary to provide {status} of files.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 29 Jul 2018 21:52:01 +0900 |
parents | 659e2bbd0c20 |
children | 683e99f0b30c |
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", |
39365
659e2bbd0c20
relnotes: enable extension when running releasenotes command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39352
diff
changeset
|
113 "--config", |
659e2bbd0c20
relnotes: enable extension when running releasenotes command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39352
diff
changeset
|
114 "extensions.releasenotes=", |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
115 "releasenotes", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
116 "-r", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
117 "%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
|
118 ] |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
119 ).decode("utf-8") |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
120 # 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
|
121 for entry in sorted( |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
122 subprocess.check_output( |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
123 [ |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
124 "hg", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
125 "log", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
126 "-r", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
127 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
|
128 % (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
|
129 "-T", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
130 r"{desc|firstline}\n", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
131 ] |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
132 ) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
133 .decode("utf-8") |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
134 .splitlines() |
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 desc = entry.replace("`", "'") |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
137 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
138 score = 0 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
139 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
|
140 if re.search(rule, desc): |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
141 score += val |
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 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
|
144 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
145 if score >= cutoff: |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
146 commits.append(desc) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
147 # Group unflagged notes. |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
148 groups = {} |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
149 bcs = [] |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
150 apis = [] |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
151 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
152 for d in commits: |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
153 if "(BC)" in d: |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
154 bcs.append(d) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
155 if "(API)" in d: |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
156 apis.append(d) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
157 for rule, g in groupings: |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
158 if re.match(rule, d): |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
159 groups.setdefault(g, []).append(d) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
160 break |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
161 else: |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
162 groups.setdefault("unsorted", []).append(d) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
163 print(fromext) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
164 # print legacy release notes sections |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
165 for g in sorted(groups): |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
166 print("\n=== %s ===" % g) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
167 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
|
168 print(" * %s" % d) |
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 print("\n=== BC ===\n") |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
171 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
172 for d in sorted(bcs): |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
173 print(" * %s" % d) |
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 print("\n=== API Changes ===\n") |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
176 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
177 for d in sorted(apis): |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
178 print(" * %s" % d) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
179 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
180 if __name__ == "__main__": |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
181 main() |