diff options
author | Martin Liska <mliska@suse.cz> | 2021-03-12 09:08:36 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2021-03-12 09:29:05 +0100 |
commit | a7ac3e92ecf251d5528eea4b46b5f42fd0168e43 (patch) | |
tree | 3264049111e29ecd94f5dc809a1bbc71c96b5c5a /contrib | |
parent | 48ff383f0d9e917bcb7bcc091af413bcae07b440 (diff) | |
download | gcc-a7ac3e92ecf251d5528eea4b46b5f42fd0168e43.zip gcc-a7ac3e92ecf251d5528eea4b46b5f42fd0168e43.tar.gz gcc-a7ac3e92ecf251d5528eea4b46b5f42fd0168e43.tar.bz2 |
gcc-changelog: allow ChangeLog deletion in a commit
contrib/ChangeLog:
* gcc-changelog/git_commit.py: Allow deletion of ChangeLog
files.
* gcc-changelog/setup.cfg: Set line limit to 120 characters.
* gcc-changelog/test_email.py: Add test.
* gcc-changelog/test_patches.txt: Likewise.
* gcc-changelog/git_email.py: Fix parsing of deleted files.
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/gcc-changelog/git_commit.py | 3 | ||||
-rwxr-xr-x | contrib/gcc-changelog/git_email.py | 2 | ||||
-rw-r--r-- | contrib/gcc-changelog/setup.cfg | 3 | ||||
-rwxr-xr-x | contrib/gcc-changelog/test_email.py | 4 | ||||
-rw-r--r-- | contrib/gcc-changelog/test_patches.txt | 30 |
5 files changed, 40 insertions, 2 deletions
diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index e9dae0a..43fa7f4 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -314,8 +314,9 @@ class GitCommit: if self.revert_commit: self.info = self.commit_to_info_hook(self.revert_commit) + # Allow complete deletion of ChangeLog files in a commit project_files = [f for f in self.info.modified_files - if self.is_changelog_filename(f[0], allow_suffix=True) + if (self.is_changelog_filename(f[0], allow_suffix=True) and f[1] != 'D') or f[0] in misc_files] ignored_files = [f for f in self.info.modified_files if self.in_ignored_location(f[0])] diff --git a/contrib/gcc-changelog/git_email.py b/contrib/gcc-changelog/git_email.py index 00ad004..b0547b3 100755 --- a/contrib/gcc-changelog/git_email.py +++ b/contrib/gcc-changelog/git_email.py @@ -66,7 +66,7 @@ class GitEmail(GitCommit): t = 'A' else: t = 'M' - modified_files.append((target, t)) + modified_files.append((target if t != 'D' else source, t)) git_info = GitInfo(None, date, author, body, modified_files) super().__init__(git_info, strict=strict, commit_to_info_hook=lambda x: None) diff --git a/contrib/gcc-changelog/setup.cfg b/contrib/gcc-changelog/setup.cfg index 9e4a0f6..efc313f 100644 --- a/contrib/gcc-changelog/setup.cfg +++ b/contrib/gcc-changelog/setup.cfg @@ -1,2 +1,5 @@ +[flake8] +max-line-length = 120 + [tool:pytest] addopts = -vv --flake8 diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index b81548f..9d052e0 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -416,3 +416,7 @@ class TestGccChangelog(unittest.TestCase): def test_multiline_bad_parentheses(self): email = self.from_patch_glob('0002-Wrong-macro-changelog.patch') assert email.errors[0].message == 'bad parentheses wrapping' + + def test_changelog_removal(self): + email = self.from_patch_glob('0001-ChangeLog-removal.patch', strict=True) + assert not email.errors diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt index 9de2897..012573b 100644 --- a/contrib/gcc-changelog/test_patches.txt +++ b/contrib/gcc-changelog/test_patches.txt @@ -3481,3 +3481,33 @@ index ac63591b33f..ff4d61764e7 100644 + -- 2.29.2 + +=== 0001-ChangeLog-removal.patch === +From b39fadf9df1a9510afcab0a391182da7dc68de24 Mon Sep 17 00:00:00 2001 +From: Martin Liska <mliska@suse.cz> +Date: Fri, 12 Mar 2021 09:10:55 +0100 +Subject: [PATCH] Test ChangeLog removal. + +gcc/ChangeLog: + + * ipa-icf.c (make_pass_ipa_icf): Add line. +--- +diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog +deleted file mode 100644 +index 94e87f6bcde..00000000000 +--- a/gcc/analyzer/ChangeLog ++++ /dev/null +@@ -1,1 +0,0 @@ +- foo +diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c +index 5dd33a75c3a..c4ce432cb98 100644 +--- a/gcc/ipa-icf.c ++++ b/gcc/ipa-icf.c +@@ -3655,3 +3655,4 @@ make_pass_ipa_icf (gcc::context *ctxt) + { + return new ipa_icf::pass_ipa_icf (ctxt); + } ++ +-- +2.30.1 + |