Commit Graph

64 Commits

Author SHA1 Message Date
Martin Liska
7d7ef413ef gcc-changelog: Support multiline parentheses wrapping
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Support wrapping of functions
	in parentheses that can take multiple lines.
	* gcc-changelog/test_email.py: Add tests for it.
	* gcc-changelog/test_patches.txt: Add 2 patches.
2021-01-13 17:22:34 +01:00
Martin Liska
c23aea6edc gcc-changelog: Allow modifications to old ChangeLogs without entry
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Allow modifications of older
	ChangeLog (or specific) files without need to make a ChangeLog
	entry.
	* gcc-changelog/test_email.py: Test it.
	* gcc-changelog/test_patches.txt: Add new patch.
2021-01-13 11:57:14 +01:00
Martin Liska
57706dd7e0 gcc-changelog: workaround for utf8 filenames
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.
2021-01-06 08:26:10 +01:00
Martin Liska
8869bd0efc gcc-changelog: Ignore copyright years commits.
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Skip Update copyright
	years commits.
2021-01-04 10:09:07 +01:00
Martin Liska
1b021bbd85 gcc-changelog: new error for quoted utf8 filenames
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Add new error for quoted
	filenames.
	* gcc-changelog/test_email.py: Test it.
	* gcc-changelog/test_patches.txt: Test it.
2020-12-21 10:35:11 +01:00
Martin Liska
2ebe752658 gcc-changelog: add Unicode test-case
contrib/ChangeLog:

	* gcc-changelog/test_email.py: New test.
	* gcc-changelog/test_patches.txt: Likewise.
2020-12-21 10:21:25 +01:00
Nathan Sidwell
c5271279d6 Add toplevel dirs
contrib/
	* gcc-changelog/git_commit.py (changelog_locations): Add
	libcody, c++tools.
2020-12-15 09:51:50 -05:00
Martin Liska
57cbb7acdb changelog: add hint for a file mismatch
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Suggest close file for
	'unchanged file mentioned in a ChangeLog' error.
	* gcc-changelog/test_email.py: Test it.
2020-11-30 17:19:41 +01:00
Martin Liska
1e5c644fb6 changelog: allow subdir wildcard entry
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Allow sub-directory wildcard
	changelog entry. Fix a typo caused by apostrophe escaping.
	* gcc-changelog/test_email.py: Test it.
	* gcc-changelog/test_patches.txt: Likewise.
2020-11-30 13:42:25 +01:00
Jonathan Wakely
08cd56a6b3 gcc-changelog: Add libstdc++-v3/testsuite to wildcard prefixes
This allows using "testsuite/*" in libstdc++-v3/ChangeLog entries, which
was one of the original motivations for adding wildcard support in the
first place:
https://gcc.gnu.org/pipermail/gcc/2020-June/232719.html

contrib/ChangeLog:

	* gcc-changelog/git_commit.py (wildcard_prefixes): Add libstdc++
	testsuite directory.
2020-11-30 11:41:03 +00:00
Martin Liska
fbbce1c6e9 changelog: Allow wildcard pattern only.
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Allow wildcard pattern only.
2020-11-30 10:40:36 +01:00
Martin Liska
b8ae0812ee changelog: allow flexible "cherry picked" format.
It handles the following:
(cherry picked from commit c0c7270cc4 (testsuite changes only))

contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Use regex for cherry pick prefix.
	* gcc-changelog/test_email.py: Test it.
	* gcc-changelog/test_patches.txt: Likewise.
2020-11-27 13:43:25 +01:00
Martin Liska
d3e763efcb changelog: fix parsing of a revert commit
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Use revert_regex instead
	of string prefix.  Convert sets to literals.
2020-11-25 07:56:57 +01:00
Martin Liska
f176773bc2 gcc-changelog: prevent double cherry-pick line
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Add new check.
	* gcc-changelog/test_email.py: Test it.
	* gcc-changelog/test_patches.txt: Add new patch.
