|
1 | 1 | # -*- coding: utf-8; mode: python -*- |
2 | | -## |
3 | | -## Format |
4 | | -## |
5 | | -## ACTION: COMMIT_MSG [!TAG ...] |
6 | | -## |
7 | | -## Description |
8 | | -## |
9 | | -## ACTION is one of 'feature', 'bugfix', 'other' |
10 | | -## |
11 | | -## COMMIT_MSG is ... well ... the commit message itself. |
12 | | -## |
13 | | -## TAGs are additionnal adjective as 'refactor' 'minor' 'cosmetic' |
14 | | -## |
15 | | -## They are preceded with a '!' or a '@' (prefer the former, as the |
16 | | -## latter is wrongly interpreted in github.) Commonly used tags are: |
17 | | -## |
18 | | -## 'refactor' is obviously for refactoring code only |
19 | | -## 'minor' is for a very meaningless change (a typo, adding a comment) |
20 | | -## 'cosmetic' is for cosmetic driven change (re-indentation, 80-col...) |
21 | | -## 'wip' is for partial functionality but complete subfunctionality. |
22 | | -## |
23 | | -## Example: |
24 | | -## |
25 | | -## feature/use-dask |
26 | | -## |
27 | | -## Please note that multi-line commit message are supported, and only the |
28 | | -## first line will be considered as the "summary" of the commit message. So |
29 | | -## tags, and other rules only applies to the summary. The body of the commit |
30 | | -## message will be displayed in the changelog without reformatting. |
31 | 2 |
|
32 | | - |
33 | | -## |
34 | | -## ``ignore_regexps`` is a line of regexps |
35 | | -## |
36 | | -## Any commit having its full commit message matching any regexp listed here |
37 | | -## will be ignored and won't be reported in the changelog. |
38 | | -## |
39 | 3 | ignore_regexps = [ |
40 | 4 | r'^(.{3,3}\s*:)?\s*[fF]irst commit.?\s*$', |
41 | 5 | r'^[iI]ntial commit.?\s*$', |
42 | | - r'^$', ## ignore commits with empty messages |
| 6 | + r'^$', # ignore commits with empty messages |
43 | 7 | r'^Bump version: .*', |
44 | 8 | ] |
45 | 9 |
|
46 | | - |
47 | | -## ``section_regexps`` is a list of 2-tuples associating a string label and a |
48 | | -## list of regexp |
49 | | -## |
50 | | -## Commit messages will be classified in sections thanks to this. Section |
51 | | -## titles are the label, and a commit is classified under this section if any |
52 | | -## of the regexps associated is matching. |
53 | | -## |
54 | | -## Please note that ``section_regexps`` will only classify commits and won't |
55 | | -## make any changes to the contents. So you'll probably want to go check |
56 | | -## ``subject_process`` (or ``body_process``) to do some changes to the subject, |
57 | | -## whenever you are tweaking this variable. |
58 | | -## |
59 | 10 | section_regexps = [ |
60 | | - ('New', [ |
61 | | - r'^[fF]eature.*$' |
| 11 | + ("New", [ |
| 12 | + r"^[fF]eature.*$", |
62 | 13 | ]), |
63 | | - ('Fix', [ |
64 | | - r'^[bB]ugfix.*$', |
65 | | - r'^[fF]ix.*$', |
66 | | - r'^[hH]otfix.*$', |
| 14 | + ("Fix", [ |
| 15 | + r"^[bB]ugfix.*$", |
| 16 | + r"^[fF]ix.*$", |
| 17 | + r"^[hH]otfix.*$", |
67 | 18 | ]), |
68 | | - ('Other', None), ## Match all lines |
| 19 | + ("Other", None), # Match all remaining |
69 | 20 | ] |
70 | 21 |
|
| 22 | +# Drop commit bodies from changelog (keep only titles) |
| 23 | +body_process = ReSub(r".*", "") | strip |
71 | 24 |
|
72 | | -## ``body_process`` is a callable |
73 | | -## |
74 | | -## This callable will be given the original body and result will |
75 | | -## be used in the changelog. |
76 | | -## |
77 | | -## Available constructs are: |
78 | | -## |
79 | | -## - any python callable that take one txt argument and return txt argument. |
80 | | -## |
81 | | -## - ReSub(pattern, replacement): will apply regexp substitution. |
82 | | -## |
83 | | -## - Indent(chars=" "): will indent the text with the prefix |
84 | | -## Please remember that template engines gets also to modify the text and |
85 | | -## will usually indent themselves the text if needed. |
86 | | -## |
87 | | -## - Wrap(regexp=r"\n\n"): re-wrap text in separate paragraph to fill 80-Columns |
88 | | -## |
89 | | -## - noop: do nothing |
90 | | -## |
91 | | -## - ucfirst: ensure the first letter is uppercase. |
92 | | -## (usually used in the ``subject_process`` pipeline) |
93 | | -## |
94 | | -## - final_dot: ensure text finishes with a dot |
95 | | -## (usually used in the ``subject_process`` pipeline) |
96 | | -## |
97 | | -## - strip: remove any spaces before or after the content of the string |
98 | | -## |
99 | | -## - SetIfEmpty(msg="No commit message."): will set the text to |
100 | | -## whatever given ``msg`` if the current text is empty. |
101 | | -## |
102 | | -## Additionally, you can `pipe` the provided filters, for instance: |
103 | | -#body_process = Wrap(regexp=r'\n(?=\w+\s*:)') | Indent(chars=" ") |
104 | | -#body_process = Wrap(regexp=r'\n(?=\w+\s*:)') |
105 | | -#body_process = noop |
106 | | -#body_process = ReSub(r'((^|\n)[A-Z]\w+(-\w+)*: .*(\n\s+.*)*)+$', r'') | strip |
107 | | -body_process = ReSub(r'.*', '') | strip |
108 | | - |
109 | | - |
110 | | -## ``subject_process`` is a callable |
111 | | -## |
112 | | -## This callable will be given the original subject and result will |
113 | | -## be used in the changelog. |
114 | | -## |
115 | | -## Available constructs are those listed in ``body_process`` doc. |
116 | | -#subject_process = (strip | |
117 | | -# ReSub(r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n@]*)(@[a-z]+\s+)*$', r'\4') | |
118 | | -# SetIfEmpty("No commit message.") | ucfirst | final_dot) |
119 | 25 | subject_process = ReSub( |
120 | | - r'^(.*)(\ ?\(\#([0-9]+)\))$', |
121 | | - r'\1 (`#\3 <https://github.com/bioio-devs/bioio/pull/\3>`_)' |
| 26 | + r"^(.*)(\ ?\(\#([0-9]+)\))$", |
| 27 | + r"\1 (`#\3 <https://github.com/bioio-devs/bioio/pull/\3>`_)", |
122 | 28 | ) |
123 | | -#subject_process = ReSub(r'.*', '') |
124 | | - |
125 | | - |
126 | | -## ``tag_filter_regexp`` is a regexp |
127 | | -## |
128 | | -## Tags that will be used for the changelog must match this regexp. |
129 | | -## |
130 | | -tag_filter_regexp = r'^v[0-9]+\.[0-9]+(\.[0-9]+)?$' |
131 | 29 |
|
| 30 | +tag_filter_regexp = r"^v[0-9]+\.[0-9]+(\.[0-9]+)?$" |
132 | 31 |
|
133 | | -## ``unreleased_version_label`` is a string or a callable that outputs a string |
134 | | -## |
135 | | -## This label will be used as the changelog Title of the last set of changes |
136 | | -## between last valid tag and HEAD if any. |
| 32 | +# Label for changes since last tag on main |
137 | 33 | unreleased_version_label = "(unreleased)" |
138 | 34 |
|
139 | | - |
140 | | -## ``output_engine`` is a callable |
141 | | -## |
142 | | -## This will change the output format of the generated changelog file |
143 | | -## |
144 | | -## Available choices are: |
145 | | -## |
146 | | -## - rest_py |
147 | | -## |
148 | | -## Legacy pure python engine, outputs ReSTructured text. |
149 | | -## This is the default. |
150 | | -## |
151 | | -## - mustache(<template_name>) |
152 | | -## |
153 | | -## Template name could be any of the available templates in |
154 | | -## ``templates/mustache/*.tpl``. |
155 | | -## Requires python package ``pystache``. |
156 | | -## Examples: |
157 | | -## - mustache("markdown") |
158 | | -## - mustache("restructuredtext") |
159 | | -## |
160 | | -## - makotemplate(<template_name>) |
161 | | -## |
162 | | -## Template name could be any of the available templates in |
163 | | -## ``templates/mako/*.tpl``. |
164 | | -## Requires python package ``mako``. |
165 | | -## Examples: |
166 | | -## - makotemplate("restructuredtext") |
167 | | -## |
168 | 35 | output_engine = rest_py |
169 | | -#output_engine = mustache("restructuredtext") |
170 | | -#output_engine = mustache("markdown") |
171 | | -#output_engine = makotemplate("restructuredtext") |
172 | | - |
173 | 36 |
|
174 | | -## ``include_merge`` is a boolean |
175 | | -## |
176 | | -## This option tells git-log whether to include merge commits in the log. |
177 | | -## The default is to include them. |
| 37 | +# Don’t include merge commits |
178 | 38 | include_merge = False |
179 | 39 |
|
180 | | - |
181 | | -## ``log_encoding`` is a string identifier |
182 | | -## |
183 | | -## This option tells gitchangelog what encoding is outputed by ``git log``. |
184 | | -## The default is to be clever about it: it checks ``git config`` for |
185 | | -## ``i18n.logOutputEncoding``, and if not found will default to git's own |
186 | | -## default: ``utf-8``. |
187 | | -#log_encoding = 'utf-8' |
188 | | - |
189 | | - |
190 | | -## ``publish`` is a callable |
191 | | -## |
192 | | -## Sets what ``gitchangelog`` should do with the output generated by |
193 | | -## the output engine. ``publish`` is a callable taking one argument |
194 | | -## that is an interator on lines from the output engine. |
195 | | -## |
196 | | -## Some helper callable are provided: |
197 | | -## |
198 | | -## Available choices are: |
199 | | -## |
200 | | -## - stdout |
201 | | -## |
202 | | -## Outputs directly to standard output |
203 | | -## (This is the default) |
204 | | -## |
205 | | -## - FileInsertAtFirstRegexMatch(file, pattern, idx=lamda m: m.start()) |
206 | | -## |
207 | | -## Creates a callable that will parse given file for the given |
208 | | -## regex pattern and will insert the output in the file. |
209 | | -## ``idx`` is a callable that receive the matching object and |
210 | | -## must return a integer index point where to insert the |
211 | | -## the output in the file. Default is to return the position of |
212 | | -## the start of the matched string. |
213 | | -## |
214 | | -## - FileRegexSubst(file, pattern, replace, flags) |
215 | | -## |
216 | | -## Apply a replace inplace in the given file. Your regex pattern must |
217 | | -## take care of everything and might be more complex. Check the README |
218 | | -## for a complete copy-pastable example. |
219 | | -## |
220 | | -#publish = stdout |
221 | | -OUTPUT_FILE = "docs/CHANGELOG.rst" |
222 | | -INSERT_POINT_REGEX = r'''(?isxu) |
223 | | -^ |
224 | | -( |
225 | | - \s*Changelog\s*(\n|\r\n|\r) ## ``Changelog`` line |
226 | | - ==+\s*(\n|\r\n|\r){2} ## ``=========`` rest underline |
227 | | -) |
228 | | -
|
229 | | -( ## Match all between changelog and release rev |
230 | | - ( |
231 | | - (?! |
232 | | - (?<=(\n|\r)) ## look back for newline |
233 | | - %(rev)s ## revision |
234 | | - \s+ |
235 | | - \([0-9]+-[0-9]{2}-[0-9]{2}\)(\n|\r\n|\r) ## date |
236 | | - --+(\n|\r\n|\r) ## ``---`` underline |
237 | | - ) |
238 | | - . |
239 | | - )* |
240 | | -) |
241 | | -
|
242 | | -(?P<rev>%(rev)s) |
243 | | -''' % {'rev': r"v[0-9]+\.[0-9]+(\.[0-9]+)?"} |
244 | | - |
245 | | -revs = [ |
246 | | - Caret(FileFirstRegexMatch(OUTPUT_FILE, INSERT_POINT_REGEX)), |
247 | | - "HEAD" |
248 | | -] |
249 | | - |
250 | | -publish = FileRegexSubst(OUTPUT_FILE, INSERT_POINT_REGEX, r"\1\o\g<rev>") |
251 | | - |
252 | | - |
253 | | -## ``revs`` is a list of callable or a list of string |
254 | | -## |
255 | | -## callable will be called to resolve as strings and allow dynamical |
256 | | -## computation of these. The result will be used as revisions for |
257 | | -## gitchangelog (as if directly stated on the command line). This allows |
258 | | -## to filter exaclty which commits will be read by gitchangelog. |
259 | | -## |
260 | | -## To get a full documentation on the format of these strings, please |
261 | | -## refer to the ``git rev-list`` arguments. There are many examples. |
262 | | -## |
263 | | -## Using callables is especially useful, for instance, if you |
264 | | -## are using gitchangelog to generate incrementally your changelog. |
265 | | -## |
266 | | -## Some helpers are provided, you can use them:: |
267 | | -## |
268 | | -## - FileFirstRegexMatch(file, pattern): will return a callable that will |
269 | | -## return the first string match for the given pattern in the given file. |
270 | | -## If you use named sub-patterns in your regex pattern, it'll output only |
271 | | -## the string matching the regex pattern named "rev". |
272 | | -## |
273 | | -## - Caret(rev): will return the rev prefixed by a "^", which is a |
274 | | -## way to remove the given revision and all its ancestor. |
275 | | -## |
276 | | -## Please note that if you provide a rev-list on the command line, it'll |
277 | | -## replace this value (which will then be ignored). |
278 | | -## |
279 | | -## If empty, then ``gitchangelog`` will act as it had to generate a full |
280 | | -## changelog. |
281 | | -## |
282 | | -## The default is to use all commits to make the changelog. |
283 | | -#revs = ["^1.0.3", ] |
284 | | - |
285 | | -# revs = [ |
286 | | -# Caret( |
287 | | -# FileFirstRegexMatch( |
288 | | -# "docs/CHANGELOG.rst", |
289 | | -# r"(?P<rev>v[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n")), |
290 | | -# "HEAD" |
291 | | -# ] |
292 | | - |
| 40 | +publish = stdout |
293 | 41 | revs = [] |
0 commit comments