Merge "Add a --no-limit option to the ssh and rest query commands"

This commit is contained in:
Martin Fick
2019-01-24 17:38:42 +00:00
committed by Gerrit Code Review
11 changed files with 89 additions and 4 deletions

View File

@@ -116,6 +116,7 @@ class ChangesImpl implements Changes {
}
qc.setLimit(q.getLimit());
qc.setStart(q.getStart());
qc.setNoLimit(q.getNoLimit());
for (ListChangesOption option : q.getOptions()) {
qc.addOption(option);
}

View File

@@ -124,16 +124,28 @@ public class Util {
public static PermissionRule allow(
ProjectConfig project, String capabilityName, AccountGroup.UUID group) {
return allow(project, capabilityName, group, (PermissionRange) null);
}
public static PermissionRule allow(
ProjectConfig project,
String capabilityName,
AccountGroup.UUID group,
PermissionRange customRange) {
PermissionRule rule = newRule(project, group);
project
.getAccessSection(AccessSection.GLOBAL_CAPABILITIES, true)
.getPermission(capabilityName, true)
.add(rule);
if (GlobalCapability.hasRange(capabilityName)) {
PermissionRange.WithDefaults range = GlobalCapability.getRange(capabilityName);
if (range != null) {
rule.setRange(range.getDefaultMin(), range.getDefaultMax());
if (customRange == null) {
PermissionRange.WithDefaults range = GlobalCapability.getRange(capabilityName);
if (range != null) {
rule.setRange(range.getDefaultMin(), range.getDefaultMax());
}
return rule;
}
rule.setRange(customRange.getMin(), customRange.getMax());
}
return rule;
}

View File

@@ -116,6 +116,10 @@ public class OutputStreamQuery {
queryProcessor.setUserProvidedLimit(n);
}
public void setNoLimit(boolean on) {
queryProcessor.setNoLimit(on);
}
public void setStart(int n) {
queryProcessor.setStart(n);
}

View File

@@ -82,6 +82,11 @@ public class QueryChanges implements RestReadView<TopLevelResource>, DynamicOpti
imp.setStart(start);
}
@Option(name = "--no-limit", usage = "Return all results, overriding the default limit")
public void setNoLimit(boolean on) {
imp.setNoLimit(on);
}
@Override
public void setDynamicBean(String plugin, DynamicOptions.DynamicBean dynamicBean) {
imp.setDynamicBean(plugin, dynamicBean);