Simplify the loop by using "for/else" and by assigning "ret = cur"
after every cur.append (instead of doing that on the first non-matching
line). Then it becomes simpler to add another loop break when a
diffstat was found and a "---" line is found.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
api/models.py | 12 ++++--------
tests/data/0029-diffstat-in-patch.gz | Bin 0 -> 13474 bytes
tests/test_model.py | 13 +++++++++++++
3 files changed, 17 insertions(+), 8 deletions(-)
create mode 100644 tests/data/0029-diffstat-in-patch.gz
diff --git a/api/models.py b/api/models.py
index 4e28614..d2dafde 100644
--- a/api/models.py
+++ b/api/models.py
@@ -700,19 +700,15 @@ class Message(models.Model):
ret = []
for l in self.get_body().splitlines():
line = l.strip()
- match = False
for p in patterns:
if re.match(p, line):
- match = True
+ cur.append(line)
+ ret = cur
break
- if match:
- cur.append(line)
else:
- if cur:
- ret = cur
cur = []
- if cur:
- ret = cur
+ if ret and re.match(r'--- \S', line):
+ break
return "\n".join(ret)
def get_message_view_url(self):
diff --git a/tests/data/0029-diffstat-in-patch.gz b/tests/data/0029-diffstat-in-patch.gz
new file mode 100644
index 0000000000000000000000000000000000000000..3086e492536f850d1b263504aacc700e5741b803
GIT binary patch
literal 13474
zcmV;TG+oOdiwFRh!nRxj1J%4~pPJedH~Kn$3f&IJVbcu=DA72A^E~T$j*864B;bVF
zpZzZEPSTxplHU71_r>jBI*qWZR#mMU{<Q=umZAA|V`Fe<|CHzaMbq*lDL+hnhEtyr
z(vQLj>7#g6KJXULK_la{U)D^+a(Js?G7c;8#|Og_eFL85!59u2_9~zKCS%+FsB1{Z
z18ZoX{hXmOvhFtoKVTv;j(672@wP1LjKkYt7V-f}q7O(q`GBT<e#Z8jyrs#G14OcU
zo#U;TpH*dEcOcpP@^*N}=jZhUuNo!~2|%4MFLFT~56(gxW3RKkUHCq8#xH@<U$hhQ
z@am+mxOXHlfy^?FZ0OK{xA&@JfA(vq2Tv2Af%-h~6StMMF9P@sj%`!;^8Zd<psnv6
zb^W&Hm=E5pA5#j5r7;$J7ba?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
z&wF6=H$?AuHa_U(0n9gpFYh3<KXx_IFFt|@|3Ut5ea`PC{-L4y=-{vI%Lm7M1K$z$
zS77(|gMUn9@5=By==x`Zk5BOphrT=Hm!<ccH$0EHd@FJPxL`%eFFw+9hTk&$M@8(5
zFPbKP!}6y}^5?qt#pg*%{=#X$r_Xn-_+xVX)1dE0{_Qw0AR!$eIoUQ<=KR=v-V1s^
z)!;9Q_BFw8ipBN5<KYdy$molGUdV2b;0(lZuj|zHx%$0kZp$(Wqv-oZ{^!ve4kPcU
z%vYnq#J|(>tESH-=_|n>N}{JJ82mNlf3L9whQn_Le^ub5>ZcWFzApD)1t))cO#u8;
zYKPw@_QZ?h{>lE&9+~(dG5<-2DDWgecHgW0Chh$>c2<>F&+q$>{`K2O)c=Zor_^lm
zzV-X^K7ohl2(ljp*|MD|2pGuQQAQt7?~Pc#)j#|3y?Lk4{l!S$i#WU{;_ao^Z#el^
Q?{)cq0G4j;9UEZ)0OoSojQ{`u
literal 0
HcmV?d00001
diff --git a/tests/test_model.py b/tests/test_model.py
index 3256b4c..333a7bc 100755
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -19,6 +19,7 @@ class ImportTest(PatchewTestCase):
self.create_superuser()
self.cli_login()
self.add_project("QEMU", "qemu-devel@nongnu.org")
+ self.add_project("Patchew", "patchew-devel@redhat.com")
def test_get_diff_stat(self):
expected = """
@@ -40,6 +41,18 @@ rename include/hw/{i2c => display}/i2c-ddc.h (100%)
self.maxDiff = 100000
self.assertMultiLineEqual(expected.strip(), msg.get_diff_stat())
+ def test_diff_stat_in_patch(self):
+ expected = """
+api/models.py | 4 +-
+tests/data/0008-complex-diffstat.mbox.gz | Bin 4961 -> 2575 bytes
+tests/test_model.py | 95 +++--------------------
+3 files changed, 15 insertions(+), 84 deletions(-)
+"""
+ self.cli_import("0029-diffstat-in-patch.gz")
+ msg = Message.objects.first()
+ self.maxDiff = 100000
+ self.assertMultiLineEqual(expected.strip(), msg.get_diff_stat())
+
def test_mode_change_diff_stat(self):
expected = """
tests/qemu-iotests/096 | 0
--
2.21.0
_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel
© 2016 - 2024 Red Hat, Inc.