Support 'repository' as query parameter in change queries
The UI has migrated to use the term 'repository' instead of 'project'. We are following through by supporting this as an additional query term in change search. This commit adapts the docs and adds tests for the new parameter. Change-Id: Ie167fd4081e2739f96cf6cff95cb4c70c7dcc431
This commit is contained in:
parent
27248a912a
commit
0d08afcd4a
@ -165,6 +165,25 @@ parentproject:'PROJECT'::
|
||||
Changes occurring in 'PROJECT' or in one of the child projects of
|
||||
'PROJECT'.
|
||||
|
||||
[[repository]]
|
||||
repository:'REPOSITORY'::
|
||||
+
|
||||
Changes occurring in 'REPOSITORY'. If 'REPOSITORY' starts with `^` it
|
||||
matches repository names by regular expression. The
|
||||
link:http://www.brics.dk/automaton/[dk.brics.automaton
|
||||
library] is used for evaluation of such patterns.
|
||||
|
||||
[[repositories]]
|
||||
repositories:'PREFIX'::
|
||||
+
|
||||
Changes occurring in repositories starting with 'PREFIX'.
|
||||
|
||||
[[parentrepository]]
|
||||
parentrepository:'REPOSITORY'::
|
||||
+
|
||||
Changes occurring in 'REPOSITORY' or in one of the child repositories of
|
||||
'REPOSITORY'.
|
||||
|
||||
[[branch]]
|
||||
branch:'BRANCH'::
|
||||
+
|
||||
|
@ -657,6 +657,21 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData> {
|
||||
return new ParentProjectPredicate(args.projectCache, args.childProjects, name);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> repository(String name) {
|
||||
return project(name);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> repositories(String name) {
|
||||
return projects(name);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> parentrepository(String name) {
|
||||
return parentproject(name);
|
||||
}
|
||||
|
||||
@Operator
|
||||
public Predicate<ChangeData> branch(String name) {
|
||||
if (name.startsWith("^")) {
|
||||
|
@ -798,6 +798,43 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
assertQuery("projects:repo", change2, change1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byRepository() 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("repository:foo");
|
||||
assertQuery("repository:repo");
|
||||
assertQuery("repository:repo1", change1);
|
||||
assertQuery("repository:repo2", change2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byParentRepository() 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("parentrepository:repo1", change2, change1);
|
||||
assertQuery("parentrepository:repo2", change2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byRepositoryPrefix() 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("repositories:foo");
|
||||
assertQuery("repositories:repo1", change1);
|
||||
assertQuery("repositories:repo2", change2);
|
||||
assertQuery("repositories:repo", change2, change1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void byBranchAndRef() throws Exception {
|
||||
TestRepository<Repo> repo = createProject("repo");
|
||||
|
Loading…
Reference in New Issue
Block a user