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