tools.linux.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH b4 0/2] trailers: accept recognized link trailers + "Closes"
@ 2023-05-25 20:10 Matthieu Baerts
  2023-05-25 20:10 ` [PATCH b4 1/2] trailers: accept recognized link trailers Matthieu Baerts
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Matthieu Baerts @ 2023-05-25 20:10 UTC (permalink / raw)
  To: Kernel.org Tools
  Cc: Nick Desaulniers, Konstantin Ryabitsev, Matthieu Baerts,
	Follow Upper, Cover Upper, Test Override

Nick reported in [1] that Closes tags were not picked up by b4 when
updating trailers.

In fact, it looks like that even Link ones were not picked up. (Or at
least it was not working when I was testing it :) ).

With this series, Link, BugLink and Closes tags are now automatically
added when available in follow-up comments.

Link: https://lore.kernel.org/all/CAKwvOdm=Zk8YhrPptN3k7UQo+1n7Ws=Qox=BwTR9bbjPJJYz8A@mail.gmail.com/ [1]
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
Matthieu Baerts (2):
      trailers: accept recognized link trailers
      trailers: add 'Closes' as recognized link trailer

 b4/__init__.py                                           | 8 +++++---
 tests/samples/trailers-thread-with-cover-followup.mbox   | 2 ++
 tests/samples/trailers-thread-with-cover-followup.verify | 2 ++
 3 files changed, 9 insertions(+), 3 deletions(-)
---
base-commit: bfdf5b3b0835c8c351abbcd9b3b5268acf6545fa
change-id: 20230525-closes-tags-49d25abf4c24

Best regards,
-- 
Matthieu Baerts <matthieu.baerts@tessares.net>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH b4 1/2] trailers: accept recognized link trailers
  2023-05-25 20:10 [PATCH b4 0/2] trailers: accept recognized link trailers + "Closes" Matthieu Baerts
@ 2023-05-25 20:10 ` Matthieu Baerts
  2023-05-25 20:10 ` [PATCH b4 2/2] trailers: add 'Closes' as recognized link trailer Matthieu Baerts
  2023-05-26 17:46 ` [PATCH b4 0/2] trailers: accept recognized link trailers + "Closes" Konstantin Ryabitsev
  2 siblings, 0 replies; 4+ messages in thread
From: Matthieu Baerts @ 2023-05-25 20:10 UTC (permalink / raw)
  To: Kernel.org Tools
  Cc: Nick Desaulniers, Konstantin Ryabitsev, Matthieu Baerts,
	Follow Upper, Cover Upper, Test Override

It looks like all all link trailers were ignored.

Now we accept 'link' and 'buglink' that were already in the list of non
person categories.

Note that existing test files have been modified. You will probably need
to run "pytest --cache-clear" to avoid using the previous version.

Fixes: 7d1a05e ("trailers: ignore non-recognized link trailers")
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 b4/__init__.py                                           | 6 ++++--
 tests/samples/trailers-thread-with-cover-followup.mbox   | 1 +
 tests/samples/trailers-thread-with-cover-followup.verify | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/b4/__init__.py b/b4/__init__.py
index 1af6993..e9e7b64 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -1656,7 +1656,8 @@ class LoreMessage:
     def find_trailers(body: str, followup: bool = False) -> Tuple[List[LoreTrailer], List[str]]:
         ignores = {'phone', 'email'}
         headers = {'subject', 'date', 'from'}
-        nonperson = {'fixes', 'subject', 'date', 'link', 'buglink', 'obsoleted-by', 'change-id', 'base-commit'}
+        links = {'link', 'buglink'}
+        nonperson = links | {'fixes', 'subject', 'date', 'obsoleted-by', 'change-id', 'base-commit'}
         # Ignore everything below standard email signature marker
         body = body.split('\n-- \n', 1)[0].strip() + '\n'
         # Fix some more common copypasta trailer wrapping
@@ -1695,7 +1696,8 @@ class LoreMessage:
                     if not mperson and lname not in nonperson:
                         logger.debug('Ignoring %s (not a recognized non-person trailer)', line)
                         continue