2020-11-06 13:33:41 +01:00
Martin Liska
10a50d261e gcc-changelog: Change parse_git_revisions strict argument to True.
Change the default that is used by GIT server hook and also
by git_update_version.py. Both should use True now.

contrib/ChangeLog:

	* gcc-changelog/git_repository.py: Set strict=True
	for parse_git_revisions as a default.
2020-11-04 11:01:58 +01:00
Tobias Burnus
619039de36 gcc-changelog/git_commit.py: Check for missing description
Especially when using mklog.py, it is simply to forget to fill in
the entries after the '\t* file.c (section):' or '\t(section):'.

contrib/ChangeLog:

	* gcc-changelog/git_commit.py (item_parenthesis_empty_regex,
	item_parenthesis_regex): Add.
	(check_for_empty_description): Use them.
	* gcc-changelog/test_email.py (test_emptry_entry_desc,
	test_emptry_entry_desc_2): Add.
	* gcc-changelog/test_patches.txt: Add two testcases for it.
2020-11-04 10:35:54 +01:00
Tobias Burnus
84ed8d2c88 gcc-changelog/git_email.py: Support older unidiff modules
contrib/ChangeLog:

	* gcc-changelog/git_email.py: Add unidiff_supports_renaming check.
2020-11-03 17:46:36 +01:00
Martin Liska
19859d6ba6 Add setup.cfg for pytest.
contrib/ChangeLog:

	* gcc-changelog/setup.cfg: New file.
2020-11-03 17:32:10 +01:00
Martin Liska
63d0da8852 gcc-changelog: Handle situations like '* tree-vect-slp.c (): '
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Handle empty groups in
	file description.
	* gcc-changelog/test_email.py: New test.
	* gcc-changelog/test_patches.txt: Likewise.
2020-10-30 11:24:49 +01:00
Martin Liska
02cada26e4
gcc-changelog: fix when somebody reverts a backport
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: When reverting a backport,
	we should print only Revert header.
2020-07-23 10:43:25 +02:00
Jonathan Wakely
0c1d1c0103 gcc-changelog: Fix typo in output
contrib/ChangeLog:

	* gcc-changelog/git_update_version.py: Fix typo.
2020-07-17 09:53:19 +01:00
Alexandre Oliva
a759bfc7cf
accept <case> and [cond] in ChangeLog
Only '(' and ':' currently terminate file lists in ChangeLog entries
in the ChangeLog parser.  This rules out such legitimate entries as:

* filename <CASE>:
* filename [COND]:

This patch extends the ChangeLog parser to recognize these forms.

for  contrib/ChangeLog

	* gcc-changelog/git_commit.py: Support CASE and COND.
	* gcc-changelog/test_patches.txt: Add test.
	* gcc-changelog/test_email.py: Add test.

Co-Authored-By: Martin Liska <mliska@suse.cz>
2020-07-07 09:05:10 +02:00
Martin Liska
e2c17dcb12
gcc-changelog: support older GitPython releases.
contrib/ChangeLog:

	* gcc-changelog/git_repository.py: Support older releases of
	GitPython when renamed_file was named renamed.
2020-06-30 17:45:36 +02:00
Martin Liska
b05c4c2c5d
gcc-changelog: support 'This revert commit' prefix.
contrib/ChangeLog:

	* gcc-changelog/git_check_commit.py: Print revision
	of original_info.
	* gcc-changelog/git_commit.py: Support Revert commits.
2020-06-30 10:56:06 +02:00
Martin Liska
de4676c923
gcc-changelog: come up with GitInfo wrapper.
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-30 10:56:05 +02:00
Martin Liska
9b4bdaf794
gcc-changelog: checkout & pull order
contrib/ChangeLog:

	* gcc-changelog/git_update_version.py: First checkout and then
	run git pull ---rebase.
2020-06-18 14:45:39 +02:00
Martin Liska
2c53566539
gcc-changelog: support merge commits in git_update_version
contrib/ChangeLog:

	* gcc-changelog/git_update_version.py: Support merge commits
	and walk only on the branch that is being merged and generate
	missing ChangeLog entries.
