Predicates to check commit messages and edits
Adds predicate commit_message that returns the commit message as a symbol.
commit_message_matches takes in a regex pattern and checks it against
the commit message, returns true if a match is found.
Adds predicate commit_edits that takes in a regex pattern for filenames
and a regex pattern for edits. For all files in a commit that match
the filename regex, if the edits in any of those files match the
edit regex, then the predicate returns true.
Change-Id: I1c0b5ddb669aaca77908e18d7bb314c5aa6aec70
(cherry picked from commit 0cec9e6f7f)
This commit is contained in:
committed by
Shawn O. Pearce
parent
971361ec66
commit
ac7d2f3448
@@ -394,3 +394,12 @@ split_commit_delta(rename, NewPath, OldPath, delete, OldPath).
|
||||
split_commit_delta(rename, NewPath, OldPath, add, NewPath) :- !.
|
||||
split_commit_delta(copy, NewPath, OldPath, add, NewPath) :- !.
|
||||
split_commit_delta(Type, Path, _, Type, Path).
|
||||
|
||||
|
||||
%% commit_message_matches/1:
|
||||
%%
|
||||
:- public commit_message_matches/1.
|
||||
%%
|
||||
commit_message_matches(Pattern) :-
|
||||
commit_message(Msg),
|
||||
regex_matches(Pattern, Msg).
|
||||
|
||||
Reference in New Issue
Block a user