Support 'repo', 'repos' and 'parentrepo' as search operators
The new search operators are synonyms for the existing 'repository', 'repositories' and 'parentrepository' search operators. Supporting 'repo' in addition to 'repository' makes sense since the term 'repo' is also used in the UI. Bug: Issue 9775 Change-Id: I9b8bef425c55eb7c5d452c5a43fb4a6dbd9c7251 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -166,7 +166,7 @@ Changes occurring in 'PROJECT' or in one of the child projects of
|
||||
'PROJECT'.
|
||||
|
||||
[[repository]]
|
||||
repository:'REPOSITORY'::
|
||||
repository:'REPOSITORY', repo:'REPOSITORY'::
|
||||
+
|
||||
Changes occurring in 'REPOSITORY'. If 'REPOSITORY' starts with `^` it
|
||||
matches repository names by regular expression. The
|
||||
@@ -174,12 +174,12 @@ link:http://www.brics.dk/automaton/[dk.brics.automaton
|
||||
library] is used for evaluation of such patterns.
|
||||
|
||||
[[repositories]]
|
||||
repositories:'PREFIX'::
|
||||
repositories:'PREFIX', repos:'PREFIX'::
|
||||
+
|
||||
Changes occurring in repositories starting with 'PREFIX'.
|
||||
|
||||
[[parentrepository]]
|
||||
parentrepository:'REPOSITORY'::
|
||||
parentrepository:'REPOSITORY', parentrepo:'REPOSITORY'::
|
||||
+
|
||||
Changes occurring in 'REPOSITORY' or in one of the child repositories of
|
||||
'REPOSITORY'.
|
||||
|
@@ -672,6 +672,21 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
return parentproject(name);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> repo(String name) {
|
||||
return project(name);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> repos(String name) {
|
||||
return projects(name);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> parentrepo(String name) {
|
||||
return parentproject(name);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> branch(String name) {
|
||||
if (name.startsWith("^")) {
|
||||
|
@@ -840,6 +840,43 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
assertQuery("repositories:repo", change2, change1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byRepo() throws Exception {
|
||||
TestRepository<Repo> repo1 = createProject("repo1");
|
||||
TestRepository<Repo> repo2 = createProject("repo2");
|
||||
Change change1 = insert(repo1, newChange(repo1));
|
||||
Change change2 = insert(repo2, newChange(repo2));
|
||||
|
||||
assertQuery("repo:foo");
|
||||
assertQuery("repo:repo");
|
||||
assertQuery("repo:repo1", change1);
|
||||
assertQuery("repo:repo2", change2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byParentRepo() throws Exception {
|
||||
TestRepository<Repo> repo1 = createProject("repo1");
|
||||
TestRepository<Repo> repo2 = createProject("repo2", "repo1");
|
||||
Change change1 = insert(repo1, newChange(repo1));
|
||||
Change change2 = insert(repo2, newChange(repo2));
|
||||
|
||||
assertQuery("parentrepo:repo1", change2, change1);
|
||||
assertQuery("parentrepo:repo2", change2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byRepoPrefix() throws Exception {
|
||||
TestRepository<Repo> repo1 = createProject("repo1");
|
||||
TestRepository<Repo> repo2 = createProject("repo2");
|
||||
Change change1 = insert(repo1, newChange(repo1));
|
||||
Change change2 = insert(repo2, newChange(repo2));
|
||||
|
||||
assertQuery("repos:foo");
|
||||
assertQuery("repos:repo1", change1);
|
||||
assertQuery("repos:repo2", change2);
|
||||
assertQuery("repos:repo", change2, change1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byBranchAndRef() throws Exception {
|
||||
TestRepository<Repo> repo = createProject("repo");
|
||||
|
Reference in New Issue
Block a user