Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit a42fa92

Browse files
vrothberggregkh
authored andcommitted
checkkconfigsymbols.py: find relevant commits
Add option -f/--find to find relevant commits when using the --diff option. --find is useful in case a user wants to check commits that potentially cause a Kconfig symbol to be missing. This is done via 'git log -G $SYMBOL' (i.e., to get a list of commits that change $SYMBOL). The relevant commits are printed below the "SYMBOL\tFILES" line, followed by an empty line to increase readability. Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com> Acked-by: Stefan Hengelein <stefan.hengelein@fau.de> Acked-by: Andreas Ruprecht <andreas.ruprecht@fau.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ccf97fe commit a42fa92

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

scripts/checkkconfigsymbols.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ def parse_options():
5858
"input format bases on Git log's "
5959
"\'commmit1..commit2\'.")
6060

61+
parser.add_option('-f', '--find', dest='find', action='store_true',
62+
default=False,
63+
help="Find and show commits that may cause symbols to be "
64+
"missing. Required to run with --diff.")
65+
6166
parser.add_option('-i', '--ignore', dest='ignore', action='store',
6267
default="",
6368
help="Ignore files matching this pattern. Note that "
@@ -86,6 +91,9 @@ def parse_options():
8691
"'--force' if you\nwant to ignore this warning and "
8792
"continue.")
8893

94+
if opts.commit:
95+
opts.find = False
96+
8997
if opts.ignore:
9098
try:
9199
re.match(opts.ignore, "this/is/just/a/test.c")
@@ -129,12 +137,18 @@ def main():
129137
if not feature in undefined_a:
130138
files = sorted(undefined_b.get(feature))
131139
print "%s\t%s" % (feature, ", ".join(files))
140+
if opts.find:
141+
commits = find_commits(feature, opts.diff)
142+
print commits
132143
# check if there are new files that reference the undefined feature
133144
else:
134145
files = sorted(undefined_b.get(feature) -
135146
undefined_a.get(feature))
136147
if files:
137148
print "%s\t%s" % (feature, ", ".join(files))
149+
if opts.find:
150+
commits = find_commits(feature, opts.diff)
151+
print commits
138152

139153
# reset to head
140154
execute("git reset --hard %s" % head)
@@ -156,6 +170,13 @@ def execute(cmd):
156170
return stdout
157171

158172

173+
def find_commits(symbol, diff):
174+
"""Find commits changing %symbol in the given range of %diff."""
175+
commits = execute("git log --pretty=oneline --abbrev-commit -G %s %s"
176+
% (symbol, diff))
177+
return commits
178+
179+
159180
def tree_is_dirty():
160181
"""Return true if the current working tree is dirty (i.e., if any file has
161182
been added, deleted, modified, renamed or copied but not committed)."""

0 commit comments

Comments
 (0)