The testing infrastructure built by Martin Liška contains checking a
few python scripts in contrib witha tool flake8. That tool recently
complains that:
contrib/mklog.py:360:45: E711 comparison to None should be 'if cond is None:'
contrib/mklog.py:362:1: E305 expected 2 blank lines after class or function definition, found 1
I'd like to silence these with the following, hopefully trivial,
changes. However, I have only tested the changes by running flake8
again and running ./contrib/mklog.py --help.
Is this good for trunk? (Or should I stop using flake8 instead?)
Thanks,
Martin
contrib/ChangeLog:
2023-10-03 Martin Jambor <mjambor@suse.cz>
* mklog.py (skip_line_in_changelog): Compare to None using is instead
of ==, add an extra newline after the function.
Consider Signed-off-by lines as part of the ending of the initial
commit to avoid having these in the middle of the log when the
changelog part is injected after.
This is particularly usefull with:
$ git gcc-commit-mklog --amend -s
that can be used to create the changelog and add the Signed-off-by line.
Also applies most of the shellcheck suggestions on the
prepare-commit-msg hook.
contrib/ChangeLog:
* mklog.py: Leave SOB lines after changelog.
* prepare-commit-msg: Apply most shellcheck suggestions.
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
This little patch fix two bugs of mklog.py with --append option.
The first bug is that the regexp used is not accurate enough to
determine the top of diff area. The second bug is that if `---`
is not a true start, it needs to be added back to the patch file.
And with additional fix Python code format error, which Martin reported.
contrib/ChangeLog:
* mklog.py: Fix bugs.
This tiny patch add --append option to mklog.py that support add generated
change-log to the corresponding patch file. With this option there is no need
to manually copy the generated change-log to the patch file. e.g.:
Run `mklog.py --append /path/to/this/patch` will add the generated change-log
to the right place of the /path/to/this/patch file.
contrib/ChangeLog:
* mklog.py: Add --append option.
Signed-off-by: Lehua Ding <lehua.ding@rivai.ai>
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.
contrib/ChangeLog:
* git-commit-mklog.py: Do not parse -b argument.
Pass mklog_args as json environment variable.
* mklog.py: Parse GCC_MKLOG_ARGS and append it to sys.argv.
* prepare-commit-msg: Do not append GCC_MKLOG_ARGS to args.
The argument can be used for addition of Co-Authored-By lines
with --trailer='Co-Authored-By=Mona Lisa Octocat <mona@github.com>'.
contrib/ChangeLog:
* gcc-git-customization.sh: Wrap $@ in quotes.
* git-commit-mklog.py: Add new argument --co.
* mklog.py: Skip the Co-Authored-By lines.
Co-authored-by: Martin Sebor <msebor@redhat.com>
contrib/ChangeLog:
* mklog.py (bugzilla_url): Fetch also component.
(pr_filename_regex): New.
(get_pr_titles): Update PR string with correct format and component.
(generate_changelog): Take additional PRs; extract PR from the
filename.
(__main__): Add -b/--pr-numbers argument.
* test_mklog.py (EXPECTED4): Update to expect a PR for the new file.
In the recent gcc-commit-mklog thread on gcc@ it occurred to me that the
command could also fill in part of the subject line. If the first PR is
foo/1234, and the commit does not yet have a subject line, this will add
foo: [PR1234]
contrib/ChangeLog:
* mklog.py: Add an initial component: [PRnnnnn] line when
we have a PR.
contrib/ChangeLog:
* mklog.py: Put PR entries before all ChangeLog entries
(will be added to all ChangeLog locations by Daily bump script).
* test_mklog.py: Test the new behavior.
The argument is handy when one needs to generate ChangeLog entries
for a different project (e.g. binutils).
contrib/ChangeLog:
* mklog.py: Add --directory argument.
This fixes an infinite loop one could see for:
git show b87ec922c4 | ./contrib/mklog.py
contrib/ChangeLog:
* mklog.py: Fix infinite loop for unsupported files.
This patch introduces a prepare-commit-msg hook that appends a ChangeLog
skeleton to a commit message when the GCC_FORCE_MKLOG environment variable
is set, and a 'git commit-mklog' command set that variable while running
'git commit'.
contrib/ChangeLog:
* prepare-commit-msg: New file.
* gcc-git-customization.sh: Install it. Add commit-mklog alias.
* mklog.py: Add new option -c which appends
to a ChangeLog file.
contrib/ChangeLog:
2020-05-15 Martin Liska <mliska@suse.cz>
* gcc-git-customization.sh: Add
alias.gcc-mklog new hook.
* mklog.py: New file.
* test_mklog.py: New file.