-                    if re.search(r'https?://', ovalue):
+                    mlink = re.search(r'https?://', ovalue)
+                    if mlink and lname not in links:
                         logger.debug('Ignoring %s (not a recognized link trailer)', line)
                         continue
 
diff --git a/tests/samples/trailers-thread-with-cover-followup.mbox b/tests/samples/trailers-thread-with-cover-followup.mbox
index d9dc64a..bbdeeeb 100644
--- a/tests/samples/trailers-thread-with-cover-followup.mbox
+++ b/tests/samples/trailers-thread-with-cover-followup.mbox
@@ -225,6 +225,7 @@ To: list@example.org
 > Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
 
 Tested-by: Follow Upper <follow.upper@example.org>
+Link: https://example.org
 
 -- 
 Follow Upper
diff --git a/tests/samples/trailers-thread-with-cover-followup.verify b/tests/samples/trailers-thread-with-cover-followup.verify
index 6478e6f..b42e1ed 100644
--- a/tests/samples/trailers-thread-with-cover-followup.verify
+++ b/tests/samples/trailers-thread-with-cover-followup.verify
@@ -4,6 +4,7 @@ Life imitatus artem.
 
 Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
 Tested-by: Follow Upper <follow.upper@example.org>
+Link: https://example.org
 Reviewed-by: Cover Upper <cover.upper@example.org>
 Signed-off-by: Test Override <test-override@example.com>
 ---

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH b4 2/2] trailers: add 'Closes' as recognized link trailer
  2023-05-25 20:10 [PATCH b4 0/2] trailers: accept recognized link trailers + "Closes" Matthieu Baerts
  2023-05-25 20:10 ` [PATCH b4 1/2] trailers: accept recognized link trailers Matthieu Baerts
@ 2023-05-25 20:10 ` Matthieu Baerts
  2023-05-26 17:46 ` [PATCH b4 0/2] trailers: accept recognized link trailers + "Closes" Konstantin Ryabitsev
  2 siblings, 0 replies; 4+ messages in thread
From: Matthieu Baerts @ 2023-05-25 20:10 UTC (permalink / raw)
  To: Kernel.org Tools
  Cc: Nick Desaulniers, Konstantin Ryabitsev, Matthieu Baerts,
	Follow Upper, Cover Upper, Test Override

The Closes tag has been used for quite a long time in the Linux kernel,
mainly by DRM and MPTCP subsystems. It is used by some bug trackers like
GitHub, GitLab and bugzilla.kernel.org to automate the closure of issues
when a patch is accepted.

In Linux 6.3, checkpatch started to complain about this tag because it
has never been described in the documentation. The situation has changed
in Linux 6.4 [1]: I initially just wanted to allow the Closes tag but
some reviewers pointed out that bots reading mailing lists like RegzBot
would be interested to have it instead of the Link tag when any kind of
bug is being closed. So now after a Reported-by, checkpatch.pl now
suggests to add a Closes with a link.

In other words, it is now more common to see this Closes tag in the
Linux kernel. It is certainly used in many other projects than the Linux
kernel.

This Closes tag is treated as a Link tag.

Note that existing test files have been modified. You will probably need
to run "pytest --cache-clear" to avoid using the previous version.

Link: https://lore.kernel.org/all/20230314-doc-checkpatch-closes-tag-v4-0-d26d1fa66f9f@tessares.net/ [1]
Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Closes: https://lore.kernel.org/all/CAKwvOdm=Zk8YhrPptN3k7UQo+1n7Ws=Qox=BwTR9bbjPJJYz8A@mail.gmail.com/
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 b4/__init__.py                                           | 4 ++--
 tests/samples/trailers-thread-with-cover-followup.mbox   | 1 +
 tests/samples/trailers-thread-with-cover-followup.verify | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/b4/__init__.py b/b4/__init__.py
index e9e7b64..44deacd 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -885,7 +885,7 @@ class LoreTrailer:
     addr: Optional[Tuple[str, str]] = None
     lmsg = None
     # Small list of recognized utility trailers
-    _utility: Set[str] = {'fixes', 'link', 'buglink', 'obsoleted-by', 'message-id', 'change-id', 'base-commit'}
+    _utility: Set[str] = {'fixes', 'link', 'buglink', 'closes', 'obsoleted-by', 'message-id', 'change-id', 'base-commit'}
 
     def __init__(self, name: Optional[str] = None, value: Optional[str] = None, extinfo: Optional[str] = None,
                  msg: Optional[email.message.Message] = None):
@@ -1656,7 +1656,7 @@ class LoreMessage:
     def find_trailers(body: str, followup: bool = False) -> Tuple[List[LoreTrailer], List[str]]:
         ignores = {'phone', 'email'}
         headers = {'subject', 'date', 'from'}
-        links = {'link', 'buglink'}
+        links = {'link', 'buglink', 'closes'}
         nonperson = links | {'fixes', 'subject', 'date', 'obsoleted-by', 'change-id', 'base-commit'}
         # Ignore everything below standard email signature marker
         body = body.split('\n-- \n', 1)[0].strip() + '\n'
diff --git a/tests/samples/trailers-thread-with-cover-followup.mbox b/tests/samples/trailers-thread-with-cover-followup.mbox
index bbdeeeb..5c4e64e 100644
--- a/tests/samples/trailers-thread-with-cover-followup.mbox
+++ b/tests/samples/trailers-thread-with-cover-followup.mbox
@@ -226,6 +226,7 @@ To: list@example.org
 
 Tested-by: Follow Upper <follow.upper@example.org>
 Link: https://example.org
+Closes: https://example.org/bug/1234
 
 -- 
 Follow Upper
diff --git a/tests/samples/trailers-thread-with-cover-followup.verify b/tests/samples/trailers-thread-with-cover-followup.verify
index b42e1ed..acd6278 100644
--- a/tests/samples/trailers-thread-with-cover-followup.verify
+++ b/tests/samples/trailers-thread-with-cover-followup.verify
@@ -5,6 +5,7 @@ Life imitatus artem.
 Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
 Tested-by: Follow Upper <follow.upper@example.org>
 Link: https://example.org
+Closes: https://example.org/bug/1234
 Reviewed-by: Cover Upper <cover.upper@example.org>
 Signed-off-by: Test Override <test-override@example.com>
 ---

-- 
2.39.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH b4 0/2] trailers: accept recognized link trailers + "Closes"
  2023-05-25 20:10 [PATCH b4 0/2] trailers: accept recognized link trailers + "Closes" Matthieu Baerts
  2023-05-25 20:10 ` [PATCH b4 1/2] trailers: accept recognized link trailers Matthieu Baerts
  2023-05-25 20:10 ` [PATCH b4 2/2] trailers: add 'Closes' as recognized link trailer Matthieu Baerts
@ 2023-05-26 17:46 ` Konstantin Ryabitsev
  2 siblings, 0 replies; 4+ messages in thread
