Add query shorthands o,r,p,f
Bind shorthand operators for popular query expressions: o = owner r = reviewer p = project f = file Change-Id: I57d4592e0fca6f756d3afd01fa2262c2fb17465f
This commit is contained in:
parent
c3f9ab9f01
commit
f5c67c1cf8
@ -82,7 +82,7 @@ as a legacy numerical 'ID' such as 15183, or a newer style Change-Id
|
||||
that was scraped out of the commit message.
|
||||
|
||||
[[owner]]
|
||||
owner:'USER'::
|
||||
owner:'USER', o:'USER'::
|
||||
+
|
||||
Changes originally submitted by 'USER'. The special case of
|
||||
`owner:self` will find changes owned by the caller.
|
||||
@ -93,7 +93,7 @@ ownerin:'GROUP'::
|
||||
Changes originally submitted by a user in 'GROUP'.
|
||||
|
||||
[[reviewer]]
|
||||
reviewer:'USER'::
|
||||
reviewer:'USER', r:'USER'::
|
||||
+
|
||||
Changes that have been, or need to be, reviewed by 'USER'. The
|
||||
special case of `reviewer:self` will find changes where the caller
|
||||
@ -110,7 +110,7 @@ commit:'SHA1'::
|
||||
Changes where 'SHA1' is one of the patch sets of the change.
|
||||
|
||||
[[project]]
|
||||
project:'PROJECT'::
|
||||
project:'PROJECT', p:'PROJECT'::
|
||||
+
|
||||
Changes occurring in 'PROJECT'. If 'PROJECT' starts with `^` it
|
||||
matches project names by regular expression. The
|
||||
@ -187,13 +187,13 @@ comment:'TEXT'::
|
||||
Changes that match 'TEXT' string in any comment left by a reviewer.
|
||||
|
||||
[[file]]
|
||||
file:^'REGEX'::
|
||||
file:'PATH', f:'PATH'::
|
||||
+
|
||||
Matches any change where REGEX matches a file that was affected
|
||||
by the change. The regular expression pattern must start with
|
||||
`^`. For example, to match all XML files use `file:^.*\.xml$`.
|
||||
The link:http://www.brics.dk/automaton/[dk.brics.automaton
|
||||
library] is used for the evaluation of such patterns.
|
||||
Matches any change touching file at 'PATH'. By default exact path
|
||||
matching is used, but regular expressions can be enabled by starting
|
||||
with `^`. For example, to match all XML files use `file:^.*\.xml$`.
|
||||
The link:http://www.brics.dk/automaton/[dk.brics.automaton library]
|
||||
is used for the evaluation of such patterns.
|
||||
+
|
||||
The `^` required at the beginning of the regular expression not only
|
||||
denotes a regular expression, but it also has the usual meaning of
|
||||
|
@ -336,6 +336,11 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
args.conflictsCache, value, parseChange(value));
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> p(String name) {
|
||||
return project(name);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> project(String name) {
|
||||
if (name.startsWith("^"))
|
||||
@ -376,6 +381,11 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
return new RefPredicate(args.dbProvider, ref);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> f(String file) throws QueryParseException {
|
||||
return file(file);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> file(String file) throws QueryParseException {
|
||||
if (file.startsWith("^")) {
|
||||
@ -535,6 +545,12 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
return visibleto(currentUser);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> o(String who)
|
||||
throws QueryParseException, OrmException {
|
||||
return owner(who);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> owner(String who) throws QueryParseException,
|
||||
OrmException {
|
||||
@ -556,6 +572,12 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
return new OwnerinPredicate(args.dbProvider, args.userFactory, g.getUUID());
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> r(String who)
|
||||
throws QueryParseException, OrmException {
|
||||
return reviewer(who);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> reviewer(String who)
|
||||
throws QueryParseException, OrmException {
|
||||
|
Loading…
Reference in New Issue
Block a user