diff options
author | Martin Liska <mliska@suse.cz> | 2022-12-16 12:21:59 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-12-16 12:21:59 +0100 |
commit | 66c2f03d4cbfdefa489ba6280d2cbb13efec1ad1 (patch) | |
tree | dcf23f77d6a9d120996bc5d50b2b2bd4a9c82d99 /contrib/gcc-changelog | |
parent | 8f2a8be579fc6acadb9fc356701fcb5e7b0feed5 (diff) | |
download | gcc-66c2f03d4cbfdefa489ba6280d2cbb13efec1ad1.zip gcc-66c2f03d4cbfdefa489ba6280d2cbb13efec1ad1.tar.gz gcc-66c2f03d4cbfdefa489ba6280d2cbb13efec1ad1.tar.bz2 |
gcc-changelog: do not use PatchSet.from_filename
Use rather PatchSet constructor where we can pass
properly opened file with newline='\n'.
contrib/ChangeLog:
* gcc-changelog/git_email.py: Use PatchSet constructor
as newline argument is not supported with older unidiff
library.
Diffstat (limited to 'contrib/gcc-changelog')
-rwxr-xr-x | contrib/gcc-changelog/git_email.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/contrib/gcc-changelog/git_email.py b/contrib/gcc-changelog/git_email.py index 093c887..f3773f1 100755 --- a/contrib/gcc-changelog/git_email.py +++ b/contrib/gcc-changelog/git_email.py @@ -39,18 +39,15 @@ unidiff_supports_renaming = hasattr(PatchedFile(), 'is_rename') class GitEmail(GitCommit): def __init__(self, filename): self.filename = filename - try: - diff = PatchSet.from_filename(filename, newline='\n') - except TypeError: - # Older versions don't have the newline argument - diff = PatchSet.from_filename(filename) date = None author = None subject = '' subject_last = False - with open(self.filename, 'r') as f: - lines = f.read().splitlines() + with open(self.filename, newline='\n') as f: + data = f.read() + diff = PatchSet(data) + lines = data.splitlines() lines = list(takewhile(lambda line: line != '---', lines)) for line in lines: if line.startswith(DATE_PREFIX): |