Skip to content

Commit 03b9d6d

Browse files
committed
docs(changelog): add generation instructions
1 parent 949b2ec commit 03b9d6d

File tree

3 files changed

+295
-1
lines changed

3 files changed

+295
-1
lines changed

.gitchangelog.rc

Lines changed: 291 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
# -*- coding: utf-8; mode: python -*-
2+
##
3+
## Format
4+
##
5+
## ACTION: [AUDIENCE:] COMMIT_MSG [!TAG ...]
6+
##
7+
## Description
8+
##
9+
## ACTION is one of 'chg', 'fix', 'new'
10+
##
11+
## Is WHAT the change is about.
12+
##
13+
## 'chg' is for refactor, small improvement, cosmetic changes...
14+
## 'fix' is for bug fixes
15+
## 'new' is for new features, big improvement
16+
##
17+
## AUDIENCE is optional and one of 'dev', 'usr', 'pkg', 'test', 'doc'
18+
##
19+
## Is WHO is concerned by the change.
20+
##
21+
## 'dev' is for developpers (API changes, refactors...)
22+
## 'usr' is for final users (UI changes)
23+
## 'pkg' is for packagers (packaging changes)
24+
## 'test' is for testers (test only related changes)
25+
## 'doc' is for doc guys (doc only changes)
26+
##
27+
## COMMIT_MSG is ... well ... the commit message itself.
28+
##
29+
## TAGs are additionnal adjective as 'refactor' 'minor' 'cosmetic'
30+
##
31+
## They are preceded with a '!' or a '@' (prefer the former, as the
32+
## latter is wrongly interpreted in github.) Commonly used tags are:
33+
##
34+
## 'refactor' is obviously for refactoring code only
35+
## 'minor' is for a very meaningless change (a typo, adding a comment)
36+
## 'cosmetic' is for cosmetic driven change (re-indentation, 80-col...)
37+
## 'wip' is for partial functionality but complete subfunctionality.
38+
##
39+
## Example:
40+
##
41+
## new: usr: support of bazaar implemented
42+
## chg: re-indentend some lines !cosmetic
43+
## new: dev: updated code to be compatible with last version of killer lib.
44+
## fix: pkg: updated year of licence coverage.
45+
## new: test: added a bunch of test around user usability of feature X.
46+
## fix: typo in spelling my name in comment. !minor
47+
##
48+
## Please note that multi-line commit message are supported, and only the
49+
## first line will be considered as the "summary" of the commit message. So
50+
## tags, and other rules only applies to the summary. The body of the commit
51+
## message will be displayed in the changelog without reformatting.
52+
53+
54+
##
55+
## ``ignore_regexps`` is a line of regexps
56+
##
57+
## Any commit having its full commit message matching any regexp listed here
58+
## will be ignored and won't be reported in the changelog.
59+
##
60+
ignore_regexps = [
61+
r'@minor', r'!minor',
62+
r'@cosmetic', r'!cosmetic',
63+
r'@refactor', r'!refactor',
64+
r'@wip', r'!wip',
65+
r'([rR]elease v[0-9].[0-9].[0-9]{3})',
66+
r'([cC]hore: bump version)',
67+
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[p|P]kg:',
68+
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[d|D]ev:',
69+
r'^(.{3,3}\s*:)?\s*[fF]irst commit.?\s*$',
70+
r'^$', ## ignore commits with empty messages
71+
]
72+
73+
74+
## ``section_regexps`` is a list of 2-tuples associating a string label and a
75+
## list of regexp
76+
##
77+
## Commit messages will be classified in sections thanks to this. Section
78+
## titles are the label, and a commit is classified under this section if any
79+
## of the regexps associated is matching.
80+
##
81+
## Please note that ``section_regexps`` will only classify commits and won't
82+
## make any changes to the contents. So you'll probably want to go check
83+
## ``subject_process`` (or ``body_process``) to do some changes to the subject,
84+
## whenever you are tweaking this variable.
85+
##
86+
section_regexps = [
87+
('New', [
88+
r'^[nN]ew\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
89+
]),
90+
('Changes', [
91+
r'^[cC]hg\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
92+
]),
93+
('Fix', [
94+
r'^[fF]ix\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
95+
]),
96+
97+
('Other', None ## Match all lines
98+
),
99+
100+
]
101+
102+
103+
## ``body_process`` is a callable
104+
##
105+
## This callable will be given the original body and result will
106+
## be used in the changelog.
107+
##
108+
## Available constructs are:
109+
##
110+
## - any python callable that take one txt argument and return txt argument.
111+
##
112+
## - ReSub(pattern, replacement): will apply regexp substitution.
113+
##
114+
## - Indent(chars=" "): will indent the text with the prefix
115+
## Please remember that template engines gets also to modify the text and
116+
## will usually indent themselves the text if needed.
117+
##
118+
## - Wrap(regexp=r"\n\n"): re-wrap text in separate paragraph to fill 80-Columns
119+
##
120+
## - noop: do nothing
121+
##
122+
## - ucfirst: ensure the first letter is uppercase.
123+
## (usually used in the ``subject_process`` pipeline)
124+
##
125+
## - final_dot: ensure text finishes with a dot
126+
## (usually used in the ``subject_process`` pipeline)
127+
##
128+
## - strip: remove any spaces before or after the content of the string
129+
##
130+
## - SetIfEmpty(msg="No commit message."): will set the text to
131+
## whatever given ``msg`` if the current text is empty.
132+
##
133+
## Additionally, you can `pipe` the provided filters, for instance:
134+
#body_process = Wrap(regexp=r'\n(?=\w+\s*:)') | Indent(chars=" ")
135+
#body_process = Wrap(regexp=r'\n(?=\w+\s*:)')
136+
#body_process = noop
137+
body_process = ReSub(r'((^|\n)[A-Z]\w+(-\w+)*: .*(\n\s+.*)*)+$', r'') | strip
138+
139+
140+
## ``subject_process`` is a callable
141+
##
142+
## This callable will be given the original subject and result will
143+
## be used in the changelog.
144+
##
145+
## Available constructs are those listed in ``body_process`` doc.
146+
subject_process = (strip |
147+
ReSub(r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n@]*)(@[a-z]+\s+)*$', r'\4') |
148+
SetIfEmpty("No commit message.") | ucfirst | final_dot)
149+
150+
151+
## ``tag_filter_regexp`` is a regexp
152+
##
153+
## Tags that will be used for the changelog must match this regexp.
154+
##
155+
tag_filter_regexp = r'^v[0-9]+\.[0-9]+(\.[0-9]+)?$'
156+
157+
158+
## ``unreleased_version_label`` is a string or a callable that outputs a string
159+
##
160+
## This label will be used as the changelog Title of the last set of changes
161+
## between last valid tag and HEAD if any.
162+
unreleased_version_label = "(unreleased)"
163+
164+
165+
## ``output_engine`` is a callable
166+
##
167+
## This will change the output format of the generated changelog file
168+
##
169+
## Available choices are:
170+
##
171+
## - rest_py
172+
##
173+
## Legacy pure python engine, outputs ReSTructured text.
174+
## This is the default.
175+
##
176+
## - mustache(<template_name>)
177+
##
178+
## Template name could be any of the available templates in
179+
## ``templates/mustache/*.tpl``.
180+
## Requires python package ``pystache``.
181+
## Examples:
182+
## - mustache("markdown")
183+
## - mustache("restructuredtext")
184+
##
185+
## - makotemplate(<template_name>)
186+
##
187+
## Template name could be any of the available templates in
188+
## ``templates/mako/*.tpl``.
189+
## Requires python package ``mako``.
190+
## Examples:
191+
## - makotemplate("restructuredtext")
192+
##
193+
output_engine = rest_py
194+
#output_engine = mustache("restructuredtext")
195+
#output_engine = mustache("markdown")
196+
#output_engine = makotemplate("restructuredtext")
197+
198+
199+
## ``include_merge`` is a boolean
200+
##
201+
## This option tells git-log whether to include merge commits in the log.
202+
## The default is to include them.
203+
include_merge = True
204+
205+
206+
## ``log_encoding`` is a string identifier
207+
##
208+
## This option tells gitchangelog what encoding is outputed by ``git log``.
209+
## The default is to be clever about it: it checks ``git config`` for
210+
## ``i18n.logOutputEncoding``, and if not found will default to git's own
211+
## default: ``utf-8``.
212+
#log_encoding = 'utf-8'
213+
214+
215+
## ``publish`` is a callable
216+
##
217+
## Sets what ``gitchangelog`` should do with the output generated by
218+
## the output engine. ``publish`` is a callable taking one argument
219+
## that is an interator on lines from the output engine.
220+
##
221+
## Some helper callable are provided:
222+
##
223+
## Available choices are:
224+
##
225+
## - stdout
226+
##
227+
## Outputs directly to standard output
228+
## (This is the default)
229+
##
230+
## - FileInsertAtFirstRegexMatch(file, pattern, idx=lamda m: m.start())
231+
##
232+
## Creates a callable that will parse given file for the given
233+
## regex pattern and will insert the output in the file.
234+
## ``idx`` is a callable that receive the matching object and
235+
## must return a integer index point where to insert the
236+
## the output in the file. Default is to return the position of
237+
## the start of the matched string.
238+
##
239+
## - FileRegexSubst(file, pattern, replace, flags)
240+
##
241+
## Apply a replace inplace in the given file. Your regex pattern must
242+
## take care of everything and might be more complex. Check the README
243+
## for a complete copy-pastable example.
244+
##
245+
# publish = FileInsertIntoFirstRegexMatch(
246+
# "CHANGELOG.rst",
247+
# r'/(?P<rev>[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n/',
248+
# idx=lambda m: m.start(1)
249+
# )
250+
#publish = stdout
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+
#revs = [
285+
# Caret(
286+
# FileFirstRegexMatch(
287+
# "CHANGELOG.rst",
288+
# r"(?P<rev>[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n")),
289+
# "HEAD"
290+
#]
291+
revs = []

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11

2-
.gitchangelog.rc

README.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,10 @@ Contributing
424424
~~~~~~~~~~~~
425425
We look forward to collaborating with you! Please read through `CONTRIBUTING <https://github.com/aws/amazon-redshift-python-driver/blob/master/CONTRIBUTING.md#Reporting-Bugs/Feature-Requests>`_ before submitting any issues or pull requests.
426426

427+
Changelog Generation
428+
~~~~~~~~~~~~~~~~~~~~
429+
An entry in the changelog is generated upon release using `gitchangelog <https://github.com/vaab/gitchangelog>`_. Please use the configuration file, ``.gitchangelog.rc`` when generating the changelog.
430+
427431
Running Tests
428432
-------------
429433
You can run tests by using ``pytest test/unit``. This will run all unit tests. Integration tests require providing credentials for an Amazon Redshift cluster as well as IdP attributes in ``test/config.ini``.

0 commit comments

Comments
 (0)