From: Tobias Burnus <tobias@codesourcery.com>
To: gcc-patches <gcc-patches@gcc.gnu.org>, "Martin Liška" <mliska@suse.cz>
Subject: [Patch] gcc-changelog/git_email.py: Support older unidiff.PatchSet
Date: Fri, 16 Dec 2022 10:18:11 +0100 [thread overview]
Message-ID: <780f0808-44d4-9d95-c1a9-d408f1475741@codesourcery.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 399 bytes --]
Another backward compatibility issue - failed here on Ubuntu 20.04 which
is old but not ancient.
OK for mainline?
Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
[-- Attachment #2: git-email.diff --]
[-- Type: text/x-patch, Size: 1281 bytes --]
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 --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 = ''
next reply other threads:[~2022-12-16 9:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 9:18 Tobias Burnus [this message]
2022-12-16 9:27 ` Martin Liška
2022-12-16 11:23 ` [PATCH (pushed)] gcc-changelog: do not use PatchSet.from_filename Martin Liška
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=780f0808-44d4-9d95-c1a9-d408f1475741@codesourcery.com \
--to=tobias@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mliska@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).