| 1 | ## |
| 2 | ## Format |
| 3 | ## |
| 4 | ## ACTION: [AUDIENCE:] COMMIT_MSG |
| 5 | ## |
| 6 | ## Description |
| 7 | ## |
| 8 | ## ACTION is one of 'chg', 'fix', 'new', 'rem', 'sec' |
| 9 | ## |
| 10 | ## Is WHAT the change is about. |
| 11 | ## |
| 12 | ## 'chg' is for refactor, small improvement, cosmetic changes... |
| 13 | ## 'fix' is for bug fixes |
| 14 | ## 'new' is for new features, big improvement |
| 15 | ## 'rem' is for removed features |
| 16 | ## 'sec' is for security fixes |
| 17 | ## |
| 18 | ## Each MR title should have exactly one ACTION, and no non-merge commits should have these. |
| 19 | ## |
| 20 | ## AUDIENCE is optional and can be 'dev', 'usr', 'pkg', 'test', 'doc' |
| 21 | ## |
| 22 | ## Is WHO is concerned by the change. |
| 23 | ## |
| 24 | ## Included in release notes and changelog: |
| 25 | ## 'usr' is for final users |
| 26 | ## 'pkg' is for packagers |
| 27 | ## |
| 28 | ## Included in changelog: |
| 29 | ## 'dev' is for developers |
| 30 | ## |
| 31 | ## Omitted from changelog: |
| 32 | ## 'test' is for test-only changes |
| 33 | ## 'doc' is for doc-only changes |
| 34 | ## |
| 35 | ## COMMIT_MSG is ... well ... the commit message itself. |
| 36 | ## |
| 37 | ## |
| 38 | ## Examples: |
| 39 | ## |
| 40 | ## If you want to add a release note, mark it for usr or pkg audience: |
| 41 | ## |
| 42 | ## sec: usr: Fix CVE-YYYY-NNNN |
| 43 | ## rem: usr: Deprecate feature xyz |
| 44 | ## new: pkg: libngtcp2 is now required |
| 45 | ## |
| 46 | ## If you want to mention it just in the changelog, add dev audience: |
| 47 | ## |
| 48 | ## chg: dev: Refactor xyz |
| 49 | ## fix: dev: Fix a rare edge case of xyz |
| 50 | ## new: dev: Add new QTYPE |
| 51 | ## |
| 52 | ## If you don't specify audience context, or use a custom one, it won't end |
| 53 | ## up in the changelog: |
| 54 | ## |
| 55 | ## chg: doc: Tidy up the docs |
| 56 | ## fix: test: Fix a broken test |
| 57 | ## chg: Do some cleanup |
| 58 | ## sec: test: Add a test case for CVE-YYYY-NNNN |
| 59 | ## |
| 60 | ## Please note that multi-line commit messages are supported; only the first |
| 61 | ## line will be considered as the "summary" of the commit message. So tags |
| 62 | ## and other rules only apply to the summary. The body of the commit |
| 63 | ## message will be displayed in the changelog without reformatting. |
| 64 | |
| 65 | |
| 66 | ## |
| 67 | ## ``ignore_regexps`` is a line of regexps |
| 68 | ## |
| 69 | ## Any commit having its full commit message matching any regexp listed here |
| 70 | ## will be ignored and won't be reported in the changelog. |
| 71 | ## |
| 72 | ignore_regexps = [ |
| 73 | r"^$", ## ignore commits with empty messages |
| 74 | ] |
| 75 | |
| 76 | |
| 77 | ## ``section_regexps`` is a list of 2-tuples associating a string label and a |
| 78 | ## list of regexp |
| 79 | ## |
| 80 | ## Commit messages will be classified in sections thanks to this. Section |
| 81 | ## titles are the label, and a commit is classified under this section if any |
| 82 | ## of the regexps associated is matching. |
| 83 | ## |
| 84 | ## Please note that ``section_regexps`` will only classify commits and won't |
| 85 | ## make any changes to the contents. So you'll probably want to go check |
| 86 | ## ``subject_process`` (or ``body_process``) to do some changes to the subject, |
| 87 | ## whenever you are tweaking this variable. |
| 88 | ## |
| 89 | section_regexps = [ |
| 90 | ( |
| 91 | "Security Fixes", |
| 92 | [ |
| 93 | r"^(\[9\.[0-9]{2}(-S)?\])?\s*(\[[^]]*\]\s*)?sec:\s*(dev|usr|pkg)\s*:\s*([^\n]*)$", |
| 94 | ], |
| 95 | ), |
| 96 | ( |
| 97 | "New Features", |
| 98 | [ |
| 99 | r"^(\[9\.[0-9]{2}(-S)?\])?\s*(\[[^]]*\]\s*)?new:\s*(dev|usr|pkg)\s*:\s*([^\n]*)$", |
| 100 | ], |
| 101 | ), |
| 102 | ( |
| 103 | "Removed Features", |
| 104 | [ |
| 105 | r"^(\[9\.[0-9]{2}(-S)?\])?\s*(\[[^]]*\]\s*)?rem:\s*(dev|usr|pkg)\s*:\s*([^\n]*)$", |
| 106 | ], |
| 107 | ), |
| 108 | ( |
| 109 | "Feature Changes", |
| 110 | [ |
| 111 | r"^(\[9\.[0-9]{2}(-S)?\])?\s*(\[[^]]*\]\s*)?chg:\s*(dev|usr|pkg)\s*:\s*([^\n]*)$", |
| 112 | ], |
| 113 | ), |
| 114 | ( |
| 115 | "Bug Fixes", |
| 116 | [ |
| 117 | r"^(\[9\.[0-9]{2}(-S)?\])?\s*(\[[^]]*\]\s*)?fix:\s*(dev|usr|pkg)\s*:\s*([^\n]*)$", |
| 118 | ], |
| 119 | ), |
| 120 | ] |
| 121 | |
| 122 | |
| 123 | ## ``body_process`` is a callable |
| 124 | ## |
| 125 | ## This callable will be given the original body and result will |
| 126 | ## be used in the changelog. |
| 127 | ## |
| 128 | ## Available constructs are: |
| 129 | ## |
| 130 | ## - any python callable that take one txt argument and return txt argument. |
| 131 | ## |
| 132 | ## - ReSub(pattern, replacement): will apply regexp substitution. |
| 133 | ## |
| 134 | ## - Indent(chars=" "): will indent the text with the prefix |
| 135 | ## Please remember that template engines gets also to modify the text and |
| 136 | ## will usually indent themselves the text if needed. |
| 137 | ## |
| 138 | ## - Wrap(regexp=r"\n\n"): re-wrap text in separate paragraph to fill 80-Columns |
| 139 | ## |
| 140 | ## - noop: do nothing |
| 141 | ## |
| 142 | ## - ucfirst: ensure the first letter is uppercase. |
| 143 | ## (usually used in the ``subject_process`` pipeline) |
| 144 | ## |
| 145 | ## - final_dot: ensure text finishes with a dot |
| 146 | ## (usually used in the ``subject_process`` pipeline) |
| 147 | ## |
| 148 | ## - strip: remove any spaces before or after the content of the string |
| 149 | ## |
| 150 | ## - SetIfEmpty(msg="No commit message."): will set the text to |
| 151 | ## whatever given ``msg`` if the current text is empty. |
| 152 | ## |
| 153 | ## Additionally, you can `pipe` the provided filters, for instance: |
| 154 | # body_process = Wrap(regexp=r'\n(?=\w+\s*:)') | Indent(chars=" ") |
| 155 | # body_process = Wrap(regexp=r'\n(?=\w+\s*:)') |
| 156 | # body_process = noop |
| 157 | body_process = ( |
| 158 | ReSub(r"\n*See merge request isc-private/bind9!\d+", r"") |
| 159 | | ReSub(r"https://gitlab.isc.org/isc-projects/bind9/-/issues/", r"#") |
| 160 | | ReSub(r"https://gitlab.isc.org/isc-projects/bind9/-/merge_requests/", r"!") |
| 161 | | ReSub(r"\n*Backport of [^\n]+", r"") |
| 162 | | ReSub(r"\n*(Replaces|Supersedes)[^\n]+", r"") |
| 163 | | ReSub( |
| 164 | r"\n*(Closes|Fixes|Related|See):?\s*(isc-projects/bind9)?((#|!)\d+)", |
| 165 | r" :gl:`\3`", |
| 166 | ) |
| 167 | | ReSub(r"\n*Merge branch '[^']+' into [^\n]+", r"") |
| 168 | | ReSub(r"\n*See merge request isc-projects/bind9(!\d+)", r" :gl:`\1`") |
| 169 | | Wrap(regexp="\n\n", separator="\n\n") |
| 170 | | strip |
| 171 | ) |
| 172 | |
| 173 | ## ``subject_process`` is a callable |
| 174 | ## |
| 175 | ## This callable will be given the original subject and result will |
| 176 | ## be used in the changelog. |
| 177 | ## |
| 178 | ## Available constructs are those listed in ``body_process`` doc. |
| 179 | subject_process = ( |
| 180 | strip |
| 181 | | ReSub( |
| 182 | r"^(\[9\.[0-9]{2}(-S)?\])?\s*(\[[^]]*\]\s*)?(chg|fix|new|rem|sec):\s*((dev|usr|pkg)\s*:\s*)?([^\n]*)$", |
| 183 | r"\3\7", |
| 184 | ) |
| 185 | | SetIfEmpty("No commit message.") |
| 186 | | ucfirst |
| 187 | | final_dot |
| 188 | ) |
| 189 | |
| 190 | ## ``tag_filter_regexp`` is a regexp |
| 191 | ## |
| 192 | ## Tags that will be used for the changelog must match this regexp. |
| 193 | ## |
| 194 | tag_filter_regexp = r"^v9\.[0-9]+\.[0-9]+(-S[0-9]+)?$" |
| 195 | |
| 196 | |
| 197 | ## ``unreleased_version_label`` is a string or a callable that outputs a string |
| 198 | ## |
| 199 | ## This label will be used as the changelog Title of the last set of changes |
| 200 | ## between last valid tag and HEAD if any. |
| 201 | unreleased_version_label = "(-dev)" |
| 202 | |
| 203 | |
| 204 | ## ``include_commit_sha`` is a boolean to indicate whether the sha of the |
| 205 | ## commit should be included in the change |
| 206 | include_commit_sha = True |
| 207 | |
| 208 | |
| 209 | ## ``output_engine`` is a callable |
| 210 | ## |
| 211 | ## This will change the output format of the generated changelog file |
| 212 | ## |
| 213 | ## Available choices are: |
| 214 | ## |
| 215 | ## - rest_py |
| 216 | ## |
| 217 | ## Legacy pure python engine, outputs ReSTructured text. |
| 218 | ## This is the default. |
| 219 | ## |
| 220 | ## - mustache(<template_name>) |
| 221 | ## |
| 222 | ## Template name could be any of the available templates in |
| 223 | ## ``templates/mustache/*.tpl``. |
| 224 | ## Requires python package ``pystache``. |
| 225 | ## Examples: |
| 226 | ## - mustache("markdown") |
| 227 | ## - mustache("restructuredtext") |
| 228 | ## |
| 229 | ## - makotemplate(<template_name>) |
| 230 | ## |
| 231 | ## Template name could be any of the available templates in |
| 232 | ## ``templates/mako/*.tpl``. |
| 233 | ## Requires python package ``mako``. |
| 234 | ## Examples: |
| 235 | ## - makotemplate("restructuredtext") |
| 236 | ## |
| 237 | output_engine = rest_py |
| 238 | # output_engine = mustache("restructuredtext") |
| 239 | # output_engine = mustache("markdown") |
| 240 | # output_engine = makotemplate("restructuredtext") |
| 241 | |
| 242 | |
| 243 | ## ``include_merge`` is a boolean |
| 244 | ## |
| 245 | ## This option tells git-log whether to include merge commits in the log. |
| 246 | ## The default is to include them. |
| 247 | include_merge = True |
| 248 | |
| 249 | |
| 250 | ## ``log_encoding`` is a string identifier |
| 251 | ## |
| 252 | ## This option tells gitchangelog what encoding is outputed by ``git log``. |
| 253 | ## The default is to be clever about it: it checks ``git config`` for |
| 254 | ## ``i18n.logOutputEncoding``, and if not found will default to git's own |
| 255 | ## default: ``utf-8``. |
| 256 | # log_encoding = 'utf-8' |
| 257 | |
| 258 | |
| 259 | ## ``publish`` is a callable |
| 260 | ## |
| 261 | ## Sets what ``gitchangelog`` should do with the output generated by |
| 262 | ## the output engine. ``publish`` is a callable taking one argument |
| 263 | ## that is an interator on lines from the output engine. |
| 264 | ## |
| 265 | ## Some helper callable are provided: |
| 266 | ## |
| 267 | ## Available choices are: |
| 268 | ## |
| 269 | ## - stdout |
| 270 | ## |
| 271 | ## Outputs directly to standard output |
| 272 | ## (This is the default) |
| 273 | ## |
| 274 | ## - FileInsertAtFirstRegexMatch(file, pattern, idx=lamda m: m.start()) |
| 275 | ## |
| 276 | ## Creates a callable that will parse given file for the given |
| 277 | ## regex pattern and will insert the output in the file. |
| 278 | ## ``idx`` is a callable that receive the matching object and |
| 279 | ## must return a integer index point where to insert the |
| 280 | ## the output in the file. Default is to return the position of |
| 281 | ## the start of the matched string. |
| 282 | ## |
| 283 | ## - FileRegexSubst(file, pattern, replace, flags) |
| 284 | ## |
| 285 | ## Apply a replace inplace in the given file. Your regex pattern must |
| 286 | ## take care of everything and might be more complex. Check the README |
| 287 | ## for a complete copy-pastable example. |
| 288 | ## |
| 289 | # publish = FileInsertIntoFirstRegexMatch( |
| 290 | # "CHANGELOG.rst", |
| 291 | # r'/(?P<rev>[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n/', |
| 292 | # idx=lambda m: m.start(1) |
| 293 | # ) |
| 294 | publish = stdout |
| 295 | |
| 296 | |
| 297 | ## ``revs`` is a list of callable or a list of string |
| 298 | ## |
| 299 | ## callable will be called to resolve as strings and allow dynamical |
| 300 | ## computation of these. The result will be used as revisions for |
| 301 | ## gitchangelog (as if directly stated on the command line). This allows |
| 302 | ## to filter exaclty which commits will be read by gitchangelog. |
| 303 | ## |
| 304 | ## To get a full documentation on the format of these strings, please |
| 305 | ## refer to the ``git rev-list`` arguments. There are many examples. |
| 306 | ## |
| 307 | ## Using callables is especially useful, for instance, if you |
| 308 | ## are using gitchangelog to generate incrementally your changelog. |
| 309 | ## |
| 310 | ## Some helpers are provided, you can use them:: |
| 311 | ## |
| 312 | ## - FileFirstRegexMatch(file, pattern): will return a callable that will |
| 313 | ## return the first string match for the given pattern in the given file. |
| 314 | ## If you use named sub-patterns in your regex pattern, it'll output only |
| 315 | ## the string matching the regex pattern named "rev". |
| 316 | ## |
| 317 | ## - Caret(rev): will return the rev prefixed by a "^", which is a |
| 318 | ## way to remove the given revision and all its ancestor. |
| 319 | ## |
| 320 | ## Please note that if you provide a rev-list on the command line, it'll |
| 321 | ## replace this value (which will then be ignored). |
| 322 | ## |
| 323 | ## If empty, then ``gitchangelog`` will act as it had to generate a full |
| 324 | ## changelog. |
| 325 | ## |
| 326 | ## The default is to use all commits to make the changelog. |
| 327 | # revs = ["^1.0.3", ] |
| 328 | # revs = [ |
| 329 | # Caret( |
| 330 | # FileFirstRegexMatch( |
| 331 | # "CHANGELOG.rst", |
| 332 | # r"(?P<rev>[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n")), |
| 333 | # "HEAD" |
| 334 | # ] |
| 335 | revs = [] |