Reuse the code_review_user Prolog rule across gerrit_owners.pl The condition of a user being the approver of a change is encapsulated in the code_review_user/1 rule and can be therefore reused across the whole gerrit_owners.pl for avoiding duplication of the logic for path and matchers' owners definition. Change-Id: I4f411f3b978e4547ebab7c0453321c36c38d6542
diff --git a/owners/src/main/prolog/gerrit_owners.pl b/owners/src/main/prolog/gerrit_owners.pl index 1fe2a22..b072e82 100644 --- a/owners/src/main/prolog/gerrit_owners.pl +++ b/owners/src/main/prolog/gerrit_owners.pl
@@ -38,8 +38,8 @@ add_owner_approval(_, In, Out) :- In = Out. owner_approved(Path) :- - owner(Path, User), - gerrit:commit_label(label('Code-Review', 2), User), + owner(Path, user(US)), + code_review_user(US), !. owner_approved(Users, Path) :-