[PATCH] relnotes: various tweaks for release notes

Anton Shestakov av6 at dwimlabs.net
Fri Nov 2 14:07:46 UTC 2018


# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1539958193 -28800
#      Fri Oct 19 22:09:53 2018 +0800
# Node ID 4db7723d4f4c9a90fe917787cc1afe7e3db74ee3
# Parent  8c124d10ae02790e0e33fbc2a5af463e97f2d5b3
# EXP-Topic relnotes
relnotes: various tweaks for release notes

Stop filtering out commits that are expected to be covered by releasenotes
extension: now we want two lists, one for WhatsNew and one for ReleaseX.Y.

Use `only(stoprev, startrev)` to make `relnotes -h` output be actually true
about what revisions are included.

More filter rules, mostly obvious.

More classifying rules to have less things in "unsorted".

Looks like nargs=1 was just making args.startrev and args.stoprev be lists for
no reason.

BC and API sections are renamed to what we're using on the WhatsNew page, and
also just skipped if empty.

diff --git a/contrib/relnotes b/contrib/relnotes
--- a/contrib/relnotes
+++ b/contrib/relnotes
@@ -9,11 +9,6 @@ import argparse
 import re
 import subprocess
 
-# Regenerate this list with
-#   hg export 'grep("\.\. [a-z]+::")' | grep '^\.\.' | \
-#     sed 's/.. //;s/::.*//' | sort -u
-rnsections = ["api", "bc", "container", "feature", "fix", "note", "perf"]
-
 rules = {
     # keep
     r"\(issue": 100,
@@ -26,27 +21,37 @@ rules = {
     r"(mq|shelve|rebase):": 20,
     # newsy
     r": deprecate": 20,
-    r"(option|feature|command|support)": 10,
+    r"( ability|command|feature|option|support)": 10,
+    # experimental
+    r"hg-experimental": 20,
+    r"(from|graduate).*experimental": 15,
+    r"(hide|mark).*experimental": -10,
     # bug-like?
     r"(fix|don't break|improve)": 7,
+    r"(not|n't|avoid|fix|prevent).*crash": 10,
     # boring stuff, bump down
     r"^contrib": -5,
     r"debug": -5,
     r"help": -5,
-    r"(doc|bundle2|obsolete|obsmarker|rpm|setup|debug\S+:)": -15,
-    r"(check-code|check-commit|import-checker)": -20,
+    r"(doc|metavar|bundle2|obsolete|obsmarker|rpm|setup|debug\S+:)": -15,
+    r"(check-code|check-commit|check-config|import-checker)": -20,
+    r"(flake8|lintian|pyflakes|pylint)": -20,
     # cleanups and refactoring
-    r"(cleanup|whitespace|nesting|indent|spelling|comment)": -20,
-    r"(typo|hint|note|style:|correct doc)": -20,
+    r"(cleanup|white ?space|spelling|quoting)": -20,
+    r"(flatten|dedent|indent|nesting|unnest)": -20,
+    r"(typo|hint|note|comment|TODO|FIXME)": -20,
+    r"(style:|convention|one-?liner)": -20,
     r"_": -10,
     r"(argument|absolute_import|attribute|assignment|mutable)": -15,
-    r"(unused|useless|unnecessary|duplicate|deprecated|scope|True|False)": -10,
+    r"(scope|True|False)": -10,
+    r"(unused|useless|unnecessary|superfluous|duplicate|deprecated)": -10,
     r"(redundant|pointless|confusing|uninitialized|meaningless|dead)": -10,
-    r": (drop|remove|inherit|rename|simplify|naming|inline)": -10,
-    r"(docstring|document .* method)": -20,
-    r"(factor|extract|prepare|split|replace| import)": -20,
-    r": add.*(function|method|implementation|test|example)": -10,
-    r": (move|extract) .* (to|into|from)": -20,
+    r": (drop|remove|delete|rip out)": -10,
+    r": (inherit|rename|simplify|naming|inline)": -10,
+    r"(correct doc|docstring|document .* method)": -20,
+    r"(abstract|factor|extract|prepare|split|replace| import)": -20,
+    r": add.*(function|method|implementation|example)": -10,
+    r": (move|extract) .* (to|into|from|out of)": -20,
     r": implement ": -5,
     r": use .* implementation": -20,
     r"\S\S\S+\.\S\S\S\S+": -5,
@@ -55,15 +60,20 @@ rules = {
     # dumb keywords
     r"\S+/\S+:": -10,
     r"\S+\.\S+:": -10,
+    # python compatibility
+    r"[Pp]y(|thon) ?[23]": -20,
+    r"pycompat": -20,
+    r"(coerce|convert|encode) .*to (byte|sys|)(s|str|string)": -20,
+    # tests
+    r"^test(|s|ing|runner|-\S+):": -20,
+    r"^(f|hghave|run-tests):": -20,
+    r"add.* tests?": -20,
+    r"(buildbot|fuzz|mock|ratchet)": -10,
     # drop
     r"^i18n-": -50,
     r"^i18n:.*(hint|comment)": -50,
     r"perf:": -50,
-    r"check-code:": -50,
     r"Added.*for changeset": -50,
-    r"tests?:": -50,
-    r"test-": -50,
-    r"add.* tests": -50,
     r"^_": -50,
 }
 
@@ -72,9 +82,9 @@ commits = []
 
 groupings = [
     (r"util|parsers|repo|ctx|context|revlog|filelog|alias|cmdutil", "core"),
-    (r"revset|templater|ui|dirstate|hook|i18n|transaction|wire", "core"),
-    (r"color|pager", "core"),
-    (r"hgweb|paper|coal|gitweb", "hgweb"),
+    (r"revset|template|ui|dirstate|hook|i18n|transaction|wire|vfs", "core"),
+    (r"dispatch|exchange|localrepo|streamclone|color|pager", "core"),
+    (r"hgweb|paper|coal|gitweb|monoblue|spartan", "hgweb"),
     (r"pull|push|revert|resolve|annotate|bookmark|branch|clone", "commands"),
     (r"commands|commit|config|files|graft|import|log|merge|patch", "commands"),
     (r"phases|status|summary|amend|tag|help|verify", "commands"),
@@ -83,12 +93,12 @@ groupings = [
 ]
 
 def main():
-    ap = argparse.ArgumentParser()
+    desc = "example: %(prog)s 4.7.2 --stoprev 4.8rc0"
+    ap = argparse.ArgumentParser(description=desc)
     ap.add_argument(
         "startrev",
         metavar="REV",
         type=str,
-        nargs=1,
         help=(
             "Starting revision for the release notes. This revision "
             "won't be included, but later revisions will."
@@ -99,7 +109,6 @@ def main():
         metavar="REV",
         type=str,
         default="@",
-        nargs=1,
         help=(
             "Stop revision for release notes. This revision will be included,"
             " but no later revisions will. This revision needs to be "
@@ -114,7 +123,7 @@ def main():
             "extensions.releasenotes=",
             "releasenotes",
             "-r",
-            "%s::%s" % (args.startrev[0], args.stoprev[0]),
+            "only(%s, %s)" % (args.stoprev, args.startrev),
         ]
     ).decode("utf-8")
     # Find all release notes from un-relnotes-flagged commits.
@@ -124,8 +133,7 @@ def main():
                 "hg",
                 "log",
                 "-r",
-                r'%s::%s - merge() - grep("\n\.\. (%s)::")'
-                % (args.startrev[0], args.stoprev[0], "|".join(rnsections)),
+                "only(%s, %s) - merge()" % (args.stoprev, args.startrev),
                 "-T",
                 r"{desc|firstline}\n",
             ]
@@ -167,12 +175,14 @@ def main():
         for d in sorted(groups[g]):
             print(" * %s" % d)
 
-    print("\n=== BC ===\n")
+    if bcs:
+        print("\n=== Behavior Changes ===\n")
 
     for d in sorted(bcs):
         print(" * %s" % d)
 
-    print("\n=== API Changes ===\n")
+    if apis:
+        print("\n=== Internal API Changes ===\n")
 
     for d in sorted(apis):
         print(" * %s" % d)


More information about the Mercurial-devel mailing list