Merge branch 'stable-2.13'

* stable-2.13:
  Fix comparison using reference equality instead of value equality
  Set version to 2.12.7
  Doc: Update avatar plugin links
  Revert "ListPlugins: Remove deprecated --format option"
  Set version to 2.13.3

Change-Id: Iae8df8ab247c47a6f0b6d082ddefb51acd6a1128
This commit is contained in:
David Pursehouse
2016-11-24 09:52:22 +09:00
3 changed files with 42 additions and 20 deletions

View File

@@ -164,24 +164,24 @@ link:https://gerrit.googlesource.com/plugins/admin-console/+doc/master/src/main/
Documentation]
[[avatars-external]]
=== avatars/external
=== avatars-external
This plugin allows to use an external url to load the avatar images
from.
link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/avatars/external[
link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/avatars-external[
Project] |
link:https://gerrit.googlesource.com/plugins/avatars/external/+doc/master/src/main/resources/Documentation/about.md[
link:https://gerrit.googlesource.com/plugins/avatars-external/+doc/master/src/main/resources/Documentation/about.md[
Documentation] |
link:https://gerrit.googlesource.com/plugins/avatars/external/+doc/master/src/main/resources/Documentation/config.md[
link:https://gerrit.googlesource.com/plugins/avatars-external/+doc/master/src/main/resources/Documentation/config.md[
Configuration]
[[avatars-gravatar]]
=== avatars/gravatar
=== avatars-gravatar
Plugin to display user icons from Gravatar.
link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/avatars/gravatar[
link:https://gerrit-review.googlesource.com/#/admin/projects/plugins/avatars-gravatar[
Project]
[[branch-network]]

View File

@@ -84,6 +84,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
/**
@@ -697,7 +698,7 @@ public class MergeUtil {
rw.markStart(mergeTip);
for (RevCommit c : alreadyAccepted) {
// If branch was not created by this submit.
if (c != mergeTip) {
if (!Objects.equals(c, mergeTip)) {
rw.markUninteresting(c);
}
}

View File

@@ -40,6 +40,10 @@ import java.util.TreeMap;
public class ListPlugins implements RestReadView<TopLevelResource> {
private final PluginLoader pluginLoader;
@Deprecated
@Option(name = "--format", usage = "(deprecated) output format")
private OutputFormat format = OutputFormat.TEXT;
@Option(name = "--all", aliases = {"-a"}, usage = "List all plugins, including disabled plugins")
private boolean all;
@@ -48,12 +52,23 @@ public class ListPlugins implements RestReadView<TopLevelResource> {
this.pluginLoader = pluginLoader;
}
public OutputFormat getFormat() {
return format;
}
public ListPlugins setFormat(OutputFormat fmt) {
this.format = fmt;
return this;
}
@Override
public Object apply(TopLevelResource resource) {
format = OutputFormat.JSON;
return display(null);
}
public JsonElement display(PrintWriter stdout) {
Map<String, PluginInfo> output = new TreeMap<>();
List<Plugin> plugins = Lists.newArrayList(pluginLoader.getPlugins(all));
Collections.sort(plugins, new Comparator<Plugin>() {
@Override
@@ -62,24 +77,30 @@ public class ListPlugins implements RestReadView<TopLevelResource> {
}
});
if (stdout == null) {
Map<String, PluginInfo> output = new TreeMap<>();
for (Plugin p : plugins) {
PluginInfo info = new PluginInfo(p);
if (!format.isJson()) {
stdout.format("%-30s %-10s %-8s %s\n", "Name", "Version", "Status", "File");
stdout.print("-------------------------------------------------------------------------------\n");
}
for (Plugin p : plugins) {
PluginInfo info = new PluginInfo(p);
if (format.isJson()) {
output.put(p.getName(), info);
} else {
stdout.format("%-30s %-10s %-8s %s\n", p.getName(),
Strings.nullToEmpty(info.version),
p.isDisabled() ? "DISABLED" : "ENABLED",
p.getSrcFile().getFileName());
}
}
if (stdout == null) {
return OutputFormat.JSON.newGson().toJsonTree(
output,
new TypeToken<Map<String, Object>>() {}.getType());
}
stdout.format("%-30s %-10s %-8s %s\n", "Name", "Version", "Status", "File");
stdout.print("-------------------------------------------------------------------------------\n");
for (Plugin p : plugins) {
PluginInfo info = new PluginInfo(p);
stdout.format("%-30s %-10s %-8s %s\n", p.getName(),
Strings.nullToEmpty(info.version),
p.isDisabled() ? "DISABLED" : "ENABLED",
p.getSrcFile().getFileName());
} else if (format.isJson()) {
format.newGson().toJson(output,
new TypeToken<Map<String, PluginInfo>>() {}.getType(), stdout);
stdout.print('\n');
}
stdout.flush();