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

Russell Bryant russell at ovn.org
Wed Jul 26 20:45:17 UTC 2017


On Fri, Jul 14, 2017 at 6:57 AM, Ilya Maximets <i.maximets at samsung.com> wrote:
> 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(-)

Thanks for the patches!  I applied all 4 to master.

>
> 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()
> +

I slightly modified this to be:

@@ -502,9 +502,8 @@ if __name__ == '__main__':
         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()
+        with os.popen(git_log + '-%d' % n_patches, 'r') as f:
+            commits = f.read().split("\n")

         for i in reversed(range(0, n_patches)):
             revision, name = commits[i].split(" ", 1)


More information about the dev mailing list