diff options
author | James Moger <james.moger@gitblit.com> | 2014-04-17 23:03:34 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-04-17 23:08:07 -0400 |
commit | 80cf76b88cb9b9c1696c48fd418c0cdee995812c (patch) | |
tree | 972b4b5dc2fd76743f35747ea0c9b4389d8af922 /src/main/java/com/gitblit/transport/ssh/commands | |
parent | 6b254fe9f76c202065153ac045859b8434c81c73 (diff) | |
download | gitblit-80cf76b88cb9b9c1696c48fd418c0cdee995812c.tar.gz gitblit-80cf76b88cb9b9c1696c48fd418c0cdee995812c.zip |
Filter the current plugin release by the system version
Diffstat (limited to 'src/main/java/com/gitblit/transport/ssh/commands')
-rw-r--r-- | src/main/java/com/gitblit/transport/ssh/commands/PluginDispatcher.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/main/java/com/gitblit/transport/ssh/commands/PluginDispatcher.java b/src/main/java/com/gitblit/transport/ssh/commands/PluginDispatcher.java index 6f8f95ae..15345cac 100644 --- a/src/main/java/com/gitblit/transport/ssh/commands/PluginDispatcher.java +++ b/src/main/java/com/gitblit/transport/ssh/commands/PluginDispatcher.java @@ -259,10 +259,18 @@ public class PluginDispatcher extends DispatchCommand { } protected String buildFieldTable(PluginWrapper pw, PluginRegistration reg) { + Version system = getContext().getGitblit().getSystemVersion(); + PluginRelease current = reg == null ? null : reg.getCurrentRelease(system); + if (current == null) { + current = new PluginRelease(); + current.version = ""; + current.requires = ""; + } + final String id = pw == null ? reg.id : pw.getPluginId(); final String description = reg == null ? pw.getDescriptor().getPluginDescription() : reg.description; - final String version = pw == null ? reg.getCurrentRelease().version : pw.getDescriptor().getVersion().toString(); - final String requires = pw == null ? reg.getCurrentRelease().requires : pw.getDescriptor().getRequires().toString(); + final String version = pw == null ? current.version : pw.getDescriptor().getVersion().toString(); + final String requires = pw == null ? current.requires : pw.getDescriptor().getRequires().toString(); final String provider = pw == null ? reg.provider : pw.getDescriptor().getProvider(); final String registry = reg == null ? "" : reg.registry; final String path = pw == null ? "" : pw.getPluginPath(); @@ -470,10 +478,14 @@ public class PluginDispatcher extends DispatchCommand { String [] h = { "Id", "Installed", "Current", "Requires", "State" }; headers = h; } + Version system = getContext().getGitblit().getSystemVersion(); Object[][] data = new Object[list.size()][]; for (int i = 0; i < list.size(); i++) { PluginRegistration p = list.get(i); - PluginRelease curr = p.getCurrentRelease(); + PluginRelease curr = p.getCurrentRelease(system); + if (curr == null) { + curr = new PluginRelease(); + } if (verbose) { data[i] = new Object[] {p.id, p.description, p.installedRelease, curr.version, curr.requires, p.getInstallState(), p.registry}; } else { @@ -486,8 +498,12 @@ public class PluginDispatcher extends DispatchCommand { @Override protected void asTabbed(List<PluginRegistration> list) { + Version system = getContext().getGitblit().getSystemVersion(); for (PluginRegistration p : list) { - PluginRelease curr = p.getCurrentRelease(); + PluginRelease curr = p.getCurrentRelease(system); + if (curr == null) { + curr = new PluginRelease(); + } if (verbose) { outTabbed(p.id, p.description, p.installedRelease, curr.version, curr.requires, p.getInstallState(), p.provider, p.registry); } else { |