[Patchew-devel] [PATCH] models: refine diffstat regexes

Paolo Bonzini posted 1 patch 5 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew next tags/patchew/20190417061158.1404-1-pbonzini@redhat.com
api/models.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

[Patchew-devel] [PATCH] models: refine diffstat regexes

Posted by Paolo Bonzini 5 weeks ago
Avoid false positives by making the regexes more strict, and add
a new regex for binary diffs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 api/models.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/api/models.py b/api/models.py
index faae8c0..d2dafde 100644
--- a/api/models.py
+++ b/api/models.py
@@ -687,12 +687,15 @@ class Message(models.Model):
         cur = []
         patterns = [
             r"\S*\s*\|\s*[0-9]*( \+*-*)?$",
+            r"\S*\s*\|\s*Bin",
             r"\S* => \S*\s*|\s*[0-9]* \+*-*$",
             r"[0-9]* files changed",
             r"1 file changed",
             r"(create|delete) mode [0-7]+",
             r"mode change [0-7]+",
-            r"rename ",
+            r"rename .*\([0-9]+%\)$",
+            r"copy .*\([0-9]+%\)$",
+            r"rewrite .*\([0-9]+%\)$",
         ]
         ret = []
         for l in self.get_body().splitlines():
-- 
2.21.0

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel