From d7b09d8d0cddfe9779ec2b74fe24ef64b0a65a05 Mon Sep 17 00:00:00 2001 From: Yunus Emre <49655146+yedhrab@users.noreply.github.com> Date: Tue, 10 Sep 2019 20:53:05 +0300 Subject: [PATCH 1/3] fix: dev: added'utf-8' support. !minor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ Emojies and non-english (iğüş€) character support is added. --- src/gitchangelog/gitchangelog.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gitchangelog/gitchangelog.py b/src/gitchangelog/gitchangelog.py index ba3e855..db48f38 100755 --- a/src/gitchangelog/gitchangelog.py +++ b/src/gitchangelog/gitchangelog.py @@ -476,7 +476,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): @@ -1820,6 +1820,8 @@ def safe_print(content): content = content.encode(_preferred_encoding) try: + sys.stdout.reconfigure(encoding='utf-8') + print(content, end='') sys.stdout.flush() except UnicodeEncodeError: From 95c27c0e97066edef95ea48ddf02768f443ad117 Mon Sep 17 00:00:00 2001 From: Yunus Emre <49655146+yedhrab@users.noreply.github.com> Date: Tue, 10 Sep 2019 20:56:22 +0300 Subject: [PATCH 2/3] fix: dev: wholo commit effect ignore_regexps and matced sections. !minor Details: https://github.com/vaab/gitchangelog/pull/116/commits/8c0de42dfa30725465d78a2294b9f0c76784952e --- src/gitchangelog/gitchangelog.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gitchangelog/gitchangelog.py b/src/gitchangelog/gitchangelog.py index db48f38..91a2a9e 100755 --- a/src/gitchangelog/gitchangelog.py +++ b/src/gitchangelog/gitchangelog.py @@ -1589,11 +1589,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 From 42889807eab7fda4afb3a6eaa59b0cea15dbbff9 Mon Sep 17 00:00:00 2001 From: Yunus Emre <49655146+yedhrab@users.noreply.github.com> Date: Tue, 10 Sep 2019 23:30:53 +0300 Subject: [PATCH 3/3] fix: dev: added'utf-8' support. !minor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✨ Emojies and non-english (iğüş€) character support is added --- src/gitchangelog/gitchangelog.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gitchangelog/gitchangelog.py b/src/gitchangelog/gitchangelog.py index 91a2a9e..e5f2b75 100755 --- a/src/gitchangelog/gitchangelog.py +++ b/src/gitchangelog/gitchangelog.py @@ -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 ## @@ -1821,8 +1828,6 @@ def safe_print(content): content = content.encode(_preferred_encoding) try: - sys.stdout.reconfigure(encoding='utf-8') - print(content, end='') sys.stdout.flush() except UnicodeEncodeError: