aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSean Anderson2021-10-22 19:07:04 -0400
committerSimon Glass2021-10-31 12:26:44 -0600
commit082c119af98153fd558f57c7a66d660b7ca6c6c9 (patch)
treec8526ef4b4dac3ffa9f1aaceb663233d0f734216 /tools
parent37f3758a250d4c590ffac671f100d9b5ec73b417 (diff)
patman: Add "postfix" support to patch subjects
In some communities, it may be necessary to append something after PATCH in the subject line. For example, the Linux networking subsystem expects [1] patch subject prefixes like [RFC PATCH net-next 0/99]. This adds support for such "postfix"s to patman. Although entirely cosmetic, it is still nice to have. [1] https://www.kernel.org/doc/html/latest/networking/netdev-FAQ.html#how-do-i-indicate-which-tree-net-vs-net-next-my-patch-should-be-in Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/patman/README5
-rw-r--r--tools/patman/func_test.py6
-rw-r--r--tools/patman/patchstream.py2
-rw-r--r--tools/patman/series.py9
-rw-r--r--tools/patman/test/test01.txt1
5 files changed, 19 insertions, 4 deletions
diff --git a/tools/patman/README b/tools/patman/README
index 53f55ce95d4..e3466e60854 100644
--- a/tools/patman/README
+++ b/tools/patman/README
@@ -188,6 +188,11 @@ Series-prefix: prefix
well. If your format.subjectprefix is set to InternalProject, then
the patch shows like: [InternalProject][RFC/RESEND PATCH]
+Series-postfix: postfix
+ Sets the subject "postfix". Normally empty, but can be the name of a
+ tree such as net or net-next if that needs to be specified. The patch
+ subject is like [PATCH net] or [PATCH net-next].
+
Series-name: name
Sets the name of the series. You don't need to have a name, and
patman does not yet use it, but it is convenient to put the branch
diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index 2493e527f52..9f4e03e8822 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -122,6 +122,7 @@ class TestFunctional(unittest.TestCase):
Series-to: u-boot
Series-prefix: RFC
+ Series-postfix: some-branch
Series-cc: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Cover-letter-cc: Lord Mëlchett <clergy@palace.gov>
Series-version: 3
@@ -176,7 +177,7 @@ class TestFunctional(unittest.TestCase):
- each patch has the correct subject
- dry-run information prints out correctly
- unicode is handled correctly
- - Series-to, Series-cc, Series-prefix, Cover-letter
+ - Series-to, Series-cc, Series-prefix, Series-postfix, Cover-letter
- Cover-letter-cc, Series-version, Series-changes, Series-notes
- Commit-notes
"""
@@ -235,6 +236,7 @@ class TestFunctional(unittest.TestCase):
self.assertEqual('Cc: %s' % stefan, next(lines))
self.assertEqual('Version: 3', next(lines))
self.assertEqual('Prefix:\t RFC', next(lines))
+ self.assertEqual('Postfix:\t some-branch', next(lines))
self.assertEqual('Cover: 4 lines', next(lines))
self.assertEqual(' Cc: %s' % self.fred, next(lines))
self.assertEqual(' Cc: %s' % self.leb,
@@ -285,7 +287,7 @@ Simon Glass (2):
'''
lines = open(cover_fname, encoding='utf-8').read().splitlines()
self.assertEqual(
- 'Subject: [RFC PATCH v3 0/2] test: A test patch series',
+ 'Subject: [RFC PATCH some-branch v3 0/2] test: A test patch series',
lines[3])
self.assertEqual(expected.splitlines(), lines[7:])
diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py
index 2439fb18e42..1da9d53b650 100644
--- a/tools/patman/patchstream.py
+++ b/tools/patman/patchstream.py
@@ -596,6 +596,8 @@ class PatchStream:
# These seem like they would be nice to include.
if 'prefix' in self.series:
parts.append(self.series['prefix'])
+ if 'postfix' in self.series:
+ parts.append(self.serties['postfix'])
if 'version' in self.series:
parts.append("v%s" % self.series['version'])
diff --git a/tools/patman/series.py b/tools/patman/series.py
index 8ae218d3a4c..da734d92cf3 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -16,7 +16,7 @@ from patman import tools
# Series-xxx tags that we understand
valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name',
- 'cover_cc', 'process_log', 'links', 'patchwork_url']
+ 'cover_cc', 'process_log', 'links', 'patchwork_url', 'postfix']
class Series(dict):
"""Holds information about a patch series, including all tags.
@@ -133,6 +133,7 @@ class Series(dict):
print('Cc:\t ', item)
print('Version: ', self.get('version'))
print('Prefix:\t ', self.get('prefix'))
+ print('Postfix:\t ', self.get('postfix'))
if self.cover:
print('Cover: %d lines' % len(self.cover))
cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
@@ -322,4 +323,8 @@ class Series(dict):
prefix = ''
if self.get('prefix'):
prefix = '%s ' % self['prefix']
- return '%s%sPATCH%s' % (git_prefix, prefix, version)
+
+ postfix = ''
+ if self.get('postfix'):
+ postfix = ' %s' % self['postfix']
+ return '%s%sPATCH%s%s' % (git_prefix, prefix, postfix, version)
diff --git a/tools/patman/test/test01.txt b/tools/patman/test/test01.txt
index de2d9e4d284..fc3066e50b4 100644
--- a/tools/patman/test/test01.txt
+++ b/tools/patman/test/test01.txt
@@ -44,6 +44,7 @@ Date: Sat Apr 15 15:39:08 2017 -0600
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-to: u-boot
Series-prefix: RFC
+ Series-postfix: some-branch
Series-cc: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Cover-letter-cc: Lord Mëlchett <clergy@palace.gov>
Series-version: 3