[PATCH v2] Fix parsing of interesing series reply structures
Daniel Axtens
dja at axtens.net
Thu Nov 17 16:11:59 AEDT 2016
There are some things you probably shouldn't do on public
mailing lists, but which people do anyway.
The first, and most understandable, is this:
- [PATCH 1/2] test: Add some lorem ipsum
- [PATCH 2/2] test: Convert to Markdown
- [PATCH v2 1/2] test: Add some lorem ipsum
- [PATCH v2 2/2] test: Convert to Markdown
We should correctly parse these by:
- creating a new series if the version number changes
- when deciding whether to create a SeriesReference, search by
message-id alone, not the message-id/series pair. (Otherwise,
we try to create a series ref for v1 2/2 in the series for v2,
which breaks a uniqueness constraint.
The second, and less excusable, is this:
- [PATCH 1/2] test: Add some lorem ipsum
- [PATCH 2/2] test: Convert to Markdown
- [PATCH 1/2] test: Add some lorem ipsum
- [PATCH 2/2] test: Convert to Markdown
With this patch:
- if we get a x/n for a series that already has an x/n, create a
new series for it.
Signed-off-by: Daniel Axtens <dja at axtens.net>
---
v2: - drop a hunk that I created during debugging but which was no
longer required.
- better support for the second scenario - I had mistakenly thought
it wouldn't work because of an earier typo.
---
patchwork/parser.py | 22 +-
patchwork/tests/series/bugs-nocover-noversion.mbox | 222 +++++++++++++++++++++
patchwork/tests/series/bugs-nocover.mbox | 222 +++++++++++++++++++++
patchwork/tests/test_series.py | 43 ++++
4 files changed, 507 insertions(+), 2 deletions(-)
create mode 100644 patchwork/tests/series/bugs-nocover-noversion.mbox
create mode 100644 patchwork/tests/series/bugs-nocover.mbox
diff --git a/patchwork/parser.py b/patchwork/parser.py
index b1544c951a3f..c7890ea18c2d 100644
--- a/patchwork/parser.py
+++ b/patchwork/parser.py
@@ -41,6 +41,7 @@ from patchwork.models import Person
from patchwork.models import Project
from patchwork.models import Series
from patchwork.models import SeriesReference
+from patchwork.models import SeriesPatch
from patchwork.models import State
from patchwork.models import Submission
@@ -789,7 +790,16 @@ def parse_mail(mail, list_id=None):
delegate = auto_delegate(project, filenames)
series = find_series(mail)
- if not series and n: # the series markers indicates a series
+ # We will create a new series if:
+ # - we have a patch number (x of n), and
+ # - either:
+ # * there is no series, or
+ # * the version doesn't match
+ # * we have a patch with this number already
+ if n and ((not series) or
+ (series.version != version) or
+ (SeriesPatch.objects.filter(series=series, number=x).count()
+ )):
series = Series(date=date,
submitter=author,
version=version,
@@ -803,7 +813,15 @@ def parse_mail(mail, list_id=None):
# as the earlier patch does not reference the later one.
for ref in refs + [msgid]:
# we don't want duplicates
- SeriesReference.objects.get_or_create(series=series, msgid=ref)
+ try:
+ # we could have a ref to a previous series. (For
+ # example, a series sent in reply to another
+ # series.) That should not create a series ref
+ # for this series, so check for the msg-id only,
+ # not the msg-id/series pair.
+ SeriesReference.objects.get(msgid=ref)
+ except SeriesReference.DoesNotExist:
+ SeriesReference.objects.create(series=series, msgid=ref)
patch = Patch(
msgid=msgid,
diff --git a/patchwork/tests/series/bugs-nocover-noversion.mbox b/patchwork/tests/series/bugs-nocover-noversion.mbox
new file mode 100644
index 000000000000..77308386f1bf
--- /dev/null
+++ b/patchwork/tests/series/bugs-nocover-noversion.mbox
@@ -0,0 +1,222 @@
+From stephenfinucane at gmail.com Sun Sep 11 23:22:13 2016
+Return-Path: <stephenfinucane at gmail.com>
+From: Stephen Finucane <stephenfinucane at gmail.com>
+To: stephenfinucane at hotmail.com
+Subject: [PATCH 1/2] test: Add some lorem ipsum
+Date: Sun, 11 Sep 2016 23:22:03 +0100
+Message-ID: <1473632524-8585-2-git-send-email-stephenfinucane at gmail.com>
+X-Mailer: git-send-email 2.7.4
+MIME-Version: 1.0
+Content-Type: text/plain
+Content-Length: 670
+Lines: 22
+
+From: Stephen Finucane <stephenfinucane at hotmail.com>
+
+---
+ test.txt | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/test.txt b/test.txt
+index f75ba05..a6c61c0 100644
+--- a/test.txt
++++ b/test.txt
+@@ -1 +1,8 @@
+ Hello, world.
++
++Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
++augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
++Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
++id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
++eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
++tellus commodo bibendum ut vel dolor.
+--
+2.7.4
+
+
+From stephenfinucane at gmail.com Sun Sep 11 23:22:16 2016
+Return-Path: <stephenfinucane at gmail.com>
+From: Stephen Finucane <stephenfinucane at gmail.com>
+To: stephenfinucane at hotmail.com
+Subject: [PATCH 2/2] test: Convert to Markdown
+Date: Sun, 11 Sep 2016 23:22:04 +0100
+Message-ID: <1473632524-8585-3-git-send-email-stephenfinucane at gmail.com>
+X-Mailer: git-send-email 2.7.4
+In-Reply-To: <1473632524-8585-2-git-send-email-stephenfinucane at gmail.com>
+References: <1473632524-8585-2-git-send-email-stephenfinucane at gmail.com>
+MIME-Version: 1.0
+Content-Type: text/plain
+Content-Length: 1345
+Lines: 40
+
+From: Stephen Finucane <stephenfinucane at hotmail.com>
+
+---
+ test.md | 8 ++++++++
+ test.txt | 8 --------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+ create mode 100644 test.md
+ delete mode 100644 test.txt
+
+diff --git a/test.md b/test.md
+new file mode 100644
+index 0000000..e5ff90e
+--- /dev/null
++++ b/test.md
+@@ -0,0 +1,8 @@
++# Hello, world
++
++Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
++augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
++Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
++id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
++eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
++tellus commodo bibendum ut vel dolor.
+diff --git a/test.txt b/test.txt
+deleted file mode 100644
+index a6c61c0..0000000
+--- a/test.txt
++++ /dev/null
+@@ -1,8 +0,0 @@
+-Hello, world.
+-
+-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
+-augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
+-Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
+-id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
+-eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
+-tellus commodo bibendum ut vel dolor.
+--
+2.7.4
+
+
+From stephenfinucane at gmail.com Sun Sep 11 23:31:04 2016
+Return-Path: <stephenfinucane at gmail.com>
+From: Stephen Finucane <stephenfinucane at gmail.com>
+To: stephenfinucane at hotmail.com
+Subject: [PATCH 1/2] test: Add some lorem ipsum
+Date: Sun, 11 Sep 2016 23:30:54 +0100
+Message-ID: <1473633055-10316-2-git-send-email-stephenfinucane at gmail.com>
+X-Mailer: git-send-email 2.7.4
+In-Reply-To: <1473632524-8585-2-git-send-email-stephenfinucane at gmail.com>
+References: <1473632524-8585-2-git-send-email-stephenfinucane at gmail.com>
+MIME-Version: 1.0
+Content-Type: text/plain
+Content-Length: 1363
+Lines: 35
+
+From: Stephen Finucane <stephenfinucane at hotmail.com>
+
+This is a better commit message.
+---
+v2:
+- Add some additional content
+---
+ test.txt | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/test.txt b/test.txt
+index f75ba05..4478ac2 100644
+--- a/test.txt
++++ b/test.txt
+@@ -1 +1,17 @@
+ Hello, world.
++
++Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
++augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
++Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
++id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
++eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
++tellus commodo bibendum ut vel dolor.
++
++Curabitur scelerisque tempus efficitur. Maecenas aliquet elementum quam, ac
++pharetra nisi gravida a. Nam vitae malesuada leo. Nam accumsan facilisis metus
++sed vulputate. Ut libero odio, tempor ac posuere vel, malesuada quis ex. Donec
++interdum ipsum et nibh molestie auctor eget in neque. Sed nec hendrerit enim.
++Etiam scelerisque non magna eu molestie. Maecenas dui quam, tempor quis ipsum
++eu, dapibus congue dui. Integer tincidunt accumsan tortor sed maximus. Praesent
++eu magna accumsan, consequat turpis quis, fringilla ante. Vestibulum nec
++maximus nulla. Donec vehicula nisl at pharetra eleifend.
+--
+2.7.4
+
+
+From stephenfinucane at gmail.com Sun Sep 11 23:31:07 2016
+Return-Path: <stephenfinucane at gmail.com>
+Received: from MARS.lan (host39-81.statics.netsource.ie. [212.17.39.81])
+ by smtp.gmail.com with ESMTPSA id e5sm14784082wma.13.2016.09.11.15.31.01
+ for <stephenfinucane at hotmail.com>
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
+ Sun, 11 Sep 2016 15:31:01 -0700 (PDT)
+From: Stephen Finucane <stephenfinucane at gmail.com>
+To: stephenfinucane at hotmail.com
+Subject: [PATCH 2/2] test: Convert to Markdown
+Date: Sun, 11 Sep 2016 23:30:55 +0100
+Message-ID: <1473633055-10316-3-git-send-email-stephenfinucane at gmail.com>
+X-Mailer: git-send-email 2.7.4
+In-Reply-To: <1473633055-10316-2-git-send-email-stephenfinucane at gmail.com>
+References: <1473633055-10316-2-git-send-email-stephenfinucane at gmail.com>
+MIME-Version: 1.0
+Content-Type: text/plain
+Content-Length: 2589
+Lines: 58
+
+From: Stephen Finucane <stephenfinucane at hotmail.com>
+
+---
+ test.md | 17 +++++++++++++++++
+ test.txt | 17 -----------------
+ 2 files changed, 17 insertions(+), 17 deletions(-)
+ create mode 100644 test.md
+ delete mode 100644 test.txt
+
+diff --git a/test.md b/test.md
+new file mode 100644
+index 0000000..201bfe7
+--- /dev/null
++++ b/test.md
+@@ -0,0 +1,17 @@
++# Hello, world
++
++Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
++augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
++Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
++id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
++eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
++tellus commodo bibendum ut vel dolor.
++
++Curabitur scelerisque tempus efficitur. Maecenas aliquet elementum quam, ac
++pharetra nisi gravida a. Nam vitae malesuada leo. Nam accumsan facilisis metus
++sed vulputate. Ut libero odio, tempor ac posuere vel, malesuada quis ex. Donec
++interdum ipsum et nibh molestie auctor eget in neque. Sed nec hendrerit enim.
++Etiam scelerisque non magna eu molestie. Maecenas dui quam, tempor quis ipsum
++eu, dapibus congue dui. Integer tincidunt accumsan tortor sed maximus. Praesent
++eu magna accumsan, consequat turpis quis, fringilla ante. Vestibulum nec
++maximus nulla. Donec vehicula nisl at pharetra eleifend.
+diff --git a/test.txt b/test.txt
+deleted file mode 100644
+index 4478ac2..0000000
+--- a/test.txt
++++ /dev/null
+@@ -1,17 +0,0 @@
+-Hello, world.
+-
+-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
+-augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
+-Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
+-id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
+-eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
+-tellus commodo bibendum ut vel dolor.
+-
+-Curabitur scelerisque tempus efficitur. Maecenas aliquet elementum quam, ac
+-pharetra nisi gravida a. Nam vitae malesuada leo. Nam accumsan facilisis metus
+-sed vulputate. Ut libero odio, tempor ac posuere vel, malesuada quis ex. Donec
+-interdum ipsum et nibh molestie auctor eget in neque. Sed nec hendrerit enim.
+-Etiam scelerisque non magna eu molestie. Maecenas dui quam, tempor quis ipsum
+-eu, dapibus congue dui. Integer tincidunt accumsan tortor sed maximus. Praesent
+-eu magna accumsan, consequat turpis quis, fringilla ante. Vestibulum nec
+-maximus nulla. Donec vehicula nisl at pharetra eleifend.
+--
+2.7.4
+
+
diff --git a/patchwork/tests/series/bugs-nocover.mbox b/patchwork/tests/series/bugs-nocover.mbox
new file mode 100644
index 000000000000..a433c7f06107
--- /dev/null
+++ b/patchwork/tests/series/bugs-nocover.mbox
@@ -0,0 +1,222 @@
+From stephenfinucane at gmail.com Sun Sep 11 23:22:13 2016
+Return-Path: <stephenfinucane at gmail.com>
+From: Stephen Finucane <stephenfinucane at gmail.com>
+To: stephenfinucane at hotmail.com
+Subject: [PATCH 1/2] test: Add some lorem ipsum
+Date: Sun, 11 Sep 2016 23:22:03 +0100
+Message-ID: <1473632524-8585-2-git-send-email-stephenfinucane at gmail.com>
+X-Mailer: git-send-email 2.7.4
+MIME-Version: 1.0
+Content-Type: text/plain
+Content-Length: 670
+Lines: 22
+
+From: Stephen Finucane <stephenfinucane at hotmail.com>
+
+---
+ test.txt | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/test.txt b/test.txt
+index f75ba05..a6c61c0 100644
+--- a/test.txt
++++ b/test.txt
+@@ -1 +1,8 @@
+ Hello, world.
++
++Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
++augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
++Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
++id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
++eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
++tellus commodo bibendum ut vel dolor.
+--
+2.7.4
+
+
+From stephenfinucane at gmail.com Sun Sep 11 23:22:16 2016
+Return-Path: <stephenfinucane at gmail.com>
+From: Stephen Finucane <stephenfinucane at gmail.com>
+To: stephenfinucane at hotmail.com
+Subject: [PATCH 2/2] test: Convert to Markdown
+Date: Sun, 11 Sep 2016 23:22:04 +0100
+Message-ID: <1473632524-8585-3-git-send-email-stephenfinucane at gmail.com>
+X-Mailer: git-send-email 2.7.4
+In-Reply-To: <1473632524-8585-2-git-send-email-stephenfinucane at gmail.com>
+References: <1473632524-8585-2-git-send-email-stephenfinucane at gmail.com>
+MIME-Version: 1.0
+Content-Type: text/plain
+Content-Length: 1345
+Lines: 40
+
+From: Stephen Finucane <stephenfinucane at hotmail.com>
+
+---
+ test.md | 8 ++++++++
+ test.txt | 8 --------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+ create mode 100644 test.md
+ delete mode 100644 test.txt
+
+diff --git a/test.md b/test.md
+new file mode 100644
+index 0000000..e5ff90e
+--- /dev/null
++++ b/test.md
+@@ -0,0 +1,8 @@
++# Hello, world
++
++Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
++augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
++Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
++id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
++eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
++tellus commodo bibendum ut vel dolor.
+diff --git a/test.txt b/test.txt
+deleted file mode 100644
+index a6c61c0..0000000
+--- a/test.txt
++++ /dev/null
+@@ -1,8 +0,0 @@
+-Hello, world.
+-
+-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
+-augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
+-Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
+-id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
+-eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
+-tellus commodo bibendum ut vel dolor.
+--
+2.7.4
+
+
+From stephenfinucane at gmail.com Sun Sep 11 23:31:04 2016
+Return-Path: <stephenfinucane at gmail.com>
+From: Stephen Finucane <stephenfinucane at gmail.com>
+To: stephenfinucane at hotmail.com
+Subject: [PATCH v2 1/2] test: Add some lorem ipsum
+Date: Sun, 11 Sep 2016 23:30:54 +0100
+Message-ID: <1473633055-10316-2-git-send-email-stephenfinucane at gmail.com>
+X-Mailer: git-send-email 2.7.4
+In-Reply-To: <1473632524-8585-2-git-send-email-stephenfinucane at gmail.com>
+References: <1473632524-8585-2-git-send-email-stephenfinucane at gmail.com>
+MIME-Version: 1.0
+Content-Type: text/plain
+Content-Length: 1363
+Lines: 35
+
+From: Stephen Finucane <stephenfinucane at hotmail.com>
+
+This is a better commit message.
+---
+v2:
+- Add some additional content
+---
+ test.txt | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/test.txt b/test.txt
+index f75ba05..4478ac2 100644
+--- a/test.txt
++++ b/test.txt
+@@ -1 +1,17 @@
+ Hello, world.
++
++Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
++augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
++Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
++id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
++eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
++tellus commodo bibendum ut vel dolor.
++
++Curabitur scelerisque tempus efficitur. Maecenas aliquet elementum quam, ac
++pharetra nisi gravida a. Nam vitae malesuada leo. Nam accumsan facilisis metus
++sed vulputate. Ut libero odio, tempor ac posuere vel, malesuada quis ex. Donec
++interdum ipsum et nibh molestie auctor eget in neque. Sed nec hendrerit enim.
++Etiam scelerisque non magna eu molestie. Maecenas dui quam, tempor quis ipsum
++eu, dapibus congue dui. Integer tincidunt accumsan tortor sed maximus. Praesent
++eu magna accumsan, consequat turpis quis, fringilla ante. Vestibulum nec
++maximus nulla. Donec vehicula nisl at pharetra eleifend.
+--
+2.7.4
+
+
+From stephenfinucane at gmail.com Sun Sep 11 23:31:07 2016
+Return-Path: <stephenfinucane at gmail.com>
+Received: from MARS.lan (host39-81.statics.netsource.ie. [212.17.39.81])
+ by smtp.gmail.com with ESMTPSA id e5sm14784082wma.13.2016.09.11.15.31.01
+ for <stephenfinucane at hotmail.com>
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
+ Sun, 11 Sep 2016 15:31:01 -0700 (PDT)
+From: Stephen Finucane <stephenfinucane at gmail.com>
+To: stephenfinucane at hotmail.com
+Subject: [PATCH v2 2/2] test: Convert to Markdown
+Date: Sun, 11 Sep 2016 23:30:55 +0100
+Message-ID: <1473633055-10316-3-git-send-email-stephenfinucane at gmail.com>
+X-Mailer: git-send-email 2.7.4
+In-Reply-To: <1473633055-10316-2-git-send-email-stephenfinucane at gmail.com>
+References: <1473633055-10316-2-git-send-email-stephenfinucane at gmail.com>
+MIME-Version: 1.0
+Content-Type: text/plain
+Content-Length: 2589
+Lines: 58
+
+From: Stephen Finucane <stephenfinucane at hotmail.com>
+
+---
+ test.md | 17 +++++++++++++++++
+ test.txt | 17 -----------------
+ 2 files changed, 17 insertions(+), 17 deletions(-)
+ create mode 100644 test.md
+ delete mode 100644 test.txt
+
+diff --git a/test.md b/test.md
+new file mode 100644
+index 0000000..201bfe7
+--- /dev/null
++++ b/test.md
+@@ -0,0 +1,17 @@
++# Hello, world
++
++Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
++augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
++Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
++id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
++eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
++tellus commodo bibendum ut vel dolor.
++
++Curabitur scelerisque tempus efficitur. Maecenas aliquet elementum quam, ac
++pharetra nisi gravida a. Nam vitae malesuada leo. Nam accumsan facilisis metus
++sed vulputate. Ut libero odio, tempor ac posuere vel, malesuada quis ex. Donec
++interdum ipsum et nibh molestie auctor eget in neque. Sed nec hendrerit enim.
++Etiam scelerisque non magna eu molestie. Maecenas dui quam, tempor quis ipsum
++eu, dapibus congue dui. Integer tincidunt accumsan tortor sed maximus. Praesent
++eu magna accumsan, consequat turpis quis, fringilla ante. Vestibulum nec
++maximus nulla. Donec vehicula nisl at pharetra eleifend.
+diff --git a/test.txt b/test.txt
+deleted file mode 100644
+index 4478ac2..0000000
+--- a/test.txt
++++ /dev/null
+@@ -1,17 +0,0 @@
+-Hello, world.
+-
+-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget eleifend
+-augue. Nullam at metus venenatis, laoreet neque nec, convallis mauris.
+-Pellentesque aliquam at nisi et laoreet. Duis non nisl venenatis, rhoncus risus
+-id, elementum felis. In hac habitasse platea dictumst. Nam sit amet maximus
+-eros. Nam quis ligula ut tortor egestas bibendum. Nunc sed purus sit amet
+-tellus commodo bibendum ut vel dolor.
+-
+-Curabitur scelerisque tempus efficitur. Maecenas aliquet elementum quam, ac
+-pharetra nisi gravida a. Nam vitae malesuada leo. Nam accumsan facilisis metus
+-sed vulputate. Ut libero odio, tempor ac posuere vel, malesuada quis ex. Donec
+-interdum ipsum et nibh molestie auctor eget in neque. Sed nec hendrerit enim.
+-Etiam scelerisque non magna eu molestie. Maecenas dui quam, tempor quis ipsum
+-eu, dapibus congue dui. Integer tincidunt accumsan tortor sed maximus. Praesent
+-eu magna accumsan, consequat turpis quis, fringilla ante. Vestibulum nec
+-maximus nulla. Donec vehicula nisl at pharetra eleifend.
+--
+2.7.4
+
+
diff --git a/patchwork/tests/test_series.py b/patchwork/tests/test_series.py
index 58abb0df303c..bf361a92761b 100644
--- a/patchwork/tests/test_series.py
+++ b/patchwork/tests/test_series.py
@@ -309,6 +309,49 @@ class RevisedSeriesTest(_BaseTestCase):
self.assertEqual(len([p for p in patches if not p.latest_series]), 1)
self.assertSerialized(covers, [1])
+ def test_reply_nocover_noversion(self):
+ """Series with a revision sent without a version label or cover
+ letter, in reply to earlier version of the same series.
+
+ Parse a series with two patches, followed by a second revision
+ of the same. The second revision is not labeled with a series
+ version marker.
+
+ This is really, really annoying and people shouldn't do it.
+
+ Input:
+
+ - [PATCH 1/2] test: Add some lorem ipsum
+ - [PATCH 2/2] test: Convert to Markdown
+ - [PATCH 1/2] test: Add some lorem ipsum
+ - [PATCH 2/2] test: Convert to Markdown
+
+ """
+ covers, patches, _ = self._parse_mbox(
+ 'bugs-nocover-noversion.mbox', [0, 4, 0])
+
+ self.assertSerialized(patches, [2, 2])
+
+ def test_reply_nocover(self):
+ """Series with a revision sent in-reply-to a patch, no cover letters.
+
+ Parse a series with two patches, followed by a second revision
+ of the same. The second revision is correctly labeled but is
+ sent in reply to the second patch of the first revision.
+
+ Input:
+
+ - [PATCH 1/2] test: Add some lorem ipsum
+ - [PATCH 2/2] test: Convert to Markdown
+ - [PATCH v2 1/2] test: Add some lorem ipsum
+ - [PATCH v2 2/2] test: Convert to Markdown
+
+ """
+ covers, patches, _ = self._parse_mbox(
+ 'bugs-nocover.mbox', [0, 4, 0])
+
+ self.assertSerialized(patches, [2, 2])
+
class SeriesNameTestCase(TestCase):
--
2.7.4
More information about the Patchwork
mailing list