Reviewers plugin: filters

194 views
Skip to first unread message

Robert Mitwicki

unread,
Sep 3, 2015, 2:23:50 AM9/3/15
to Repo and Gerrit Discussion
Hi,

I am trying to use reviewers plugin but I am struggling with defining a proper filter.
The filter which I would like to define looks more less like this:

    file:^lib/.* AND NOT file:^lib/gen.*

When both of those paths are present in the commit I would expect that the reviewer will be added. But this never happen.
I tried to debug it and I found that mechanism behind those filters is similar to one which is used to parse search queries from the search input in gerrit.
The thing is that in the search query this filter works as expected.

Anyone have idea how to define the filter in the reviewers plugin to exclude paths?

Thanks
Best regards



David Ostrovsky

unread,
Sep 4, 2015, 6:58:36 AM9/4/15
to Repo and Gerrit Discussion

Am Donnerstag, 3. September 2015 08:23:50 UTC+2 schrieb Robert Mitwicki:
Hi,

I am trying to use reviewers plugin but I am struggling with defining a proper filter.
The filter which I would like to define looks more less like this:

    file:^lib/.* AND NOT file:^lib/gen.*

When both of those paths are present in the commit I would expect that the reviewer will be added.

Really? I would expect that "true and not true" predicate always evaluates to false
in both Gerrit UI and reviewer plugin (it reuses query engine as you have noticed).

Robert Mitwicki

unread,
Sep 9, 2015, 1:46:10 AM9/9/15
to Repo and Gerrit Discussion


On Friday, September 4, 2015 at 12:58:36 PM UTC+2, David Ostrovsky wrote:

Really? I would expect that "true and not true" predicate always evaluates to false
in both Gerrit UI and reviewer plugin (it reuses query engine as you have noticed).


Yep, this is why I was confuse at the beginning about the logic. In the plugin
it works according to logic and it is false but in Gerrit UI this one will be
true. As I found out the reason is that in the plugin there is no index (from
Lucene) involved and the predicates are not wrapped with it.

To achieve my goals I started implementing additional functionality in the
plugin. I am planing to add additional field like "excluded paths" were user
will be able to provide regex for the paths which he want to exclude from the
check. I think this is the only way to achieve that. If anyone will have any
other idea how to do it feel free to share. As soon as I will have something I
will share on gerrit.

Best regards
Robert

David Ostrovsky

unread,
Sep 9, 2015, 5:10:29 AM9/9/15
to Repo and Gerrit Discussion

Am Mittwoch, 9. September 2015 07:46:10 UTC+2 schrieb Robert Mitwicki:


On Friday, September 4, 2015 at 12:58:36 PM UTC+2, David Ostrovsky wrote:

Really? I would expect that "true and not true" predicate always evaluates to false
in both Gerrit UI and reviewer plugin (it reuses query engine as you have noticed).


Yep, this is why I was confuse at the beginning about the logic. In the plugin
it works according to logic and it is false but in Gerrit UI this one will be
true.

Oswald Buddenhagen

unread,
Sep 14, 2015, 2:59:29 PM9/14/15
to Repo and Gerrit Discussion
i don't know what's documented, but at face value the search expression
is ambiguous: it's not clear whether ALL instances of file: are applied
to each file at the same time or not - apparently, they aren't, and
robert would have to achieve his goal by using a single regex with a
negative look-ahead ... except that
https://code.google.com/p/gerrit/issues/detail?id=986 - too bad.

Robert Mitwicki

unread,
Sep 21, 2015, 1:57:24 AM9/21/15
to Repo and Gerrit Discussion
Thanks a lot for input.

I decided to go for with some additional functionality for the Reviewers plugins to achieve my goals.
I will do some filtering of the paths before applying search expression, to exclude the paths. which are not interested for me.

Best regards
Reply all
Reply to author
Forward
0 new messages