From: Konstantin Ryabitsev @ 2023-05-26 17:46 UTC (permalink / raw)
  To: Kernel.org Tools, Matthieu Baerts
  Cc: Nick Desaulniers, Follow Upper, Cover Upper, Test Override


On Thu, 25 May 2023 22:10:35 +0200, Matthieu Baerts wrote:
> Nick reported in [1] that Closes tags were not picked up by b4 when
> updating trailers.
> 
> In fact, it looks like that even Link ones were not picked up. (Or at
> least it was not working when I was testing it :) ).
> 
> With this series, Link, BugLink and Closes tags are now automatically
> added when available in follow-up comments.
> 
> [...]

Applied, thanks!

[1/2] trailers: accept recognized link trailers
      commit: 0a6be433883dee544b991e218e0f505dba356a88
[2/2] trailers: add 'Closes' as recognized link trailer
      commit: d21bd9e7ff99736818af68b99d36a8e77889132d

Best regards,
-- 
Konstantin Ryabitsev <konstantin@linuxfoundation.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-26 17:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25 20:10 [PATCH b4 0/2] trailers: accept recognized link trailers + "Closes" Matthieu Baerts
2023-05-25 20:10 ` [PATCH b4 1/2] trailers: accept recognized link trailers Matthieu Baerts
2023-05-25 20:10 ` [PATCH b4 2/2] trailers: add 'Closes' as recognized link trailer Matthieu Baerts
2023-05-26 17:46 ` [PATCH b4 0/2] trailers: accept recognized link trailers + "Closes" Konstantin Ryabitsev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).