public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-4741] gcc-changelog/git_email.py: Support older unidiff.PatchSet
@ 2022-12-16 10:02 Tobias Burnus
  0 siblings, 0 replies; only message in thread
From: Tobias Burnus @ 2022-12-16 10:02 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:8f2a8be579fc6acadb9fc356701fcb5e7b0feed5

commit r13-4741-g8f2a8be579fc6acadb9fc356701fcb5e7b0feed5
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Fri Dec 16 11:01:22 2022 +0100

    gcc-changelog/git_email.py: Support older unidiff.PatchSet
    
    Commit "unidiff: use newline='\n' argument",
    r13-4603-gb045179973161115c7ea029b2788f5156fc55cda, added support CR
    on a line, but that broke support for older unidiff.PatchSet.
    
    This patch uses a fallback for git_email.py (drop argument) if not
    available (TypeError exception) but keeps using it in test_email.py
    unconditionally.
    
    contrib/ChangeLog:
    
            * gcc-changelog/git_email.py (GitEmail:__init__): Support older
            unidiff.PatchSet that do not have a newline= argument
            of from_filename.

Diff:
---
 contrib/gcc-changelog/git_email.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/contrib/gcc-changelog/git_email.py b/contrib/gcc-changelog/git_email.py
index ef50ebfb7fd..093c887ba4c 100755
--- a/contrib/gcc-changelog/git_email.py
+++ b/contrib/gcc-changelog/git_email.py
@@ -39,7 +39,11 @@ unidiff_supports_renaming = hasattr(PatchedFile(), 'is_rename')
 class GitEmail(GitCommit):
     def __init__(self, filename):
         self.filename = filename
-        diff = PatchSet.from_filename(filename, newline='\n')
+        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 = ''

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-16 10:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-16 10:02 [gcc r13-4741] gcc-changelog/git_email.py: Support older unidiff.PatchSet Tobias Burnus

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).