Expose query submission ID to the user
As a follow-up for RevertSubmission (b81f56c469
), the users
could wish to know the changes of a certain submission if they
are considering to revert the entire submission, or if the submission
was already reverted and they wish to find it quickly.
Also, it is important for the frontend to know which changes belong
to a certain submission, so that they can suggest a better commit
message to the user when the user wants to revert a submission.
Change-Id: I337f7f8aeea2bc4146ed7e642f41c8710a153634
This commit is contained in:
@@ -140,6 +140,11 @@ revertof:'ID'::
|
||||
+
|
||||
Changes that revert the change specified by the numeric 'ID'.
|
||||
|
||||
[[submissionid]]
|
||||
submissionid:'ID'::
|
||||
+
|
||||
Changes that have the specified submission 'ID'.
|
||||
|
||||
[[reviewerin]]
|
||||
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");
|
||||
}
|
||||
|
||||
@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
|
||||
protected Predicate<ChangeData> defaultField(String query) throws QueryParseException {
|
||||
if (query.startsWith("refs/")) {
|
||||
|
@@ -2502,6 +2502,19 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
|
||||
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. */
|
||||
protected class DashboardChangeState {
|
||||
private final Account.Id ownerId;
|
||||
|
@@ -90,6 +90,7 @@
|
||||
'status:merged',
|
||||
'status:open',
|
||||
'status:reviewed',
|
||||
'submissionid:',
|
||||
'topic:',
|
||||
'tr:',
|
||||
];
|
||||
|
Reference in New Issue
Block a user