contrib/relnotes
changeset 41518 530d211ae9a8
parent 40452 683e99f0b30c
child 43659 99e231afc29c
equal deleted inserted replaced
41517:549f956ba2a9 41518:530d211ae9a8
    12 rules = {
    12 rules = {
    13     # keep
    13     # keep
    14     r"\(issue": 100,
    14     r"\(issue": 100,
    15     r"\(BC\)": 100,
    15     r"\(BC\)": 100,
    16     r"\(API\)": 100,
    16     r"\(API\)": 100,
       
    17     r"\(SEC\)": 100,
    17     # core commands, bump up
    18     # core commands, bump up
    18     r"(commit|files|log|pull|push|patch|status|tag|summary)(|s|es):": 20,
    19     r"(commit|files|log|pull|push|patch|status|tag|summary)(|s|es):": 20,
    19     r"(annotate|alias|branch|bookmark|clone|graft|import|verify).*:": 20,
    20     r"(annotate|alias|branch|bookmark|clone|graft|import|verify).*:": 20,
    20     # extensions, bump up
    21     # extensions, bump up
    21     r"(mq|shelve|rebase):": 20,
    22     r"(mq|shelve|rebase):": 20,
    22     # newsy
    23     # newsy
    23     r": deprecate": 20,
    24     r": deprecate": 20,
       
    25     r": new.*(extension|flag|module)": 10,
    24     r"( ability|command|feature|option|support)": 10,
    26     r"( ability|command|feature|option|support)": 10,
    25     # experimental
    27     # experimental
    26     r"hg-experimental": 20,
    28     r"hg-experimental": 20,
    27     r"(from|graduate).*experimental": 15,
    29     r"(from|graduate).*experimental": 15,
    28     r"(hide|mark).*experimental": -10,
    30     r"(hide|mark).*experimental": -10,
    29     # bug-like?
    31     # bug-like?
    30     r"(fix|don't break|improve)": 7,
    32     r"(fix|don't break|improve)": 7,
    31     r"(not|n't|avoid|fix|prevent).*crash": 10,
    33     r"(not|n't|avoid|fix|prevent).*crash": 10,
       
    34     r"vulnerab": 10,
    32     # boring stuff, bump down
    35     # boring stuff, bump down
    33     r"^contrib": -5,
    36     r"^contrib": -5,
    34     r"debug": -5,
    37     r"debug": -5,
    35     r"help": -5,
    38     r"help": -5,
       
    39     r"minor": -5,
    36     r"(doc|metavar|bundle2|obsolete|obsmarker|rpm|setup|debug\S+:)": -15,
    40     r"(doc|metavar|bundle2|obsolete|obsmarker|rpm|setup|debug\S+:)": -15,
    37     r"(check-code|check-commit|check-config|import-checker)": -20,
    41     r"(check-code|check-commit|check-config|import-checker)": -20,
    38     r"(flake8|lintian|pyflakes|pylint)": -20,
    42     r"(flake8|lintian|pyflakes|pylint)": -20,
    39     # cleanups and refactoring
    43     # cleanups and refactoring
    40     r"(cleanup|white ?space|spelling|quoting)": -20,
    44     r"(clean ?up|white ?space|spelling|quoting)": -20,
    41     r"(flatten|dedent|indent|nesting|unnest)": -20,
    45     r"(flatten|dedent|indent|nesting|unnest)": -20,
    42     r"(typo|hint|note|comment|TODO|FIXME)": -20,
    46     r"(typo|hint|note|comment|TODO|FIXME)": -20,
    43     r"(style:|convention|one-?liner)": -20,
    47     r"(style:|convention|one-?liner)": -20,
    44     r"_": -10,
       
    45     r"(argument|absolute_import|attribute|assignment|mutable)": -15,
    48     r"(argument|absolute_import|attribute|assignment|mutable)": -15,
    46     r"(scope|True|False)": -10,
    49     r"(scope|True|False)": -10,
    47     r"(unused|useless|unnecessary|superfluous|duplicate|deprecated)": -10,
    50     r"(unused|useless|unnecessar|superfluous|duplicate|deprecated)": -10,
    48     r"(redundant|pointless|confusing|uninitialized|meaningless|dead)": -10,
    51     r"(redundant|pointless|confusing|uninitialized|meaningless|dead)": -10,
    49     r": (drop|remove|delete|rip out)": -10,
    52     r": (drop|remove|delete|rip out)": -10,
    50     r": (inherit|rename|simplify|naming|inline)": -10,
    53     r": (inherit|rename|simplify|naming|inline)": -10,
    51     r"(correct doc|docstring|document .* method)": -20,
    54     r"(correct doc|docstring|document .* method)": -20,
    52     r"(abstract|factor|extract|prepare|split|replace| import)": -20,
    55     r"(abstract|factor|extract|prepare|split|replace| import)": -20,
    53     r": add.*(function|method|implementation|example)": -10,
    56     r": add.*(function|method|implementation|example)": -10,
    54     r": (move|extract) .* (to|into|from|out of)": -20,
    57     r": (move|extract) .* (to|into|from|out of)": -20,
    55     r": implement ": -5,
    58     r": implement ": -5,
    56     r": use .* implementation": -20,
    59     r": use .* implementation": -20,
       
    60     r": use .* instead of": -20,
       
    61     # code
       
    62     r"_": -10,
       
    63     r"__": -5,
       
    64     r"\(\)": -5,
    57     r"\S\S\S+\.\S\S\S\S+": -5,
    65     r"\S\S\S+\.\S\S\S\S+": -5,
    58     r": use .* instead of": -20,
       
    59     r"__": -5,
       
    60     # dumb keywords
    66     # dumb keywords
    61     r"\S+/\S+:": -10,
    67     r"\S+/\S+:": -10,
    62     r"\S+\.\S+:": -10,
    68     r"\S+\.\S+:": -10,
    63     # python compatibility
    69     # python compatibility
    64     r"[Pp]y(|thon) ?[23]": -20,
    70     r"[Pp]y(|thon) ?[23]": -20,
    89     (r"commands|commit|config|files|graft|import|log|merge|patch", "commands"),
    95     (r"commands|commit|config|files|graft|import|log|merge|patch", "commands"),
    90     (r"phases|status|summary|amend|tag|help|verify", "commands"),
    96     (r"phases|status|summary|amend|tag|help|verify", "commands"),
    91     (r"rebase|mq|convert|eol|histedit|largefiles", "extensions"),
    97     (r"rebase|mq|convert|eol|histedit|largefiles", "extensions"),
    92     (r"shelve|unshelve", "extensions"),
    98     (r"shelve|unshelve", "extensions"),
    93 ]
    99 ]
       
   100 
       
   101 def wikify(desc):
       
   102     desc = desc.replace("(issue", "(Bts:issue")
       
   103     desc = re.sub(r"\b([0-9a-f]{12})\b", r"Cset:\1", desc)
       
   104     # stop ParseError from being recognized as a (nonexistent) wiki page
       
   105     desc = re.sub(r" ([A-Z][a-z]+[A-Z][a-z]+)\b", r" !\1", desc)
       
   106     # prevent wiki markup of magic methods
       
   107     desc = re.sub(r"\b(\S*__\S*)\b", r"`\1`", desc)
       
   108     return desc
    94 
   109 
    95 def main():
   110 def main():
    96     desc = "example: %(prog)s 4.7.2 --stoprev 4.8rc0"
   111     desc = "example: %(prog)s 4.7.2 --stoprev 4.8rc0"
    97     ap = argparse.ArgumentParser(description=desc)
   112     ap = argparse.ArgumentParser(description=desc)
    98     ap.add_argument(
   113     ap.add_argument(
   146         score = 0
   161         score = 0
   147         for rule, val in rules.items():
   162         for rule, val in rules.items():
   148             if re.search(rule, desc):
   163             if re.search(rule, desc):
   149                 score += val
   164                 score += val
   150 
   165 
   151         desc = desc.replace("(issue", "(Bts:issue")
       
   152 
       
   153         if score >= cutoff:
   166         if score >= cutoff:
   154             commits.append(desc)
   167             commits.append(wikify(desc))
   155     # Group unflagged notes.
   168     # Group unflagged notes.
   156     groups = {}
   169     groups = {}
   157     bcs = []
   170     bcs = []
   158     apis = []
   171     apis = []
   159 
   172