aboutsummaryrefslogtreecommitdiff
path: root/contrib/gcc-changelog/git_email.py
AgeCommit message (Collapse)AuthorFilesLines
2023-01-16Update copyright years.Jakub Jelinek1-1/+1
2022-12-19gcc-changelog: Add warning for auto-added filesTobias Burnus1-1/+4
git_email.py prints now a warning for files added automatically. git_check_commit.py does likewise but only with --verbose. It prints one line per ChangeLog file, either stating the file or if more than one the number of files. contrib/ChangeLog: * gcc-changelog/git_check_commit.py (__main__): With -v print a warning for the auto-added files. * gcc-changelog/git_commit.py (GitCommit.__init__): Add self.warnings. (GitCommit.check_mentioned_files): Add warning for auto-added files. (GitCommit.print_warnings): New function. * gcc-changelog/git_email.py (__main__): Remove bogus argument to GitEmail constructor; print auto-added-files warning. * gcc-changelog/test_email.py (test_auto_add_file_1, test_auto_add_file_2): New tests. * gcc-changelog/test_patches.txt: Add two test cases.
2022-12-16gcc-changelog: do not use PatchSet.from_filenameMartin Liska1-7/+4
Use rather PatchSet constructor where we can pass properly opened file with newline='\n'. contrib/ChangeLog: * gcc-changelog/git_email.py: Use PatchSet constructor as newline argument is not supported with older unidiff library.
2022-12-16gcc-changelog/git_email.py: Support older unidiff.PatchSetTobias Burnus1-1/+5
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.
2022-12-14contrib: add copyright for my scriptsMartin Liska1-0/+2
contrib/ChangeLog: * analyze_brprob.py: Add copyright header. * analyze_brprob_spec.py: Likewise. * check-params-in-docs.py: Likewise. * check_GNU_style.py: Likewise. * check_GNU_style_lib.py: Likewise. * filter-clang-warnings.py: Likewise. * gcc-changelog/git_check_commit.py: Likewise. * gcc-changelog/git_commit.py: Likewise. * gcc-changelog/git_email.py: Likewise. * gcc-changelog/git_repository.py: Likewise. * gcc-changelog/git_update_version.py: Likewise. * gcc-changelog/test_email.py: Likewise. * mark_spam.py: Likewise.
2022-12-11unidiff: use newline='\n' argumentMartin Liska1-1/+1
In order to support CR on a line, we need to open files with newline='\n' as our line endings supposed to be of UNIX style. contrib/ChangeLog: * check_GNU_style.py: Use newline=\n. * check_GNU_style_lib.py: Simplify. * gcc-changelog/git_commit.py: Fix issues seen Rust patchset. * gcc-changelog/git_email.py: Use newline argument. * gcc-changelog/test_email.py: New test. * gcc-changelog/test_patches.txt: New test. * mklog.py: Use newline argument.
2021-06-13contrib/gcc-changelog: Check that PR in subject is in changelogTobias Burnus1-2/+20
This patch checks that a '[PRnnnn]' and '(PRnnnn)' also appears as PR in the changelog part of the commit message. And it does likewise for 'PR comp/nnnn' except that then also the component name is checked. (Note that the reverse is permitted, i.e. PR(s) only appearing in the changelog.) To avoid false positives, PR numbers in the subject line are ignored, if 'revert' appears. Additionally, reject commits with a nonempty second line. contrib/ChangeLog: * gcc-changelog/git_commit.py (pr_regex): Add ?P<pr> for group('pr'). (subject_pr_regex, subject_pr2_regex): New. (GitInfo.__init__, GitCommit.parse_changelog): Check subject PRs. * gcc-changelog/git_email.py (SUBJECT_PREFIX, subject_patch_regex): New. (GitEmail.__init__): Parse 'Subject:' and pass it to GitInfo. * gcc-changelog/test_email.py (test_pr_only_in_subject, test_wrong_pr_comp_in_subject, test_copyright_years): New. * gcc-changelog/test_patches.txt (0030-PR-c-92746, pr-check1.patch): Update to avoid triggering the new check. (0001-rs6000-Support-doubleword, pr-wrong-comp.patch, copyright-years.patch): New.
2021-05-18gcc-changelog: Remove use of non-strict modeJonathan Wakely1-1/+1
contrib/ChangeLog: * gcc-changelog/git_email.py: Remove use of non-strict mode.
2021-05-11gcc-changelog: Remove non-strict mode.Martin Liska1-2/+2
contrib/ChangeLog: * gcc-changelog/git_check_commit.py: Remove --non-strict-mode. * gcc-changelog/git_commit.py: Remove strict mode. * gcc-changelog/git_email.py: Likewise. * gcc-changelog/git_repository.py: Likewise. * gcc-changelog/test_email.py: Likewise. * gcc-changelog/test_patches.txt: Update patches so that they don't contain a ChangeLog file changes.
2021-05-10gcc-changelog: remove newlines in git_email.py --helpMartin Liska1-4/+2
contrib/ChangeLog: * gcc-changelog/git_email.py: Remove newlines when --help is used.
2021-05-10contrib/gcc-changelog: Add/improve --helpTobias Burnus1-3/+18
contrib/ChangeLog: * gcc-changelog/git_check_commit.py (__Main__): State in --help the default value for 'revisions'. * gcc-changelog/git_email.py (show_help): Add. (__main__): Handle -h and --help.
2021-03-12gcc-changelog: allow ChangeLog deletion in a commitMartin Liska1-1/+1
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.
2021-01-06gcc-changelog: workaround for utf8 filenamesMartin Liska1-3/+3
contrib/ChangeLog: * gcc-changelog/git_commit.py: Add decode_path function. * gcc-changelog/git_email.py: Use it in order to solve utf8 encoding filename issues. * gcc-changelog/git_repository.py: Likewise. * gcc-changelog/test_email.py: Test it.
2020-11-03gcc-changelog/git_email.py: Support older unidiff modulesTobias Burnus1-2/+3
contrib/ChangeLog: * gcc-changelog/git_email.py: Add unidiff_supports_renaming check.
2020-06-30gcc-changelog: come up with GitInfo wrapper.Martin Liska1-4/+5
contrib/ChangeLog: * gcc-changelog/git_check_commit.py: Use GitInfo * gcc-changelog/git_commit.py: Add GitInfo class. * gcc-changelog/git_email.py: Use GitInfo class. * gcc-changelog/git_repository.py: Likewise.
2020-06-17gcc-changelog: Support 'Backported from master'.Martin Liska1-1/+1
contrib/ChangeLog: * gcc-changelog/git_commit.py: Print 'Backported from master' heading to backported commits. * gcc-changelog/test_email.py: Test it. * gcc-changelog/test_patches.txt: Add new patch. * gcc-changelog/git_repository.py: Add commit_to_date hook. * gcc-changelog/git_email.py: Add fuzzy implementation of commit_to_date_hook.
2020-06-09gcc-changelog: Use non-zero exit status on errorJonathan Wakely1-0/+4
Also add comment explaining what the script does. contrib/ChangeLog: * gcc-changelog/git_email.py: Set exit status on error.
2020-05-28gcc-changelog: enhance handling of renamingsPierre-Marie de Rodat1-1/+10
So far, we expect from a commit that renames a file to contain a changelog entry only for the new name. For example, after the following commit: $ git move foo bar $ git commit We expect the following changelog: * bar: Renamed from foo. Git does not keep track of renamings, only file deletions and additions. The display of patches then uses heuristics (with config-dependent parameters) to try to match deleted and added files in the same commit. It is thus brittle to rely on this information. This commit modifies changelog processing so that renames are considered as a deletion of a file plus an addition of another file. The following changelog is now expected for the above example: * foo: Move... * bar: Here. contrib/ * gcc-changelog/git_email.py (GitEmail.__init__): Interpret file renamings as a file deletion plus a file addition. * gcc-changelog/git_repository.py (parse_git_revisions): Likewise. * gcc-changelog/test_email.py: New testcase. * gcc-changelog/test_patches.txt: New testcase.
2020-05-26gcc-changelog: remove file descriptor leaksPierre-Marie de Rodat1-1/+2
Currently, running gcc-changelog's unit tests may clutter the output with tons of warnings such as: .../contrib/gcc-changelog/git_email.py:40: ResourceWarning: unclosed file <_io.TextIOWrapper name='/tmp/tmpt5okd4qp.patch' mode='r' encoding='UTF-8'> lines = open(self.filename).read().splitlines() ResourceWarning: Enable tracemalloc to get the object allocation traceback This commit fixes these leaks, which restores a clean testsuite output. contrib/ * gcc-changelog/git_update_version.py: Close file objects after use. * gcc-changelog/git_email.py: Likewise. * gcc-changelog/test_email.py: Likewise.
2020-05-13Add gcc-changelog related scripts.Martin Liska1-0/+92
* gcc-changelog/git_check_commit.py: New file. * gcc-changelog/git_commit.py: New file. * gcc-changelog/git_email.py: New file. * gcc-changelog/git_repository.py: New file. * gcc-changelog/git_update_version.py: New file.