annotate contrib/relnotes @ 46113:59fa3890d40a

node: import symbols explicitly There is no point in lazy importing mercurial.node, it is used all over the place anyway. So consistently import the used symbols directly. Fix one file using symbols indirectly via mercurial.revlog. Differential Revision: https://phab.mercurial-scm.org/D9480
author Joerg Sonnenberger <joerg@bec.de>
date Tue, 01 Dec 2020 21:54:46 +0100
parents 99e231afc29c
children
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 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,
41518
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
17 r"\(SEC\)": 100,
39352
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
18 # core commands, bump up
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
19 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
20 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
21 # extensions, bump up
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
22 r"(mq|shelve|rebase):": 20,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
23 # newsy
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
24 r": deprecate": 20,
41518
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
25 r": new.*(extension|flag|module)": 10,
40452
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
26 r"( ability|command|feature|option|support)": 10,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
27 # experimental
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
28 r"hg-experimental": 20,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
29 r"(from|graduate).*experimental": 15,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
30 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
31 # bug-like?
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
32 r"(fix|don't break|improve)": 7,
40452
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
33 r"(not|n't|avoid|fix|prevent).*crash": 10,
41518
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
34 r"vulnerab": 10,
39352
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
35 # boring stuff, bump down
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
36 r"^contrib": -5,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
37 r"debug": -5,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
38 r"help": -5,
41518
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
39 r"minor": -5,
40452
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
40 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
41 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
42 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
43 # cleanups and refactoring
41518
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
44 r"(clean ?up|white ?space|spelling|quoting)": -20,
40452
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
45 r"(flatten|dedent|indent|nesting|unnest)": -20,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
46 r"(typo|hint|note|comment|TODO|FIXME)": -20,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
47 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
48 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
49 r"(scope|True|False)": -10,
41518
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
50 r"(unused|useless|unnecessar|superfluous|duplicate|deprecated)": -10,
39352
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
51 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
52 r": (drop|remove|delete|rip out)": -10,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
53 r": (inherit|rename|simplify|naming|inline)": -10,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
54 r"(correct doc|docstring|document .* method)": -20,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
55 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
56 r": add.*(function|method|implementation|example)": -10,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
57 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
58 r": implement ": -5,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
59 r": use .* implementation": -20,
41518
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
60 r": use .* instead of": -20,
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
61 # code
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
62 r"_": -10,
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
63 r"__": -5,
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
64 r"\(\)": -5,
39352
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
65 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
66 # dumb keywords
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
67 r"\S+/\S+:": -10,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
68 r"\S+\.\S+:": -10,
40452
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
69 # python compatibility
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
70 r"[Pp]y(|thon) ?[23]": -20,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
71 r"pycompat": -20,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
72 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
73 # tests
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
74 r"^test(|s|ing|runner|-\S+):": -20,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
75 r"^(f|hghave|run-tests):": -20,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
76 r"add.* tests?": -20,
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
77 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
78 # drop
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
79 r"^i18n-": -50,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
80 r"^i18n:.*(hint|comment)": -50,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
81 r"perf:": -50,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
82 r"Added.*for changeset": -50,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
83 r"^_": -50,
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
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
86 cutoff = 10
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
87 commits = []
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
88
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
89 groupings = [
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
90 (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
91 (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
92 (r"dispatch|exchange|localrepo|streamclone|color|pager", "core"),
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
93 (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
94 (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
95 (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
96 (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
97 (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
98 (r"shelve|unshelve", "extensions"),
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
99 ]
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
100
43659
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41518
diff changeset
101
41518
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
102 def wikify(desc):
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
103 desc = desc.replace("(issue", "(Bts:issue")
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
104 desc = re.sub(r"\b([0-9a-f]{12})\b", r"Cset:\1", desc)
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
105 # stop ParseError from being recognized as a (nonexistent) wiki page
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
106 desc = re.sub(r" ([A-Z][a-z]+[A-Z][a-z]+)\b", r" !\1", desc)
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
107 # prevent wiki markup of magic methods
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
108 desc = re.sub(r"\b(\S*__\S*)\b", r"`\1`", desc)
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
109 return desc
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
110
43659
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41518
diff changeset
111
39352
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
112 def main():
40452
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
113 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
114 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
115 ap.add_argument(
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
116 "startrev",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
117 metavar="REV",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
118 type=str,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
119 help=(
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
120 "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
121 "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
122 ),
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 ap.add_argument(
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
125 "--stoprev",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
126 metavar="REV",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
127 type=str,
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
128 default="@",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
129 help=(
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
130 "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
131 " 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
132 "a descendant of startrev."
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 )
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
135 args = ap.parse_args()
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
136 fromext = subprocess.check_output(
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 "hg",
39365
659e2bbd0c20 relnotes: enable extension when running releasenotes command
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 39352
diff changeset
139 "--config",
659e2bbd0c20 relnotes: enable extension when running releasenotes command
Pulkit Goyal <pulkit@yandex-team.ru>
parents: 39352
diff changeset
140 "extensions.releasenotes=",
39352
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
141 "releasenotes",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
142 "-r",
40452
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
143 "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
144 ]
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
145 ).decode("utf-8")
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
146 # 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
147 for entry in sorted(
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
148 subprocess.check_output(
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 "hg",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
151 "log",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
152 "-r",
40452
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
153 "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
154 "-T",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
155 r"{desc|firstline}\n",
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
156 ]
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
157 )
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
158 .decode("utf-8")
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
159 .splitlines()
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
160 ):
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
161 desc = entry.replace("`", "'")
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
162
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
163 score = 0
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
164 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
165 if re.search(rule, desc):
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
166 score += val
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 if score >= cutoff:
41518
530d211ae9a8 relnotes: more improvements
Anton Shestakov <av6@dwimlabs.net>
parents: 40452
diff changeset
169 commits.append(wikify(desc))
39352
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
170 # Group unflagged notes.
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
171 groups = {}
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
172 bcs = []
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
173 apis = []
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 commits:
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
176 if "(BC)" in d:
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
177 bcs.append(d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
178 if "(API)" in d:
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
179 apis.append(d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
180 for rule, g in groupings:
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
181 if re.match(rule, d):
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
182 groups.setdefault(g, []).append(d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
183 break
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
184 else:
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
185 groups.setdefault("unsorted", []).append(d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
186 print(fromext)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
187 # print legacy release notes sections
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
188 for g in sorted(groups):
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
189 print("\n=== %s ===" % g)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
190 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
191 print(" * %s" % d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
192
40452
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
193 if bcs:
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
194 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
195
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
196 for d in sorted(bcs):
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
197 print(" * %s" % d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
198
40452
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
199 if apis:
683e99f0b30c relnotes: various tweaks for release notes
Anton Shestakov <av6@dwimlabs.net>
parents: 39365
diff changeset
200 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
201
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
202 for d in sorted(apis):
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
203 print(" * %s" % d)
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
204
43659
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 41518
diff changeset
205
39352
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
206 if __name__ == "__main__":
035517d48865 contrib: import the relnotes script from the release-tools repo
Augie Fackler <augie@google.com>
parents:
diff changeset
207 main()