From: Josh Wu <josh.wu@atmel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] patman: check git format.subjectprefix setting when generate patches prefix
Date: Mon, 13 Apr 2015 10:00:41 +0800 [thread overview]
Message-ID: <552B2349.3080205@atmel.com> (raw)
In-Reply-To: <CAPnjgZ3RwbRRbtDuAy5peOR+r-+9hgE67JAOv=kABgJS+tnFpA@mail.gmail.com>
Hi, Simon
On 4/11/2015 1:51 AM, Simon Glass wrote:
> Hi Josh,
>
> On 7 April 2015 at 23:13, Josh Wu <josh.wu@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@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?
The user case is like when we are working on multiple projects, some are
for mainline, some are for internal project.
We need add a patch prefix to indicate the patch is for internal project.
For the readme file, how about add this after Series-prefix like:
----------------8<--------------------
Series-prefix: prefix
Sets the subject prefix. Normally empty but it can be RFC for
- RFC patches, or RESEND if you are being ignored.
+ RFC patches, or RESEND if you are being ignored. The patch subject
+ is like [RFC PATCH] or [RESEND PATCH].
+ In the meantime, git format.subjectprefix option will be added as
+ well. If your format.subjectprefix is set to InternalProject, then
+ the patch shows like: [InternalProject][RFC/RESEND PATCH]
---------------->8--------------------
>
> 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?
I tried some, but same fail to add a space between [U-Boot] and [Patch],
I don't think we need that space.
Best Regards,
Josh Wu
>
> Regards,
> Simon
next prev parent reply other threads:[~2015-04-13 2:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-08 5:13 [U-Boot] [PATCH] patman: check git format.subjectprefix setting when generate patches prefix Josh Wu
2015-04-10 17:51 ` Simon Glass
2015-04-13 2:00 ` Josh Wu [this message]
2015-04-14 22:47 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=552B2349.3080205@atmel.com \
--to=josh.wu@atmel.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox