##// END OF EJS Templates
contrib: import the relnotes script from the release-tools repo...
Augie Fackler -
r39388:035517d4 default
parent child Browse files
Show More
@@ -0,0 +1,179 b''
1 #!/usr/bin/env python3
2 """Generate release notes from our commit log.
3
4 This uses the relnotes extension directives when they're available,
5 and falls back to our old pre-relnotes logic that used to live in the
6 release-tools repo.
7 """
8 import argparse
9 import re
10 import subprocess
11
12 # Regenerate this list with
13 # hg export 'grep("\.\. [a-z]+::")' | grep '^\.\.' | \
14 # sed 's/.. //;s/::.*//' | sort -u
15 rnsections = ["api", "bc", "container", "feature", "fix", "note", "perf"]
16
17 rules = {
18 # keep
19 r"\(issue": 100,
20 r"\(BC\)": 100,
21 r"\(API\)": 100,
22 # core commands, bump up
23 r"(commit|files|log|pull|push|patch|status|tag|summary)(|s|es):": 20,
24 r"(annotate|alias|branch|bookmark|clone|graft|import|verify).*:": 20,
25 # extensions, bump up
26 r"(mq|shelve|rebase):": 20,
27 # newsy
28 r": deprecate": 20,
29 r"(option|feature|command|support)": 10,
30 # bug-like?
31 r"(fix|don't break|improve)": 7,
32 # boring stuff, bump down
33 r"^contrib": -5,
34 r"debug": -5,
35 r"help": -5,
36 r"(doc|bundle2|obsolete|obsmarker|rpm|setup|debug\S+:)": -15,
37 r"(check-code|check-commit|import-checker)": -20,
38 # cleanups and refactoring
39 r"(cleanup|whitespace|nesting|indent|spelling|comment)": -20,
40 r"(typo|hint|note|style:|correct doc)": -20,
41 r"_": -10,
42 r"(argument|absolute_import|attribute|assignment|mutable)": -15,
43 r"(unused|useless|unnecessary|duplicate|deprecated|scope|True|False)": -10,
44 r"(redundant|pointless|confusing|uninitialized|meaningless|dead)": -10,
45 r": (drop|remove|inherit|rename|simplify|naming|inline)": -10,
46 r"(docstring|document .* method)": -20,
47 r"(factor|extract|prepare|split|replace| import)": -20,
48 r": add.*(function|method|implementation|test|example)": -10,
49 r": (move|extract) .* (to|into|from)": -20,
50 r": implement ": -5,
51 r": use .* implementation": -20,
52 r"\S\S\S+\.\S\S\S\S+": -5,
53 r": use .* instead of": -20,
54 r"__": -5,
55 # dumb keywords
56 r"\S+/\S+:": -10,
57 r"\S+\.\S+:": -10,
58 # drop
59 r"^i18n-": -50,
60 r"^i18n:.*(hint|comment)": -50,
61 r"perf:": -50,
62 r"check-code:": -50,
63 r"Added.*for changeset": -50,
64 r"tests?:": -50,
65 r"test-": -50,
66 r"add.* tests": -50,
67 r"^_": -50,
68 }
69
70 cutoff = 10
71 commits = []
72
73 groupings = [
74 (r"util|parsers|repo|ctx|context|revlog|filelog|alias|cmdutil", "core"),
75 (r"revset|templater|ui|dirstate|hook|i18n|transaction|wire", "core"),
76 (r"color|pager", "core"),
77 (r"hgweb|paper|coal|gitweb", "hgweb"),
78 (r"pull|push|revert|resolve|annotate|bookmark|branch|clone", "commands"),
79 (r"commands|commit|config|files|graft|import|log|merge|patch", "commands"),
80 (r"phases|status|summary|amend|tag|help|verify", "commands"),
81 (r"rebase|mq|convert|eol|histedit|largefiles", "extensions"),
82 (r"shelve|unshelve", "extensions"),
83 ]
84
85 def main():
86 ap = argparse.ArgumentParser()
87 ap.add_argument(
88 "startrev",
89 metavar="REV",
90 type=str,
91 nargs=1,
92 help=(
93 "Starting revision for the release notes. This revision "
94 "won't be included, but later revisions will."
95 ),
96 )
97 ap.add_argument(
98 "--stoprev",
99 metavar="REV",
100 type=str,
101 default="@",
102 nargs=1,
103 help=(
104 "Stop revision for release notes. This revision will be included,"
105 " but no later revisions will. This revision needs to be "
106 "a descendant of startrev."
107 ),
108 )
109 args = ap.parse_args()
110 fromext = subprocess.check_output(
111 [
112 "hg",
113 "releasenotes",
114 "-r",
115 "%s::%s" % (args.startrev[0], args.stoprev[0]),
116 ]
117 ).decode("utf-8")
118 # Find all release notes from un-relnotes-flagged commits.
119 for entry in sorted(
120 subprocess.check_output(
121 [
122 "hg",
123 "log",
124 "-r",
125 r'%s::%s - merge() - grep("\n\.\. (%s)::")'
126 % (args.startrev[0], args.stoprev[0], "|".join(rnsections)),
127 "-T",
128 r"{desc|firstline}\n",
129 ]
130 )
131 .decode("utf-8")
132 .splitlines()
133 ):
134 desc = entry.replace("`", "'")
135
136 score = 0
137 for rule, val in rules.items():
138 if re.search(rule, desc):
139 score += val
140
141 desc = desc.replace("(issue", "(Bts:issue")
142
143 if score >= cutoff:
144 commits.append(desc)
145 # Group unflagged notes.
146 groups = {}
147 bcs = []
148 apis = []
149
150 for d in commits:
151 if "(BC)" in d:
152 bcs.append(d)
153 if "(API)" in d:
154 apis.append(d)
155 for rule, g in groupings:
156 if re.match(rule, d):
157 groups.setdefault(g, []).append(d)
158 break
159 else:
160 groups.setdefault("unsorted", []).append(d)
161 print(fromext)
162 # print legacy release notes sections
163 for g in sorted(groups):
164 print("\n=== %s ===" % g)
165 for d in sorted(groups[g]):
166 print(" * %s" % d)
167
168 print("\n=== BC ===\n")
169
170 for d in sorted(bcs):
171 print(" * %s" % d)
172
173 print("\n=== API Changes ===\n")
174
175 for d in sorted(apis):
176 print(" * %s" % d)
177
178 if __name__ == "__main__":
179 main()
@@ -0,0 +1,290 b''
1 #require test-repo py3exe
2 $ . "$TESTDIR/helpers-testrepo.sh"
3
4 $ cd $TESTDIR/..
5 $ python3 contrib/relnotes 4.4 --stoprev 4.5
6 New Features
7 ============
8
9 revert --interactive
10 --------------------
11
12 The revert command now accepts the flag --interactive to allow reverting only
13 some of the changes to the specified files.
14
15 Rebase with different destination per source revision
16 -----------------------------------------------------
17
18 Previously, rebase only supports one unique destination. Now "SRC" and
19 "ALLSRC" can be used in rebase destination revset to precisely define
20 destination per each individual source revision.
21
22 For example, the following command could move some orphaned changesets to
23 reasonable new places so they become no longer orphaned:
24
25 hg rebase -r 'orphan()-obsolete()' -d 'max((successors(max(roots(ALLSRC) &
26 ::SRC)^)-obsolete())::)'
27
28 Accessing hidden changesets
29 ---------------------------
30
31 Set config option 'experimental.directaccess = True' to access hidden
32 changesets from read only commands.
33
34 githelp extension
35 -----------------
36
37 The "githelp" extension provides the "hg githelp" command. This command
38 attempts to convert a "git" command to its Mercurial equivalent. The extension
39 can be useful to Git users new to Mercurial.
40
41 Other Changes
42 -------------
43
44 * When interactive revert is run against a revision other than the working
45 directory parent, the diff shown is the diff to *apply* to the working
46 directory, rather than the diff to *discard* from the working copy. This is
47 in line with related user experiences with 'git' and appears to be less
48 confusing with 'ui.interface=curses'.
49
50 * Let 'hg rebase' avoid content-divergence by skipping obsolete changesets
51 (and their descendants) when they are present in the rebase set along with
52 one of their successors but none of their successors is in destination.
53
54 * hgweb now displays phases of non-public changesets
55
56 * The "HGPLAINEXCEPT" environment variable can now include "color" to allow
57 automatic output colorization in otherwise automated environments.
58
59 * A new unamend command in uncommit extension which undoes the effect of the
60 amend command by creating a new changeset which was there before amend and
61 moving the changes that were amended to the working directory.
62
63 * A '--abort' flag to merge command to abort the ongoing merge.
64
65 * An experimental flag '--rev' to 'hg branch' which can be used to change
66 branch of changesets.
67
68 Backwards Compatibility Changes
69 ===============================
70
71 * "log --follow-first -rREV", which is deprecated, now follows the first
72 parent of merge revisions from the specified "REV" just like "log --follow
73 -rREV".
74
75 * "log --follow -rREV FILE.." now follows file history across copies and
76 renames.
77
78 Bug Fixes
79 =========
80
81 Issue 5165
82 ----------
83
84 Bookmark, whose name is longer than 255, can again be exchanged again between
85 4.4+ client and servers.
86
87 Performance Improvements
88 ========================
89
90 * bundle2 read I/O throughput significantly increased.
91
92 * Significant memory use reductions when reading from bundle2 bundles.
93
94 On the BSD repository, peak RSS during changegroup application decreased by
95 ~185 MB from ~752 MB to ~567 MB.
96
97 API Changes
98 ===========
99
100 * bundlerepo.bundlerepository.bundle and
101 bundlerepo.bundlerepository.bundlefile are now prefixed with an underscore.
102
103 * Rename bundlerepo.bundlerepository.bundlefilespos to _cgfilespos.
104
105 * dirstate no longer provides a 'dirs()' method. To test for the existence of
106 a directory in the dirstate, use 'dirstate.hasdir(dirname)'.
107
108 * bundle2 parts are no longer seekable by default.
109
110 * mapping does not contain all template resources. use context.resource() in
111 template functions.
112
113 * "text=False|True" option is dropped from the vfs interface because of Python
114 3 compatibility issue. Use "util.tonativeeol/fromnativeeol()" to convert EOL
115 manually.
116
117 * wireproto.streamres.__init__ no longer accepts a "reader" argument. Use the
118 "gen" argument instead.
119
120 * exchange.getbundlechunks() now returns a 2-tuple instead of just an
121 iterator.
122
123
124 === commands ===
125 * amend: do not drop missing files (Bts:issue5732)
126 * amend: do not take untracked files as modified or clean (Bts:issue5732)
127 * amend: update .hgsubstate before committing a memctx (Bts:issue5677)
128 * annotate: add support to specify hidden revs if directaccess config is set
129 * bookmark: add methods to binary encode and decode bookmark values
130 * bookmark: deprecate direct update of a bookmark value
131 * bookmark: introduce a 'bookmarks' part
132 * bookmark: introduce in advance a variant of the exchange test
133 * bookmark: run 'pushkey' hooks after bookmark move, not 'prepushkey'
134 * bookmarks: add bookmarks to hidden revs if directaccess config is set
135 * bookmarks: calculate visibility exceptions only once
136 * bookmarks: display the obsfate of hidden revision we create a bookmark on
137 * bookmarks: fix pushkey compatibility mode (Bts:issue5777)
138 * bookmarks: use context managers for lock and transaction in update()
139 * bookmarks: use context managers for locks and transaction in pushbookmark()
140 * branch: allow changing branch name to existing name if possible
141 * clone: add support for storing remotenames while cloning
142 * clone: use utility function to write hgrc
143 * clonebundle: make it possible to retrieve the initial bundle through largefile
144 * commandserver: restore cwd in case of exception
145 * commandserver: unblock SIGCHLD
146 * help: deprecate ui.slash in favor of slashpath template filter (Bts:issue5572)
147 * log: allow matchfn to be non-null even if both --patch/--stat are off
148 * log: build follow-log filematcher at once
149 * log: don't expand aliases in revset built from command options
150 * log: make "slowpath" condition slightly more readable
151 * log: make opt2revset table a module constant
152 * log: merge getlogrevs() and getgraphlogrevs()
153 * log: remove temporary variable 'date' used only once
154 * log: resolve --follow thoroughly in getlogrevs()
155 * log: resolve --follow with -rREV in cmdutil.getlogrevs()
156 * log: simplify 'x or ancestors(x)' expression
157 * log: translate column labels at once (Bts:issue5750)
158 * log: use revsetlang.formatspec() thoroughly
159 * log: use revsetlang.formatspec() to concatenate list expression
160 * log: use smartset.slice() to limit number of revisions to be displayed
161 * merge: cache unknown dir checks (Bts:issue5716)
162 * merge: check created file dirs for path conflicts only once (Bts:issue5716)
163 * patch: add within-line color diff capacity
164 * patch: catch unexpected case in _inlinediff
165 * patch: do not break up multibyte character when highlighting word
166 * patch: improve heuristics to not take the word "diff" as header (Bts:issue1879)
167 * patch: reverse _inlinediff output for consistency
168 * pull: clarify that -u only updates linearly
169 * pull: hold wlock for the full operation when --update is used
170 * pull: retrieve bookmarks through the binary part when possible
171 * pull: store binary node in pullop.remotebookmarks
172 * push: include a 'check:bookmarks' part when possible
173 * push: restrict common discovery to the pushed set
174 * revert: support reverting to hidden cset if directaccess config is set
175
176 === core ===
177 * filelog: add the ability to report the user facing name
178 * revlog: choose between ifh and dfh once for all
179 * revlog: don't use slicing to return parents
180 * revlog: group delta computation methods under _deltacomputer object
181 * revlog: group revision info into a dedicated structure
182 * revlog: introduce 'deltainfo' to distinguish from 'delta'
183 * revlog: rename 'rev' to 'base', as it is the base revision
184 * revlog: separate diff computation from the collection of other info
185 * revset: evaluate filesets against each revision for 'file()' (Bts:issue5778)
186 * revset: parse x^:: as (x^):: (Bts:issue5764)
187 * templater: look up symbols/resources as if they were separated (Bts:issue5699)
188 * transaction: register summary callbacks only at start of transaction (BC)
189 * util: whitelist NTFS for hardlink creation (Bts:issue4580)
190
191 === extensions ===
192 * convert: restore the ability to use bzr < 2.6.0 (Bts:issue5733)
193 * histedit: add support to output nodechanges using formatter
194 * largefiles: add a 'debuglfput' command to put largefile into the store
195 * largefiles: add support for 'largefiles://' url scheme
196 * largefiles: allow to run 'debugupgraderepo' on repo with largefiles
197 * largefiles: convert EOL of hgrc before appending to bytes IO
198 * largefiles: explicitly set the source and sink types to 'hg' for lfconvert
199 * largefiles: modernize how capabilities are added to the wire protocol
200 * largefiles: pay attention to dropped standin files when updating largefiles
201 * rebase: add concludememorynode(), and call it when rebasing in-memory
202 * rebase: add the --inmemory option flag; assign a wctx object for the rebase
203 * rebase: add ui.log calls for whether IMM used, whether rebasing WCP
204 * rebase: disable 'inmemory' if the rebaseset contains the working copy
205 * rebase: do not bail on uncomitted changes if rebasing in-memory
206 * rebase: do not update if IMM; instead, set the overlaywctx's parents
207 * rebase: don't run IMM if running rebase in a transaction
208 * rebase: don't take out a dirstate guard for in-memory rebase
209 * rebase: drop --style option
210 * rebase: fix for hgsubversion
211 * rebase: pass the wctx object (IMM or on-disk) to merge.update
212 * rebase: pass wctx to rebasenode()
213 * rebase: rerun a rebase on-disk if IMM merge conflicts arise
214 * rebase: switch ui.log calls to common style
215 * rebase: use fm.formatlist() and fm.formatdict() to support user template
216
217 === hgweb ===
218 * hgweb: disable diff.noprefix option for diffstat
219 * hgweb: drop support of browsers that don't understand <canvas> (BC)
220 * hgweb: only include graph-related data in jsdata variable on /graph pages (BC)
221 * hgweb: stop adding strings to innerHTML of #graphnodes and #nodebgs (BC)
222
223 === unsorted ===
224 * archive: add support to specify hidden revs if directaccess config is set
225 * atomicupdate: add an experimental option to use atomictemp when updating
226 * bundle: allow bundlerepo to support alternative manifest implementations
227 * changelog: introduce a 'tiprev' method
228 * changelog: use 'tiprev()' in 'tip()'
229 * completion: add support for new "amend" command
230 * debugssl: convert port number to int (Bts:issue5757)
231 * diff: disable diff.noprefix option for diffstat (Bts:issue5759)
232 * dispatch: abort if early boolean options can't be parsed
233 * dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
234 * dispatch: add option to not strip command args parsed by _earlygetopt()
235 * dispatch: alias --repo to --repository while parsing early options
236 * dispatch: convert non-list option parsed by _earlygetopt() to string
237 * dispatch: fix early parsing of short option with value like -R=foo
238 * dispatch: handle IOError when writing to stderr
239 * dispatch: stop parsing of early boolean option at "--"
240 * dispatch: verify result of early command parsing
241 * evolution: make reporting of new unstable changesets optional
242 * extdata: abort if external command exits with non-zero status (BC)
243 * fancyopts: add early-options parser compatible with getopt()
244 * graphlog: add another graph node type, unstable, using character "*" (BC)
245 * hgdemandimport: use correct hyperlink to python-bug in comments (Bts:issue5765)
246 * httppeer: add support for tracing all http request made by the peer
247 * identify: document -r. explicitly how to disable wdir scanning (Bts:issue5622)
248 * lfs: register config options
249 * localrepo: specify optional callback parameter to pathauditor as a keyword
250 * match: do not weirdly include explicit files excluded by -X option
251 * memfilectx: make changectx argument mandatory in constructor (API)
252 * morestatus: don't crash with different drive letters for repo.root and CWD
253 * outgoing: respect ":pushurl" paths (Bts:issue5365)
254 * remove: print message for each file in verbose mode only while using '-A' (BC)
255 * rewriteutil: use precheck() in uncommit and amend commands
256 * scmutil: don't try to delete origbackup symlinks to directories (Bts:issue5731)
257 * sshpeer: add support for request tracing
258 * streamclone: add support for bundle2 based stream clone
259 * streamclone: add support for cloning non append-only file
260 * streamclone: also stream caches to the client
261 * streamclone: define first iteration of version 2 of stream format
262 * streamclone: move wire protocol status code from wireproto command
263 * streamclone: rework canperformstreamclone
264 * streamclone: tests phase exchange during stream clone
265 * streamclone: use readexactly when reading stream v2
266 * subrepo: add config option to reject any subrepo operations (SEC)
267 * subrepo: disable git and svn subrepos by default (BC) (SEC)
268 * subrepo: extend config option to disable subrepos by type (SEC)
269 * subrepo: handle 'C:' style paths on the command line (Bts:issue5770)
270 * subrepo: use per-type config options to enable subrepos
271 * svnsubrepo: check if subrepo is missing when checking dirty state (Bts:issue5657)
272 * tr-summary: keep a weakref to the unfiltered repository
273 * unamend: fix command summary line
274 * uncommit: unify functions _uncommitdirstate and _unamenddirstate to one
275 * update: support updating to hidden cset if directaccess config is set
276
277 === BC ===
278
279 * extdata: abort if external command exits with non-zero status (BC)
280 * graphlog: add another graph node type, unstable, using character "*" (BC)
281 * hgweb: drop support of browsers that don't understand <canvas> (BC)
282 * hgweb: only include graph-related data in jsdata variable on /graph pages (BC)
283 * hgweb: stop adding strings to innerHTML of #graphnodes and #nodebgs (BC)
284 * remove: print message for each file in verbose mode only while using '-A' (BC)
285 * subrepo: disable git and svn subrepos by default (BC) (SEC)
286 * transaction: register summary callbacks only at start of transaction (BC)
287
288 === API Changes ===
289
290 * memfilectx: make changectx argument mandatory in constructor (API)
General Comments 0
You need to be logged in to leave comments. Login now