Commit 216bfcd4 authored by Arkadiusz Hiler's avatar Arkadiusz Hiler

Do not mark revision having mails with extra tags as strange

For simple [PATCH xx/yy] we store just [xx/yy] but for more complex
[PATCH extra xx/yy] it becomes [extra, xx/yy].

Let's fix the regexp used for extracting patch numbers, so that extra
tags do not make revision strange.
Signed-off-by: Arkadiusz Hiler's avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent 8a0f0baa
Pipeline #10423 failed with stage
......@@ -653,7 +653,7 @@ class SeriesRevision(models.Model):
return False
for index, name in enumerate(names):
match = re.search(r"\[(\d+)/(\d+)\]", name)
match = re.search(r"\[[^]]*(\d+)/(\d+).*\]", name)
if not match: # we have a patch without proper numbering
return True
if (index + 1) != int(match.group(1)): # numbering is off
......
......@@ -120,7 +120,8 @@ class RevisionStatus(GeneratedSeriesTest):
return list(self.series.revisions())[-1]
def setUp(self):
(self.test_series, self.mails) = self._create_series(3)
# 20 patches for multi-digit testing
(self.test_series, self.mails) = self._create_series(20)
def testFreshSeriesWithoutAllMailsShouldNotBeComple(self):
self.test_series.insert(self.mails[:-2])
......@@ -164,6 +165,17 @@ class RevisionStatus(GeneratedSeriesTest):
self.assertTrue(self.last_revision.is_complete)
self.assertTrue(self.last_revision.is_strange)
def testCompleteSeriesWithExtraTagShouldNotBeStrange(self):
for mail in self.mails:
new_subject = mail['Subject'].replace('PATCH', 'PATCH extra')
del(mail['Subject'])
mail['Subject'] = new_subject
self.test_series.insert(self.mails)
self.assertTrue(self.last_revision.is_complete)
self.assertFalse(self.last_revision.is_strange)
class BasicGeneratedSeriesTests(GeneratedSeriesTest):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment