Merge "Support 'repository' as query parameter in change queries"
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user