return result
-def check_patch(fname, verbose=False, show_types=False):
+def check_patch(fname, verbose=False, show_types=False, use_tree=False):
"""Run checkpatch.pl on a file and parse the results.
Args:
verbose: True to print out every line of the checkpatch output as it is
parsed
show_types: Tell checkpatch to show the type (number) of each message
+ use_tree (bool): If False we'll pass '--no-tree' to checkpatch.
Returns:
namedtuple containing:
stdout: Full output of checkpatch
"""
chk = find_check_patch()
- args = [chk, '--no-tree']
+ args = [chk]
+ if not use_tree:
+ args.append('--no-tree')
if show_types:
args.append('--show-types')
output = command.output(*args, fname, raise_on_error=False)
line_str = '' if line is None else '%d' % line
return '%s:%s: %s: %s\n' % (fname, line_str, msg_type, msg)
-def check_patches(verbose, args):
+def check_patches(verbose, args, use_tree):
'''Run the checkpatch.pl script on each patch'''
error_count, warning_count, check_count = 0, 0, 0
col = terminal.Color()
for fname in args:
- result = check_patch(fname, verbose)
+ result = check_patch(fname, verbose, use_tree=use_tree)
if not result.ok:
error_count += result.errors
warning_count += result.warnings
patchstream.insert_cover_letter(cover_fname, series, to_do)
return series, cover_fname, patch_files
-def check_patches(series, patch_files, run_checkpatch, verbose):
+def check_patches(series, patch_files, run_checkpatch, verbose, use_tree):
"""Run some checks on a set of patches
This santiy-checks the patman tags like Series-version and runs the patches
run_checkpatch (bool): True to run checkpatch.pl
verbose (bool): True to print out every line of the checkpatch output as
it is parsed
+ use_tree (bool): If False we'll pass '--no-tree' to checkpatch.
Returns:
bool: True if the patches had no errors, False if they did
# Check the patches, and run them through 'git am' just to be sure
if run_checkpatch:
- ok = checkpatch.check_patches(verbose, patch_files)
+ ok = checkpatch.check_patches(verbose, patch_files, use_tree)
else:
ok = True
return ok
col, args.branch, args.count, args.start, args.end,
args.ignore_binary, args.add_signoff)
ok = check_patches(series, patch_files, args.check_patch,
- args.verbose)
+ args.verbose, args.check_patch_use_tree)
ok = ok and gitutil.check_suppress_cc_config()
send.add_argument('--no-check', action='store_false', dest='check_patch',
default=True,
help="Don't check for patch compliance")
+send.add_argument('--tree', dest='check_patch_use_tree', default=False,
+ action='store_true',
+ help=("Set `tree` to True. If `tree` is False then we'll "
+ "pass '--no-tree' to checkpatch (default: tree=%(default)s)"))
+send.add_argument('--no-tree', dest='check_patch_use_tree',
+ action='store_false', help="Set `tree` to False")
send.add_argument('--no-tags', action='store_false', dest='process_tags',
default=True, help="Don't process subject tags as aliases")
send.add_argument('--no-signoff', action='store_false', dest='add_signoff',
"u-boot": {},
"linux": {
"process_tags": "False",
+ "check_patch_use_tree": "True",
},
"gcc": {
"process_tags": "False",
>>> config = _ProjectConfigParser("linux")
>>> config.readfp(StringIO(sample_config))
>>> sorted((str(a), str(b)) for (a, b) in config.items("settings"))
- [('am_hero', 'True'), ('process_tags', 'False')]
+ [('am_hero', 'True'), ('check_patch_use_tree', 'True'), ('process_tags', 'False')]
# Check to make sure that settings works with unknown project.
>>> config = _ProjectConfigParser("unknown")