Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utf-8 support and check whole commit instead just commit subject #124

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/gitchangelog/gitchangelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ def _execute_child(self, args, executable, preexec_fn, close_fds,
"""


##
## ENCODING
##

sys.stdout.reconfigure(encoding='utf-8')


##
## Shell command helper functions
##
Expand Down Expand Up @@ -476,7 +483,7 @@ def curryfy(f):
##

def file_get_contents(filename):
with open(filename) as f:
with open(filename, encoding="utf-8") as f:
out = f.read()
if not PY3:
if not isinstance(out, unicode):
Expand Down Expand Up @@ -1589,11 +1596,12 @@ def versions_data_iter(repository, revlist=None,
encoding=log_encoding)

for commit in commits:
if any(re.search(pattern, commit.subject) is not None
commit_message = "%s\n%s" % (commit.subject, commit.body)
if any(re.search(pattern, commit_message) is not None
for pattern in ignore_regexps):
continue

matched_section = first_matching(section_regexps, commit.subject)
matched_section = first_matching(section_regexps, commit_message)

## Finally storing the commit in the matching section

Expand Down