[yocto] [patchwork][PATCH v3] models.py: Improve Series naming when no cover letter is provided
Jose Lamego
jose.a.lamego at linux.intel.com
Tue May 2 14:50:06 PDT 2017
The number/order prefix from a patch Subject line
is inapropriately included when naming a Series where
a cover letter is not provided and an additional
prefix is present at the Subject.
This change improves the substitution regex to omit
the number/order prefix but include any other prefix
that may be present.
[YOCTO #11305]
Signed-off-by: Jose Lamego <jose.a.lamego at linux.intel.com>
---
Notes:
Changes in V3: remove the number/order prefix without
changing any other other existing prefix, as this may be
required for mapping the patch to additional branches
other than master.
patchwork/models.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/patchwork/models.py b/patchwork/models.py
index ddc3254..7944b98 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -1046,8 +1046,12 @@ def _on_revision_complete(sender, revision, **kwargs):
# so we can update the name for series without a cover letter
if series.name == SERIES_DEFAULT_NAME:
name = series.latest_revision().ordered_patches()[0].name
- n = re.compile(r'(\[\d+\/\d+\]\s?)')
- name = n.sub('', name)
+ n = re.compile(
+ r'((\[.*\]\s?)*\[.*\w+.*(\W+\d+\/\d+)+\s*\]\s?)|(\[\d+\/\d+\]\s?)')
+ if n.match(name):
+ name = re.sub(
+ r'n.match(name).group(3) or re.escape(n.match(name).group(4)',
+ name)
c = len(series.latest_revision().ordered_patches())
# For one-patch series (1/1) without cover letter
if c == 1:
--
2.7.4
More information about the yocto
mailing list