forked from kpn/py-pkgsettings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitchangelog.rc
57 lines (46 loc) · 1.19 KB
/
.gitchangelog.rc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
output_engine = mustache("markdown")
section_regexps = [
('New', [
r'^NEW(:*) \s*?([^\n]*)$',
]),
('Changes', [
r'^CHANGE(D*)(:*) \s*?([^\n]*)$',
]),
('Fixes', [
r'^FIX(:*) \s*?([^\n]*)$',
]),
('Optimizations', [
r'^OPT(:*) \s*?([^\n]*)$',
]),
('Other', None ## Match all lines
),
]
ignore_regexps = [
r'^Merge*',
r'^Automatic merge*',
]
tag_filter_regexp = r'^[0-9]+\.[0-9]+\.[0-9]+$'
OUTPUT_FILE = "Changelog.md"
INSERT_POINT_REGEX = r'''((?isxu)
^
(
\s*\#\s+Changelog\s*(\n|\r\n|\r) ## ``Changelog`` line
)
( ## Match all between changelog and release rev
(
(?!
(?<=(\n|\r)) ## look back for newline
\#\#\s+%(rev)s ## revision
\s+
\([0-9]+-[0-9]{2}-[0-9]{2}\)(\n|\r\n|\r) ## date
)
.
)*
)
(?P<tail>\#\#\s+(?P<rev>%(rev)s)))
''' % {'rev': r"[0-9]+\.[0-9]+(\.[0-9]+)?"}
revs = [
Caret(FileFirstRegexMatch(OUTPUT_FILE, INSERT_POINT_REGEX)),
"HEAD"
]
publish = FileRegexSubst(OUTPUT_FILE, INSERT_POINT_REGEX, r"\1\o\n\g<tail>")