In certain cases, the shortlog for a patch would include branch and
'PATCH' tag information even after the repo tag got stripped out,
padding it with data that wouldn't actually be included with a merge.
This caused the patchtest test_shortlog_length test to erroneously
report a failure.

For example, a patch whose shortlog tags were:

[OE-core][master/scarthgap][PATCH]

would leave this behind in the shortlog, along with the actual content:

[master/scarthgap][PATCH]

Add a re.sub() call in the test to fix this by removing all square
bracket pairs that appear at the beginning of the string.

Fixes [YOCTO #15575].

Signed-off-by: Trevor Gamblin <[email protected]>
---
 meta/lib/patchtest/tests/test_mbox.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/lib/patchtest/tests/test_mbox.py 
b/meta/lib/patchtest/tests/test_mbox.py
index ae16c4bf934..0e3d055780a 100644
--- a/meta/lib/patchtest/tests/test_mbox.py
+++ b/meta/lib/patchtest/tests/test_mbox.py
@@ -9,6 +9,7 @@ import collections
 import parse_shortlog
 import parse_signed_off_by
 import pyparsing
+import re
 import subprocess
 from data import PatchTestInput
 
@@ -82,7 +83,7 @@ class TestMbox(base.Base):
     def test_shortlog_length(self):
         for commit in TestMbox.commits:
             # no reason to re-check on revert shortlogs
-            shortlog = commit.shortlog
+            shortlog = re.sub('^(\[.*?\])+ ', '', commit.shortlog)
             if shortlog.startswith('Revert "'):
                 continue
             l = len(shortlog)
-- 
2.39.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#203972): 
https://lists.openembedded.org/g/openembedded-core/message/203972
Mute This Topic: https://lists.openembedded.org/mt/108190191/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to