From 84ed8d2c88966fe30c54802a2088f68495fd833a Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 3 Nov 2020 17:46:36 +0100 Subject: [PATCH] gcc-changelog/git_email.py: Support older unidiff modules contrib/ChangeLog: * gcc-changelog/git_email.py: Add unidiff_supports_renaming check. --- contrib/gcc-changelog/git_email.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/gcc-changelog/git_email.py b/contrib/gcc-changelog/git_email.py index 014fdd1004b..5b53ca4a6a9 100755 --- a/contrib/gcc-changelog/git_email.py +++ b/contrib/gcc-changelog/git_email.py @@ -24,10 +24,11 @@ from dateutil.parser import parse from git_commit import GitCommit, GitInfo -from unidiff import PatchSet +from unidiff import PatchSet, PatchedFile DATE_PREFIX = 'Date: ' FROM_PREFIX = 'From: ' +unidiff_supports_renaming = hasattr(PatchedFile(), 'is_rename') class GitEmail(GitCommit): @@ -58,7 +59,7 @@ class GitEmail(GitCommit): t = 'A' elif f.is_removed_file: t = 'D' - elif f.is_rename: + elif unidiff_supports_renaming and f.is_rename: # Consider that renamed files are two operations: the deletion # of the original name and the addition of the new one. modified_files.append((source, 'D')) -- 2.30.2