2020-06-18 14:30:47 +02:00
Martin Liska
09f9c1eefb
gcc-changelog: fix Backported from timestamp.
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Fix Backported from timestamp when
	use_commit_ts=True is used.
2020-06-18 10:07:59 +02:00
Martin Liska
2021af0c23
gcc-changelog: Support 'Backported from master'.
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-17 11:37:34 +02:00
Martin Liska
be11812eef
git_update_version: add --current argument.
The argument can be useful to update arbitrary branch, the changes
are added to git index and user is supposed to make a commit.

contrib/ChangeLog:

	* gcc-changelog/git_update_version.py: Add --curent argument.
2020-06-11 13:57:10 +02:00
Martin Liska
50ff02b534
gcc-changelog: fix parse_git_name_status for renames.
Renamed files are listed in the following format:

M	gcc/ada/Makefile.rtl
M	gcc/ada/impunit.adb
R097	gcc/ada/libgnat/s-atopar.adb	gcc/ada/libgnat/s-aoinar.adb
R095	gcc/ada/libgnat/s-atopar.ads	gcc/ada/libgnat/s-aoinar.ads
A	gcc/ada/libgnat/s-aomoar.adb
A	gcc/ada/libgnat/s-aomoar.ads

So 'R' is followed by a percentage number.

contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Fix renamed files in
	parse_git_name_status.
	* gcc-changelog/test_email.py: Add test for it.
2020-06-10 16:07:10 +02:00
Martin Liska
771e60dd07
gcc-changelog: add more Review by prefixes.
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Add more supported prefixes.
	* gcc-changelog/test_email.py: Fix one flake8 error.
	* gcc-changelog/test_patches.txt: Add tested for newly
	supported prefixes.
2020-06-10 09:58:07 +02:00
Jonathan Wakely
1ea9a0b74e
gcc-changelog: Improve git_commit.py diagnostics
This changes some error messages to be more self-consistent and to fix
some grammar.

contrib/ChangeLog:

	* gcc-changelog/git_commit.py (GitCommit.parse_changelog):
	Improve error strings.
	* gcc-changelog/test_email.py: Update expected errors.
2020-06-10 09:36:34 +02:00
Jonathan Wakely
62963c60fc gcc-changelog: Use non-zero exit status on error
Also add comment explaining what the script does.

contrib/ChangeLog:

	* gcc-changelog/git_email.py: Set exit status on error.
2020-06-09 20:40:44 +01:00
Martin Liska
4373fd2c7f
gcc-changelog: fix deduction for root ChangeLog
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Fix ChangeLog regex in order to
	match the top-level ChangeLog.
	* gcc-changelog/test_email.py: Add test.
	* gcc-changelog/test_patches.txt: Likewise.
