]> gcc.gnu.org Git - gcc.git/blob - contrib/gcc-changelog/git_check_commit.py
[Ada] Make sure output variable is always initialized
[gcc.git] / contrib / gcc-changelog / git_check_commit.py
1 #!/usr/bin/env python3
2 #
3 # This file is part of GCC.
4 #
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
8 # version.
9 #
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
13 # for more details.
14 #
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/>. */
18
19 import argparse
20
21 from git_repository import parse_git_revisions
22
23 parser = argparse.ArgumentParser(description='Check git ChangeLog format '
24 'of a commit')
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 parser.add_argument('-v', '--verbose', action='store_true',
33 help='Print verbose information')
34 args = parser.parse_args()
35
36 retval = 0
37 for git_commit in parse_git_revisions(args.git_path, args.revisions):
38 res = 'OK' if git_commit.success else 'FAILED'
39 print('Checking %s: %s' % (git_commit.original_info.hexsha, res))
40 if git_commit.success:
41 if args.print_changelog:
42 git_commit.print_output()
43 else:
44 for error in git_commit.errors:
45 print('ERR: %s' % error)
46 if args.verbose and error.details:
47 print(error.details)
48 retval = 1
49
50 exit(retval)
This page took 0.036793 seconds and 5 git commands to generate.