blob: 4023a666d717518d191e5aaeb1ae2bc6dd0c634a [file] [log] [blame]
:- package gerrit_owners.
'$init'.
:- public add_owner_approval/2.
:- public add_owner_approval/3.
add_owner_approval(In, Out) :-
gerrit:commit_delta('.*', Type, Path, OldPath),
( Type == 'rename',
\+ owner_approved(OldPath);
\+ owner_approved(Path)
),
Out = [label('Owner-Approval', need(_)) | In],
!.
add_owner_approval(In, Out) :- In = Out.
add_owner_approval(Users, In, Out) :-
gerrit:commit_delta('.*' ,Type, Path, OldPath),
( Type == 'rename',
\+ owner_approved(Users, OldPath);
\+ owner_approved(Users, Path)
),
Out = [label('Owner-Approval', need(_)) | In],
!.
add_owner_approval(_, In, Out) :- In = Out.
owner_approved(Path) :-
owner(Path, User),
gerrit:commit_label(label('Code-Review', 2), User),
!.
owner_approved(Users, Path) :-
owner(Path, User),
member(User, Users),
!.
member(X, [X|_]).
member(X, [_|L]) :- member(X, L).