From: Simon Glass <sjg@chromium.org>
Date: Fri, 16 Jun 2017 03:39:31 +0000 (-0600)
Subject: moveconfig: Allow piping in 'git show --stat' output
X-Git-Tag: v2025.01-rc5-pxa1908~6393^2~39
X-Git-Url: http://git.dujemihanovic.xyz/img/html/static/%7B%7B?a=commitdiff_plain;h=2ddd85dc34c4b5fdefe363b735d2eea8d9d87c6c;p=u-boot.git

moveconfig: Allow piping in 'git show --stat' output

It is useful to be able to process only a subset of boards to save time.
Often that subset is defined by the defconfig files in a git commit. This
change allows things like:

   # Build the database
   ./tools.moveconfig.py -b

   # Find some implying configs
   ./tools/moveconfig.py -i CONFIG_X

   # Add some 'imply' statements to Kconfig files
   ./tools/moveconfig.py -i CONFIG_X -a CONFIG_A,CONFIG_B

   # Reprocess the defconfig files to see if we can drop some changes
   git show --stat | ./tools/moveconfig.py -s -d -

   # Update the commit, with fewer defconfig changes
   gii commit -au

Where the commit contains defconfig files, this will reprocess them to
take account of the imply statements that you added.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 6fa394a495..6921135b0f 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -404,6 +404,8 @@ def get_matched_defconfigs(defconfigs_file):
         line = line.strip()
         if not line:
             continue # skip blank lines silently
+        if ' ' in line:
+            line = line.split(' ')[0]  # handle 'git log' input
         matched = get_matched_defconfig(line)
         if not matched:
             print >> sys.stderr, "warning: %s:%d: no defconfig matched '%s'" % \