Mercurial > hg
annotate contrib/relnotes @ 40592:83e571ea06a9
commandserver: attach prompt default and choices to message
These attributes are important to provide a GUI prompt to user.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 04 Nov 2018 12:17:20 +0900 |
parents | 683e99f0b30c |
children | 530d211ae9a8 |
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 rules = { |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
13 # keep |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
14 r"\(issue": 100, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
15 r"\(BC\)": 100, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
16 r"\(API\)": 100, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
17 # core commands, bump up |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
18 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
|
19 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
|
20 # extensions, bump up |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
21 r"(mq|shelve|rebase):": 20, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
22 # newsy |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
23 r": deprecate": 20, |
40452
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
24 r"( ability|command|feature|option|support)": 10, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
25 # experimental |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
26 r"hg-experimental": 20, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
27 r"(from|graduate).*experimental": 15, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
28 r"(hide|mark).*experimental": -10, |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
29 # bug-like? |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
30 r"(fix|don't break|improve)": 7, |
40452
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
31 r"(not|n't|avoid|fix|prevent).*crash": 10, |
39352
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, |
40452
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
36 r"(doc|metavar|bundle2|obsolete|obsmarker|rpm|setup|debug\S+:)": -15, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
37 r"(check-code|check-commit|check-config|import-checker)": -20, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
38 r"(flake8|lintian|pyflakes|pylint)": -20, |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
39 # cleanups and refactoring |
40452
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
40 r"(cleanup|white ?space|spelling|quoting)": -20, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
41 r"(flatten|dedent|indent|nesting|unnest)": -20, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
42 r"(typo|hint|note|comment|TODO|FIXME)": -20, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
43 r"(style:|convention|one-?liner)": -20, |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
44 r"_": -10, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
45 r"(argument|absolute_import|attribute|assignment|mutable)": -15, |
40452
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
46 r"(scope|True|False)": -10, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
47 r"(unused|useless|unnecessary|superfluous|duplicate|deprecated)": -10, |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
48 r"(redundant|pointless|confusing|uninitialized|meaningless|dead)": -10, |
40452
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
49 r": (drop|remove|delete|rip out)": -10, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
50 r": (inherit|rename|simplify|naming|inline)": -10, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
51 r"(correct doc|docstring|document .* method)": -20, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
52 r"(abstract|factor|extract|prepare|split|replace| import)": -20, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
53 r": add.*(function|method|implementation|example)": -10, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
54 r": (move|extract) .* (to|into|from|out of)": -20, |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
55 r": implement ": -5, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
56 r": use .* implementation": -20, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
57 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
|
58 r": use .* instead of": -20, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
59 r"__": -5, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
60 # dumb keywords |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
61 r"\S+/\S+:": -10, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
62 r"\S+\.\S+:": -10, |
40452
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
63 # python compatibility |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
64 r"[Pp]y(|thon) ?[23]": -20, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
65 r"pycompat": -20, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
66 r"(coerce|convert|encode) .*to (byte|sys|)(s|str|string)": -20, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
67 # tests |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
68 r"^test(|s|ing|runner|-\S+):": -20, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
69 r"^(f|hghave|run-tests):": -20, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
70 r"add.* tests?": -20, |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
71 r"(buildbot|fuzz|mock|ratchet)": -10, |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
72 # drop |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
73 r"^i18n-": -50, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
74 r"^i18n:.*(hint|comment)": -50, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
75 r"perf:": -50, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
76 r"Added.*for changeset": -50, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
77 r"^_": -50, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
78 } |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
79 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
80 cutoff = 10 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
81 commits = [] |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
82 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
83 groupings = [ |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
84 (r"util|parsers|repo|ctx|context|revlog|filelog|alias|cmdutil", "core"), |
40452
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
85 (r"revset|template|ui|dirstate|hook|i18n|transaction|wire|vfs", "core"), |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
86 (r"dispatch|exchange|localrepo|streamclone|color|pager", "core"), |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
87 (r"hgweb|paper|coal|gitweb|monoblue|spartan", "hgweb"), |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
88 (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
|
89 (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
|
90 (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
|
91 (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
|
92 (r"shelve|unshelve", "extensions"), |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
93 ] |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
94 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
95 def main(): |
40452
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
96 desc = "example: %(prog)s 4.7.2 --stoprev 4.8rc0" |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
97 ap = argparse.ArgumentParser(description=desc) |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
98 ap.add_argument( |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
99 "startrev", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
100 metavar="REV", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
101 type=str, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
102 help=( |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
103 "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
|
104 "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
|
105 ), |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
106 ) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
107 ap.add_argument( |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
108 "--stoprev", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
109 metavar="REV", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
110 type=str, |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
111 default="@", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
112 help=( |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
113 "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
|
114 " 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
|
115 "a descendant of startrev." |
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 ) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
118 args = ap.parse_args() |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
119 fromext = subprocess.check_output( |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
120 [ |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
121 "hg", |
39365
659e2bbd0c20
relnotes: enable extension when running releasenotes command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39352
diff
changeset
|
122 "--config", |
659e2bbd0c20
relnotes: enable extension when running releasenotes command
Pulkit Goyal <pulkit@yandex-team.ru>
parents:
39352
diff
changeset
|
123 "extensions.releasenotes=", |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
124 "releasenotes", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
125 "-r", |
40452
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
126 "only(%s, %s)" % (args.stoprev, args.startrev), |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
127 ] |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
128 ).decode("utf-8") |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
129 # 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
|
130 for entry in sorted( |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
131 subprocess.check_output( |
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 "hg", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
134 "log", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
135 "-r", |
40452
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
136 "only(%s, %s) - merge()" % (args.stoprev, args.startrev), |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
137 "-T", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
138 r"{desc|firstline}\n", |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
139 ] |
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 .decode("utf-8") |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
142 .splitlines() |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
143 ): |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
144 desc = entry.replace("`", "'") |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
145 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
146 score = 0 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
147 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
|
148 if re.search(rule, desc): |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
149 score += val |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
150 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
151 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
|
152 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
153 if score >= cutoff: |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
154 commits.append(desc) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
155 # Group unflagged notes. |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
156 groups = {} |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
157 bcs = [] |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
158 apis = [] |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
159 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
160 for d in commits: |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
161 if "(BC)" in d: |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
162 bcs.append(d) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
163 if "(API)" in d: |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
164 apis.append(d) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
165 for rule, g in groupings: |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
166 if re.match(rule, d): |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
167 groups.setdefault(g, []).append(d) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
168 break |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
169 else: |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
170 groups.setdefault("unsorted", []).append(d) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
171 print(fromext) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
172 # print legacy release notes sections |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
173 for g in sorted(groups): |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
174 print("\n=== %s ===" % g) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
175 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
|
176 print(" * %s" % d) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
177 |
40452
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
178 if bcs: |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
179 print("\n=== Behavior Changes ===\n") |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
180 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
181 for d in sorted(bcs): |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
182 print(" * %s" % d) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
183 |
40452
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
184 if apis: |
683e99f0b30c
relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents:
39365
diff
changeset
|
185 print("\n=== Internal API Changes ===\n") |
39352
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
186 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
187 for d in sorted(apis): |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
188 print(" * %s" % d) |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
189 |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
190 if __name__ == "__main__": |
035517d48865
contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff
changeset
|
191 main() |