public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4742] gcc-changelog: do not use PatchSet.from_filename
@ 2022-12-16 11:24 Martin Liska
0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2022-12-16 11:24 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:66c2f03d4cbfdefa489ba6280d2cbb13efec1ad1
commit r13-4742-g66c2f03d4cbfdefa489ba6280d2cbb13efec1ad1
Author: Martin Liska <mliska@suse.cz>
Date: Fri Dec 16 12:21:59 2022 +0100
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.
Diff:
---
contrib/gcc-changelog/git_email.py | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/contrib/gcc-changelog/git_email.py b/contrib/gcc-changelog/git_email.py
index 093c887ba4c..f3773f178ea 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):
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-12-16 11:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-16 11:24 [gcc r13-4742] gcc-changelog: do not use PatchSet.from_filename Martin Liska
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).