The filtering was only applied if a target repo was provided in the
query parameters. Do it always (though really, what we should do
is not create a "pending" result if a target repo is not configured).
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
mods/git.py | 38 ++++++++++++++++++--------------------
1 file changed, 18 insertions(+), 20 deletions(-)
diff --git a/mods/git.py b/mods/git.py
index ea9fd54..bcaab7c 100644
--- a/mods/git.py
+++ b/mods/git.py
@@ -297,27 +297,25 @@ class GitModule(PatchewModule):
def pending_series(self, target_repo):
q = Message.objects.filter(results__name="git", results__status="pending")
- if target_repo is not None and target_repo != "":
- # Postgres could use JSON fields instead. Fortunately projects are
- # few so this is cheap
- def match_target_repo(config, target_repo):
- push_to = config.get("git", {}).get("push_to")
- if push_to is None:
- return False
- if target_repo[-1] != "/":
- return push_to == target_repo or push_to.startswith(
- target_repo + "/"
- )
- else:
- return push_to.startswith(target_repo)
- projects = Project.objects.values_list("id", "config").all()
- projects = [
- pid
- for pid, config in projects
- if match_target_repo(config, target_repo)
- ]
- q = q.filter(project__pk__in=projects)
+ # Postgres could use JSON fields instead. Fortunately projects are
+ # few so this is cheap
+ def match_target_repo(config, target_repo):
+ push_to = config.get("git", {}).get("push_to")
+ if push_to is None:
+ return False
+ if target_repo is None or target_repo == "":
+ return True
+ elif target_repo[-1] != "/":
+ return push_to == target_repo or push_to.startswith(target_repo + "/")
+ else:
+ return push_to.startswith(target_repo)
+
+ projects = Project.objects.values_list("id", "config").all()
+ projects = [
+ pid for pid, config in projects if match_target_repo(config, target_repo)
+ ]
+ q = q.filter(project__pk__in=projects)
return q
--
2.34.1
_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/patchew-devel