mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Valentin Rothberg <valentinrothberg@gmail.com>
To: gregkh@linuxfoundation.org, stefan.hengelein@fau.de,
	andreas.ruprecht@fau.de, pebolle@tiscali.nl
Cc: linux-kernel@vger.kernel.org,
	Valentin Rothberg <valentinrothberg@gmail.com>
Subject: [PATCH 1/2] checkkconfigsymbols.py: find relevant commits
Date: Mon,  1 Jun 2015 16:00:19 +0200	[thread overview]
Message-ID: <1433167220-12292-2-git-send-email-valentinrothberg@gmail.com> (raw)
In-Reply-To: <1433167220-12292-1-git-send-email-valentinrothberg@gmail.com>

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>
---
 scripts/checkkconfigsymbols.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py
index c89fdcaf06e8..292848e32036 100755
--- a/scripts/checkkconfigsymbols.py
+++ b/scripts/checkkconfigsymbols.py
@@ -58,6 +58,11 @@ def parse_options():
                            "input format bases on Git log's "
                            "\'commmit1..commit2\'.")
 
+    parser.add_option('-f', '--find', dest='find', action='store_true',
+                      default=False,
+                      help="Find and show commits that may cause symbols to be "
+                           "missing.  Required to run with --diff.")
+
     parser.add_option('-i', '--ignore', dest='ignore', action='store',
                       default="",
                       help="Ignore files matching this pattern.  Note that "
@@ -86,6 +91,9 @@ def parse_options():
                      "'--force' if you\nwant to ignore this warning and "
                      "continue.")
 
+    if opts.commit:
+        opts.find = False
+
     if opts.ignore:
         try:
             re.match(opts.ignore, "this/is/just/a/test.c")
@@ -129,12 +137,18 @@ def main():
             if not feature in undefined_a:
                 files = sorted(undefined_b.get(feature))
                 print "%s\t%s" % (feature, ", ".join(files))
+                if opts.find:
+                    commits = find_commits(feature, opts.diff)
+                    print commits
             # check if there are new files that reference the undefined feature
             else:
                 files = sorted(undefined_b.get(feature) -
                                undefined_a.get(feature))
                 if files:
                     print "%s\t%s" % (feature, ", ".join(files))
+                    if opts.find:
+                        commits = find_commits(feature, opts.diff)
+                        print commits
 
         # reset to head
         execute("git reset --hard %s" % head)
@@ -156,6 +170,13 @@ def execute(cmd):
     return stdout
 
 
+def find_commits(symbol, diff):
+    """Find commits changing %symbol in the given range of %diff."""
+    commits = execute("git log --pretty=oneline --abbrev-commit -G %s %s"
+                      % (symbol, diff))
+    return commits
+
+
 def tree_is_dirty():
     """Return true if the current working tree is dirty (i.e., if any file has
     been added, deleted, modified, renamed or copied but not committed)."""
-- 
2.1.4


  reply	other threads:[~2015-06-01 14:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 14:00 [PATCH 0/2] " Valentin Rothberg
2015-06-01 14:00 ` Valentin Rothberg [this message]
2015-06-01 14:00 ` [PATCH 2/2] checkkconfigsymbols.py: colored output Valentin Rothberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433167220-12292-2-git-send-email-valentinrothberg@gmail.com \
    --to=valentinrothberg@gmail.com \
    --cc=andreas.ruprecht@fau.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pebolle@tiscali.nl \
    --cc=stefan.hengelein@fau.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®