Merge "Expose query submission ID to the user"
This commit is contained in:
@@ -140,6 +140,11 @@ revertof:'ID'::
|
|||||||
+
|
+
|
||||||
Changes that revert the change specified by the numeric 'ID'.
|
Changes that revert the change specified by the numeric 'ID'.
|
||||||
|
|
||||||
|
[[submissionid]]
|
||||||
|
submissionid:'ID'::
|
||||||
|
+
|
||||||
|
Changes that have the specified submission 'ID'.
|
||||||
|
|
||||||
[[reviewerin]]
|
[[reviewerin]]
|
||||||
reviewerin:'GROUP'::
|
reviewerin:'GROUP'::
|
||||||
+
|
+
|
||||||
|
@@ -1245,6 +1245,15 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData, ChangeQueryBuil
|
|||||||
throw new QueryParseException("'revertof' operator is not supported by change index version");
|
throw new QueryParseException("'revertof' operator is not supported by change index version");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operator
|
||||||
|
public Predicate<ChangeData> submissionId(String value) throws QueryParseException {
|
||||||
|
if (args.getSchema().hasField(ChangeField.SUBMISSIONID)) {
|
||||||
|
return new SubmissionIdPredicate(value);
|
||||||
|
}
|
||||||
|
throw new QueryParseException(
|
||||||
|
"'submissionid' operator is not supported by change index version");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Predicate<ChangeData> defaultField(String query) throws QueryParseException {
|
protected Predicate<ChangeData> defaultField(String query) throws QueryParseException {
|
||||||
if (query.startsWith("refs/")) {
|
if (query.startsWith("refs/")) {
|
||||||
|
@@ -2502,6 +2502,19 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
|||||||
assertQueryByIds("revertof:" + changeToRevert._number, Change.id(changeThatReverts._number));
|
assertQueryByIds("revertof:" + changeToRevert._number, Change.id(changeThatReverts._number));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void submissionId() throws Exception {
|
||||||
|
TestRepository<Repo> repo = createProject("repo");
|
||||||
|
Change change = insert(repo, newChange(repo));
|
||||||
|
// create irrelevant change
|
||||||
|
insert(repo, newChange(repo));
|
||||||
|
gApi.changes().id(change.getChangeId()).current().review(ReviewInput.approve());
|
||||||
|
gApi.changes().id(change.getChangeId()).current().submit();
|
||||||
|
String submissionId = gApi.changes().id(change.getChangeId()).get().submissionId;
|
||||||
|
|
||||||
|
assertQueryByIds("submissionid:" + submissionId, change.getId());
|
||||||
|
}
|
||||||
|
|
||||||
/** Change builder for helping in tests for dashboard sections. */
|
/** Change builder for helping in tests for dashboard sections. */
|
||||||
protected class DashboardChangeState {
|
protected class DashboardChangeState {
|
||||||
private final Account.Id ownerId;
|
private final Account.Id ownerId;
|
||||||
|
@@ -90,6 +90,7 @@
|
|||||||
'status:merged',
|
'status:merged',
|
||||||
'status:open',
|
'status:open',
|
||||||
'status:reviewed',
|
'status:reviewed',
|
||||||
|
'submissionid:',
|
||||||
'topic:',
|
'topic:',
|
||||||
'tr:',
|
'tr:',
|
||||||
];
|
];
|
||||||
|
Reference in New Issue
Block a user