Merge branch 'stable-2.14' into stable-2.15

* stable-2.14:
  setup_gjf.sh: Add support for multiple version
  Set 2.13.12-SNAPSHOT in pom.xml and plugin documentation
  Clarify behavior of ownerin: and reviewerin: predicates
  AbstractElasticIndex: Open XContentBuilder in try-with-resource
  Docs: Clarify that for external groups the name in GroupInfo can be missing
  AccountGroupAuditLogScreen: Display group UUID if group name is missing
  GetAuditLog: Fix NPE if group UUID cannot be resolved
  Add ProjectCache.remove(Project.NameKey name) method
  Set version to 2.13.12-SNAPSHOT

Change-Id: I0f88a469f021abec24125cbb5c56415a26acb383
This commit is contained in:
David Pursehouse
2018-04-18 00:01:11 +02:00
4 changed files with 38 additions and 17 deletions

View File

@@ -108,7 +108,9 @@ Changes originally submitted by 'USER'. The special case of
[[ownerin]] [[ownerin]]
ownerin:'GROUP':: ownerin:'GROUP'::
+ +
Changes originally submitted by a user in 'GROUP'. Changes originally submitted by a user in 'GROUP'. When no other index
predicate is explicitly added in the query, defaults to only include
changes in status 'OPEN'.
[[query]] [[query]]
query:'NAME':: query:'NAME'::
@@ -137,7 +139,9 @@ Changes that revert the change specified by the numeric 'ID'.
[[reviewerin]] [[reviewerin]]
reviewerin:'GROUP':: reviewerin:'GROUP'::
+ +
Changes that have been, or need to be, reviewed by a user in 'GROUP'. Changes that have been, or need to be, reviewed by a user in 'GROUP'. When
no other index predicate is explicitly added in the query, defaults to only
include changes in status 'OPEN'.
[[commit]] [[commit]]
commit:'SHA1':: commit:'SHA1'::

View File

@@ -157,20 +157,23 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
} }
private String toDoc(V v) throws IOException { private String toDoc(V v) throws IOException {
XContentBuilder builder = jsonBuilder().startObject(); try (XContentBuilder builder = jsonBuilder().startObject()) {
for (Values<V> values : schema.buildFields(v)) { for (Values<V> values : schema.buildFields(v)) {
String name = values.getField().getName(); String name = values.getField().getName();
if (values.getField().isRepeatable()) { if (values.getField().isRepeatable()) {
builder.field( builder.field(
name, name,
Streams.stream(values.getValues()).filter(e -> shouldAddElement(e)).collect(toList())); Streams.stream(values.getValues())
} else { .filter(e -> shouldAddElement(e))
Object element = Iterables.getOnlyElement(values.getValues(), ""); .collect(toList()));
if (shouldAddElement(element)) { } else {
builder.field(name, element); Object element = Iterables.getOnlyElement(values.getValues(), "");
if (shouldAddElement(element)) {
builder.field(name, element);
}
} }
} }
return builder.endObject().string();
} }
return builder.endObject().string();
} }
} }

View File

@@ -748,6 +748,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
assertQuery("ownerin:Administrators", change1); assertQuery("ownerin:Administrators", change1);
assertQuery("ownerin:\"Registered Users\"", change2, change1); assertQuery("ownerin:\"Registered Users\"", change2, change1);
assertQuery("ownerin:\"Registered Users\" project:repo", change3, change2, change1);
assertQuery("ownerin:\"Registered Users\" status:merged", change3); assertQuery("ownerin:\"Registered Users\" status:merged", change3);
} }
@@ -1989,6 +1990,7 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests {
gApi.changes().id(change2.getId().get()).current().submit(); gApi.changes().id(change2.getId().get()).current().submit();
assertQuery("reviewerin:" + group); assertQuery("reviewerin:" + group);
assertQuery("project:repo reviewerin:" + group, change2);
assertQuery("status:merged reviewerin:" + group, change2); assertQuery("status:merged reviewerin:" + group, change2);
} }

View File

@@ -17,8 +17,20 @@
set -eu set -eu
# Keep this version in sync with dev-contributing.txt. # Keep this version in sync with dev-contributing.txt.
VERSION="1.3" VERSION=${1:-1.3}
SHA1="a73cfe6f9af01bd6ff150c0b50c9d620400f784c"
case "$VERSION" in
1.3)
SHA1="a73cfe6f9af01bd6ff150c0b50c9d620400f784c"
;;
1.5)
SHA1="b1f79e4d39a3c501f07c0ce7e8b03ac6964ed1f1"
;;
*)
echo "unknown google-java-format version: $VERSION"
exit 1
;;
esac
root="$(git rev-parse --show-toplevel)" root="$(git rev-parse --show-toplevel)"
if [[ -z "$root" ]]; then if [[ -z "$root" ]]; then
@@ -33,7 +45,7 @@ name="google-java-format-$VERSION-all-deps.jar"
url="https://github.com/google/google-java-format/releases/download/google-java-format-$VERSION/$name" url="https://github.com/google/google-java-format/releases/download/google-java-format-$VERSION/$name"
"$root/tools/download_file.py" -o "$dir/$name" -u "$url" -v "$SHA1" "$root/tools/download_file.py" -o "$dir/$name" -u "$url" -v "$SHA1"
launcher="$dir/google-java-format" launcher="$dir/google-java-format-$VERSION"
cat > "$launcher" <<EOF cat > "$launcher" <<EOF
#!/bin/bash #!/bin/bash
# #