[U-Boot] [PATCH] patman: check git format.subjectprefix setting when generate patches prefix
Simon Glass
sjg at chromium.org
Fri Apr 10 19:51:53 CEST 2015
Hi Josh,
On 7 April 2015 at 23:13, Josh Wu <josh.wu at atmel.com> wrote:
> For the local project, we may specified format.subjectprefix setting.
> Then the patch will be formated as [Project_prefix][PATCH].
> But patman will not check this setting. It will remove the
> format.subjectprefix.
>
> So This patch will let patman check this setting and add it as a
> project prefix.
>
> Signed-off-by: Josh Wu <josh.wu at atmel.com>
> ---
>
> tools/patman/gitutil.py | 11 +++++++++++
> tools/patman/series.py | 8 +++++++-
> 2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
> index 4c2c35b..9e739d8 100644
> --- a/tools/patman/gitutil.py
> +++ b/tools/patman/gitutil.py
> @@ -545,6 +545,17 @@ def GetDefaultUserEmail():
> uemail = command.OutputOneLine('git', 'config', '--global', 'user.email')
> return uemail
>
> +def GetDefaultSubjectPrefix():
> + """Gets the format.subjectprefix from local .git/config file.
> +
> + Returns:
> + Subject prefix found in local .git/config file, or None if none
> + """
> + sub_prefix = command.OutputOneLine('git', 'config', 'format.subjectprefix',
> + raise_on_error=False)
> +
> + return sub_prefix
> +
> def Setup():
> """Set up git utils, by reading the alias files."""
> # Check for a git alias file also
> diff --git a/tools/patman/series.py b/tools/patman/series.py
> index 60ebc76..a17a7d1 100644
> --- a/tools/patman/series.py
> +++ b/tools/patman/series.py
> @@ -254,6 +254,12 @@ class Series(dict):
> Return:
> Patch string, like 'RFC PATCH v5' or just 'PATCH'
> """
> + git_prefix = gitutil.GetDefaultSubjectPrefix()
> + if git_prefix:
> + git_prefix = '%s][' % git_prefix
> + else:
> + git_prefix = ''
> +
> version = ''
> if self.get('version'):
> version = ' v%s' % self['version']
> @@ -262,4 +268,4 @@ class Series(dict):
> prefix = ''
> if self.get('prefix'):
> prefix = '%s ' % self['prefix']
> - return '%sPATCH%s' % (prefix, version)
> + return '%s%sPATCH%s' % (git_prefix, prefix, version)
> --
> 1.9.1
The patch looks good, but I'm not quite sure how to use it. Can you
please add instructions to the patman README?
I tried:
git config format.subjectprefix U-Boot
patman -nmt
Then I get a patch with:
Subject: [U-Boot][PATCH] patman: check git format.subjectprefix
setting when generate patches prefix
I'm not sure how to get a space between [U-Boot] and [Patch]. Any ideas?
Regards,
Simon
More information about the U-Boot
mailing list