-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.gitchangelog.rc
72 lines (55 loc) · 2.26 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
ignore_regexps = [
r'@minor', r'!minor',
r'@cosmetic', r'!cosmetic',
r'@refactor', r'!refactor',
r'@wip', r'!wip',
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[p|P]kg:',
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[d|D]ev:',
r'^(.{3,3}\s*:)?\s*[fF]irst commit.?\s*$',
r'^$', ## ignore commits with empty messages
]
section_regexps = [
('New', [
r'^[nNeEwW]{2,}:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?(.*)([^\n]*)$',
]),
('Changes', [
r'^[cChHgG]{2,}\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?(.*)([^\n]*)$',
]),
('Fix', [
r'^[fFIiXx]{2,}\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?(.*)([^\n]*)$',
]),
('Other', None ## Match all lines
),
]
#body_process = Wrap(regexp=r'\n(?=\w+\s*:)') | Indent(chars=" ")
#body_process = Wrap(regexp=r'\n(?=\w+\s*:)')
#body_process = noop
body_process = ReSub(r'((^|\n)[A-Z]\w+(-\w+)*: .*(\n\s+.*)*)+$', r'') | strip
subject_process = (strip |
ReSub(r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n@]*)(@[a-z]+\s+)*$', r'\4') |
SetIfEmpty("No commit message.") | ucfirst | final_dot)
tag_filter_regexp = r'^v[0-9]+\.[0-9]+(\.[0-9]+)?(\.-[a-zA-Z0-9]+)?$'
unreleased_version_label = "(unreleased)"
#output_engine = rest_py
#output_engine = mustache("restructuredtext")
output_engine = mustache("markdown")
#output_engine = makotemplate("restructuredtext")
## ``include_merge`` is a boolean
##
## This option tells git-log whether to include merge commits in the log.
## The default is to include them.
include_merge = True
## ``log_encoding`` is a string identifier
##
## This option tells gitchangelog what encoding is outputed by ``git log``.
## The default is to be clever about it: it checks ``git config`` for
## ``i18n.logOutputEncoding``, and if not found will default to git's own
## default: ``utf-8``.
#log_encoding = 'utf-8'
OUTPUT_FILE = "CHANGELOG.md"
INSERT_POINT_REGEX = r'''^(\s*\#\s+Changelog\s*(\n\n))(((?!(?<=(\n|\r))\#\#\s+v[0-9]+\.[0-9]+\.[0-9]+\-(alpha|beta|gamma|dev|)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)(\n)).)*)(?P<tail>\#\#\s+(?P<rev>v[0-9]+\.[0-9]+\.[0-9]+\-(alpha|beta|dev|gamma)))'''
revs = [
Caret(FileFirstRegexMatch(OUTPUT_FILE, INSERT_POINT_REGEX)),
"HEAD"
]
publish = FileRegexSubst(OUTPUT_FILE, INSERT_POINT_REGEX, r"\1\o\n\g<tail>")