[PATCH] patman: Add "postfix" support to patch subjects
Sean Anderson
sean.anderson at seco.com
Sat Oct 23 01:07:04 CEST 2021
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 at seco.com>
---
tools/patman/README | 5 +++++
tools/patman/func_test.py | 6 ++++--
tools/patman/patchstream.py | 2 ++
tools/patman/series.py | 9 +++++++--
tools/patman/test/test01.txt | 1 +
5 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/tools/patman/README b/tools/patman/README
index 53f55ce95d..e3466e6085 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 2493e527f5..9f4e03e882 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 at rwth-aachen.de>
Cover-letter-cc: Lord Mëlchett <clergy at 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 2439fb18e4..1da9d53b65 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 8ae218d3a4..da734d92cf 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 de2d9e4d28..fc3066e50b 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 at chromium.org>
Series-to: u-boot
Series-prefix: RFC
+ Series-postfix: some-branch
Series-cc: Stefan Brüns <stefan.bruens at rwth-aachen.de>
Cover-letter-cc: Lord Mëlchett <clergy at palace.gov>
Series-version: 3
--
2.25.1
More information about the U-Boot
mailing list