3 # This file is part of GCC.
5 # GCC is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU General Public License as published by the Free
7 # Software Foundation; either version 3, or (at your option) any later
10 # GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 # You should have received a copy of the GNU General Public License
16 # along with GCC; see the file COPYING3. If not see
17 # <http://www.gnu.org/licenses/>. */
21 from git_repository
import parse_git_revisions
23 parser
= argparse
.ArgumentParser(description
='Check git ChangeLog format '
25 parser
.add_argument('revisions', default
='HEAD', nargs
='?',
26 help='Git revisions (e.g. hash~5..hash or just hash) - '
27 'if not specified: HEAD')
28 parser
.add_argument('-g', '--git-path', default
='.',
29 help='Path to git repository')
30 parser
.add_argument('-p', '--print-changelog', action
='store_true',
31 help='Print final changelog entires')
32 args
= parser
.parse_args()
35 for git_commit
in parse_git_revisions(args
.git_path
, args
.revisions
):
36 res
= 'OK' if git_commit
.success
else 'FAILED'
37 print('Checking %s: %s' % (git_commit
.original_info
.hexsha
, res
))
38 if git_commit
.success
:
39 if args
.print_changelog
:
40 git_commit
.print_output()
42 for error
in git_commit
.errors
:
43 print('ERR: %s' % error
)