summaryrefslogtreecommitdiff
path: root/tools/patman
diff options
context:
space:
mode:
Diffstat (limited to 'tools/patman')
-rw-r--r--tools/patman/README6
-rw-r--r--tools/patman/gitutil.py11
-rw-r--r--tools/patman/series.py8
3 files changed, 23 insertions, 2 deletions
diff --git a/tools/patman/README b/tools/patman/README
index 7d039e82bc2..27ec90acc80 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -154,7 +154,11 @@ Series-version: n
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]
Series-name: name
Sets the name of the series. You don't need to have a name, and
diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 4c2c35bf9ac..9e739d89b6f 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 60ebc766f7e..a17a7d1de7b 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)