mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-09 22:21:44 +08:00
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.
This commit is contained in:
parent
48ff383f0d
commit
a7ac3e92ec
contrib/gcc-changelog
@ -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])]
|
||||
|
@ -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)
|
||||
|
@ -1,2 +1,5 @@
|
||||
[flake8]
|
||||
max-line-length = 120
|
||||
|
||||
[tool:pytest]
|
||||
addopts = -vv --flake8
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user