[U-Boot] [PATCH v2 03/44] moveconfig: Add an option to commit changes

Masahiro Yamada yamada.masahiro at socionext.com
Tue Aug 30 06:00:14 CEST 2016


Hi Simon,

2016-08-30 9:21 GMT+09:00 Simon Glass <sjg at chromium.org>:
> The moveconfig tool is quite clever and generally produces results that
> are suitable for sending as a patch without further work. The main required
> step is to add the changes to a commit.
>
> Add an option to do this automatically. This allows moveconfig to be used
> from a script to convert multiple CONFIG options, once per commit.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---


Again, you need to describe the option
in the "Available options" section.


> Changes in v2: None
>
>  tools/moveconfig.py | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/tools/moveconfig.py b/tools/moveconfig.py
> index 290270a..cf21318 100755
> --- a/tools/moveconfig.py
> +++ b/tools/moveconfig.py
> @@ -1199,6 +1199,8 @@ def main():
>      # Add options here
>      parser.add_option('-c', '--color', action='store_true', default=False,
>                        help='display the log in color')
> +    parser.add_option('-C', '--commit', action='store_true', default=False,
> +                      help='Create a git commit for the operation')
>      parser.add_option('-d', '--defconfigs', type='string',
>                        help='a file containing a list of defconfigs to move')
>      parser.add_option('-n', '--dry-run', action='store_true', default=False,
> @@ -1242,5 +1244,13 @@ def main():
>          cleanup_headers(configs, options)
>          cleanup_extra_options(configs, options)
>
> +    if options.commit:
> +        os.system('git add -u')
> +        msg = '''Convert %s to Kconfig
> +
> +Move this option to Kconfig and tidy up existing uses.
> +''' % ', '.join(configs)
> +        os.system('git commit -s -m "%s"' % msg)
> +
>  if __name__ == '__main__':
>      main()

This breaks indentation.
Please re-write the code.


Also, use subprocess, instead of os.system.

http://www.pythonforbeginners.com/os/subprocess-for-system-administrators




-- 
Best Regards
Masahiro Yamada


More information about the U-Boot mailing list