[ovs-dev] [PATCH 4/4] checkpatch: Print commit hashes and names.

Ilya Maximets i.maximets at samsung.com
Fri Jul 14 10:57:24 UTC 2017


It's better to see real commits instead of 'HEAD~n'.

Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
---
 utilities/checkpatch.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index 7ccec51..f61b8b7 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -500,13 +500,19 @@ if __name__ == '__main__':
 
     if n_patches:
         status = 0
+
+        git_log = 'git log --no-color --no-merges --pretty=format:"%H %s" '
+        f = os.popen(git_log + '-%d' % n_patches, 'r')
+        commits = f.read().split("\n")
+        f.close()
+
         for i in reversed(range(0, n_patches)):
-            revision = 'HEAD~%d' % i
+            revision, name = commits[i].split(" ", 1)
             f = os.popen('git format-patch -1 --stdout %s' % revision, 'r')
             patch = f.read()
             f.close()
 
-            print('== Checking %s ==' % revision)
+            print('== Checking %s ("%s") ==' % (revision[0:12], name))
             result = ovs_checkpatch_parse(patch, revision)
             ovs_checkpatch_print_result(result)
             if result:
-- 
2.7.4



More information about the dev mailing list