2020-06-09 10:01:52 +02:00
Martin Liska
4b6dcfd542
gcc-changelog: support patterns
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Support foo/bar/*: patterns in
	wildcard_prefixes locations.
	* gcc-changelog/test_email.py: Test it.
	* gcc-changelog/test_patches.txt: Add 3 new patches.
2020-06-02 16:05:38 +02:00
Iain Buclaw
5fe28857fe contrib: Add gdc.test to list of ignored prefixes
The files in this subdirectory are part of the D2 test suite maintained
in the upstream DMD code repository.

contrib/ChangeLog:

	* gcc-changelog/git_commit.py (ignored_prefixes): Add
	gcc/testsuite/gdc.test/.
2020-06-02 12:56:46 +02:00
Jonathan Wakely
54a0eb7fa5 gcc-changelog: Update test to match new error text
contrib/ChangeLog:

	* gcc-changelog/test_email.py (TestGccChangelog.test_long_lines):
	Update expected error message.
2020-06-02 11:43:09 +01:00
Jonathan Wakely
6fb93242cb gcc-changelog: Improve error text for overlong ChangeLog lines
This error is wrong, the line is what exceeds LINE_LIMIT characters, the
limit doesn't exceed itself.

contrib/ChangeLog:

	* gcc-changelog/git_commit.py (GitCommit.parse_changelog): Fix
	grammar.
2020-06-02 11:18:21 +01:00
Jonathan Wakely
9a8bac4d7e
contrib: Improve comments and error text
* gcc-changelog/git_commit.py (GitCommit.check_mentioned_files):
	Improve error text.
2020-06-02 08:38:31 +02:00
Martin Liska
b9ca913b6a
Error for missing change description in git_commit.py.
contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Find empty change descriptions.
	* gcc-changelog/test_email.py: New test.
	* gcc-changelog/test_patches.txt: New patch that tests that.
2020-05-29 17:25:02 +02:00
Martin Liska
697eab1b3e
git_commit: fix duplicite email address.
The patch is about to handle situations like seen
in 3ea6977d0f.

contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Properly
	handle duplicite authors.
	* gcc-changelog/test_email.py: New test.
	* gcc-changelog/test_patches.txt: New patch.
2020-05-29 09:00:00 +02:00
Pierre-Marie de Rodat
a634157de1 gcc-changelog: enhance handling of renamings
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-28 11:14:44 +02:00
Pierre-Marie de Rodat
519f250645 gcc-changelog: handle entries with multi-line file lists
This extends the ChangeLog entries parsing machinery to handle entries
that cover multiple files spanning over multiple lines. For instance:

    * first_file_patched.c, second_file_patched.c, third_file_patched.c,
    fourth_file_patched.c: Do things.

contrib/

	* gcc-changelog/git_commit.py (ChangeLogEntry): Handle entries
	with multi-line file lists.
	* gcc-changelog/test_email.py: New testcase.
	* gcc-changelog/test_patches.txt: Likewise.
2020-05-26 17:45:58 +02:00
Pierre-Marie de Rodat
bb07057a31 gcc-changelog: remove file descriptor leaks
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-26 17:45:38 +02:00
Martin Liska
c8462662da
Support --dry-mode in git_update_version.py.
The patch improves the script based on Jakub's needs,
I'm going to install the patch.

contrib/ChangeLog:

	* gcc-changelog/git_update_version.py: Add 2 new options.
2020-05-26 12:13:13 +02:00
Alexandre Oliva
1c7f8cbcc7 accept for dir/ChangeLog entries
I've long introduced ChangeLog entries as "for  dir/ChangeLog", a
format adopted by GNU CVS-Utilities some 20 years ago.  My commits
have been formatted like this forever.

This patch makes it acceptable for git gcc-verify.


contrib/ChangeLog:

	* gcc-changelog/git_commit.py (changelog_regex): Accept optional
	'for' prefix.
2020-05-26 04:30:18 -03:00
Martin Liska
4945b4c2c8
Allow ChangeLog entries for ignored location.
We should be able to generate ChangeLog entries for
commits like b3d566f570.
I'm going to install the patch.

contrib/ChangeLog:

	* gcc-changelog/git_commit.py: Parse changelog entries for
	ignored locations.
	* gcc-changelog/test_email.py: Add new test for it.
	* gcc-changelog/test_patches.txt: Likewise.
2020-05-26 09:02:43 +02:00
Martin Liska
deea3defc9
Allow only ignored files in ChangeLog entries.
* gcc-changelog/git_commit.py: Add trailing '/'
	for libdruntime.  Allow empty changelog for
	only ignored files.
	* gcc-changelog/test_email.py: New test for go
	patch in ignored location.
	* gcc-changelog/test_patches.txt: Add test.
2020-05-25 09:49:54 +02:00
Jakub Jelinek
5daf69cfe9 Fix up go related ignored locations.
2020-05-22  Jakub Jelinek  <jakub@redhat.com>

	* gcc-changelog/git_commit.py: Add trailing / to
	gcc/testsuite/go.test/test and replace gcc/go/frontend/
	with gcc/go/gofrontend/ in ignored locations.
2020-05-22 13:09:34 +02:00