Add "aggressive" option to ssh command "GC"

When triggering a garbage collection through ssh it can be specified
whether to run an aggressive garbage collection or not.

Change-Id: Icfecc69915870289f5957912d3d53348f21a83f7
This commit is contained in:
Christian Halstrick 2015-03-11 15:14:40 +01:00
parent 2f94e2e562
commit 219f865fee
2 changed files with 9 additions and 1 deletions

View File

@ -8,6 +8,7 @@ gerrit gc - Run the Git garbage collection
'ssh' -p <port> <host> 'gerrit gc' 'ssh' -p <port> <host> 'gerrit gc'
[--all] [--all]
[--show-progress] [--show-progress]
[--aggressive]
<NAME> ... <NAME> ...
-- --
@ -44,6 +45,9 @@ This command is intended to be used in scripts.
--show-progress:: --show-progress::
If specified progress information is shown. If specified progress information is shown.
--aggressive::
If an aggressive garbage collection should be done.
== EXAMPLES == EXAMPLES
Run the Git garbage collection for the projects 'myProject' and Run the Git garbage collection for the projects 'myProject' and

View File

@ -46,6 +46,9 @@ public class GarbageCollectionCommand extends SshCommand {
@Option(name = "--show-progress", usage = "progress information is shown") @Option(name = "--show-progress", usage = "progress information is shown")
private boolean showProgress; private boolean showProgress;
@Option(name = "--aggressive", usage = "run aggressive garbage collection")
private boolean aggressive;
@Argument(index = 0, required = false, multiValued = true, metaVar = "NAME", @Argument(index = 0, required = false, multiValued = true, metaVar = "NAME",
usage = "projects for which the Git garbage collection should be run") usage = "projects for which the Git garbage collection should be run")
private List<ProjectControl> projects = new ArrayList<>(); private List<ProjectControl> projects = new ArrayList<>();
@ -85,7 +88,8 @@ public class GarbageCollectionCommand extends SshCommand {
} }
GarbageCollectionResult result = GarbageCollectionResult result =
garbageCollectionFactory.create().run(projectNames, showProgress ? stdout : null); garbageCollectionFactory.create().run(projectNames, aggressive,
showProgress ? stdout : null);
if (result.hasErrors()) { if (result.hasErrors()) {
for (GarbageCollectionResult.Error e : result.getErrors()) { for (GarbageCollectionResult.Error e : result.getErrors()) {
String msg; String msg;