Add 'is:merge' operator to find changes which are merge commits

This change introduces a new index schema version and reindexing the
changes is required.

Change-Id: If800fce63f6d45419b46e5e624f6872ca3feaba3
This commit is contained in:
Saša Živkov
2015-11-04 15:12:34 +01:00
parent 49f32d5373
commit 71fd998560
6 changed files with 64 additions and 0 deletions

View File

@@ -284,6 +284,7 @@ public class ChangeData {
private Optional<ChangedLines> changedLines;
private SubmitTypeRecord submitTypeRecord;
private Boolean mergeable;
private Boolean merge;
private Set<String> hashtags;
private Map<Account.Id, Ref> editsByUser;
private Set<Account.Id> reviewedBy;
@@ -953,6 +954,16 @@ public class ChangeData {
return mergeable;
}
@Nullable
public Boolean isMerge() {
if (merge == null) {
if (!loadCommitData()) {
return null;
}
}
return parentCount > 1;
}
public Set<Account.Id> editsByUser() {
return editRefs().keySet();
}

View File

@@ -597,6 +597,13 @@ public class ChangeQueryBuilder extends QueryBuilder<ChangeData, ChangeQueryBuil
return new BooleanPredicate(ChangeField.MERGEABLE);
}
if ("merge".equalsIgnoreCase(value)) {
if (args.getSchema().hasField(ChangeField.MERGE)) {
return new BooleanPredicate(ChangeField.MERGE);
}
throw new QueryParseException("'is:merge' operator is not supported by change index version");
}
if ("private".equalsIgnoreCase(value)) {
if (args.getSchema().hasField(ChangeField.PRIVATE)) {
return new BooleanPredicate(ChangeField.PRIVATE);