Reformat all Java files with google-java-format 1.6

Reformat all files with the exception of:

- lib/asciidoctor/java/AsciiDoctor.java

to avoid requiring the Library-Compliance label.

Change-Id: Iedba3f24ac00e2186e3e0688fabea817ddf43739
This commit is contained in:
David Pursehouse 2018-06-06 08:43:46 +09:00
parent 0f6c9bd34c
commit edc6a492a8
68 changed files with 639 additions and 818 deletions

View File

@ -47,9 +47,8 @@ public class UseGerritConfigAnnotationTest extends AbstractDaemonTest {
@Test
@GerritConfig(
name = "section.name",
values = {"value-1", "value-2"}
)
name = "section.name",
values = {"value-1", "value-2"})
public void testList() {
assertThat(cfg.getStringList("section", null, "name"))
.asList()
@ -58,9 +57,8 @@ public class UseGerritConfigAnnotationTest extends AbstractDaemonTest {
@Test
@GerritConfig(
name = "section.subsection.name",
values = {"value-1", "value-2"}
)
name = "section.subsection.name",
values = {"value-1", "value-2"})
public void testListWithSubsection() {
assertThat(cfg.getStringList("section", "subsection", "name"))
.asList()
@ -69,10 +67,9 @@ public class UseGerritConfigAnnotationTest extends AbstractDaemonTest {
@Test
@GerritConfig(
name = "section.name",
value = "value-1",
values = {"value-2", "value-3"}
)
name = "section.name",
value = "value-1",
values = {"value-2", "value-3"})
public void valueHasPrecedenceOverValues() {
assertThat(cfg.getStringList("section", null, "name")).asList().containsExactly("value-1");
}

View File

@ -57,10 +57,9 @@ public class UseGlobalPluginConfigAnnotationTest extends AbstractDaemonTest {
@Test
@UseLocalDisk
@GlobalPluginConfig(
pluginName = "test",
name = "section.name",
values = {"value-1", "value-2"}
)
pluginName = "test",
name = "section.name",
values = {"value-1", "value-2"})
public void testList() {
assertThat(cfg().getStringList("section", null, "name"))
.asList()
@ -70,10 +69,9 @@ public class UseGlobalPluginConfigAnnotationTest extends AbstractDaemonTest {
@Test
@UseLocalDisk
@GlobalPluginConfig(
pluginName = "test",
name = "section.subsection.name",
values = {"value-1", "value-2"}
)
pluginName = "test",
name = "section.subsection.name",
values = {"value-1", "value-2"})
public void testListWithSubsection() {
assertThat(cfg().getStringList("section", "subsection", "name"))
.asList()
@ -83,11 +81,10 @@ public class UseGlobalPluginConfigAnnotationTest extends AbstractDaemonTest {
@Test
@UseLocalDisk
@GlobalPluginConfig(
pluginName = "test",
name = "section.name",
value = "value-1",
values = {"value-2", "value-3"}
)
pluginName = "test",
name = "section.name",
value = "value-1",
values = {"value-2", "value-3"})
public void valueHasPrecedenceOverValues() {
assertThat(cfg().getStringList("section", null, "name")).asList().containsExactly("value-1");
}

View File

@ -57,9 +57,8 @@ public class ServerInfoIT extends AbstractDaemonTest {
// download
@GerritConfig(
name = "download.archive",
values = {"tar", "tbz2", "tgz", "txz"}
)
name = "download.archive",
values = {"tar", "tbz2", "tgz", "txz"})
// gerrit
@GerritConfig(name = "gerrit.allProjects", value = "Root")

View File

@ -47,9 +47,8 @@ public class ListMailFilterIT extends AbstractMailIT {
@Test
@GerritConfig(name = "receiveemail.filter.mode", value = "WHITELIST")
@GerritConfig(
name = "receiveemail.filter.patterns",
values = {".+ser@example\\.com", "a@b\\.com"}
)
name = "receiveemail.filter.patterns",
values = {".+ser@example\\.com", "a@b\\.com"})
public void listFilterWhitelistDoesNotFilterListedUser() throws Exception {
ChangeInfo changeInfo = createChangeAndReplyByEmail();
// Check that the comments from the email have been persisted
@ -60,9 +59,8 @@ public class ListMailFilterIT extends AbstractMailIT {
@Test
@GerritConfig(name = "receiveemail.filter.mode", value = "WHITELIST")
@GerritConfig(
name = "receiveemail.filter.patterns",
values = {".+@gerritcodereview\\.com", "a@b\\.com"}
)
name = "receiveemail.filter.patterns",
values = {".+@gerritcodereview\\.com", "a@b\\.com"})
public void listFilterWhitelistFiltersNotListedUser() throws Exception {
ChangeInfo changeInfo = createChangeAndReplyByEmail();
// Check that the comments from the email have NOT been persisted
@ -73,9 +71,8 @@ public class ListMailFilterIT extends AbstractMailIT {
@Test
@GerritConfig(name = "receiveemail.filter.mode", value = "BLACKLIST")
@GerritConfig(
name = "receiveemail.filter.patterns",
values = {".+@gerritcodereview\\.com", "a@b\\.com"}
)
name = "receiveemail.filter.patterns",
values = {".+@gerritcodereview\\.com", "a@b\\.com"})
public void listFilterBlacklistDoesNotFilterNotListedUser() throws Exception {
ChangeInfo changeInfo = createChangeAndReplyByEmail();
// Check that the comments from the email have been persisted
@ -86,9 +83,8 @@ public class ListMailFilterIT extends AbstractMailIT {
@Test
@GerritConfig(name = "receiveemail.filter.mode", value = "BLACKLIST")
@GerritConfig(
name = "receiveemail.filter.patterns",
values = {".+@example\\.com", "a@b\\.com"}
)
name = "receiveemail.filter.patterns",
values = {".+@example\\.com", "a@b\\.com"})
public void listFilterBlacklistFiltersListedUser() throws Exception {
ChangeInfo changeInfo = createChangeAndReplyByEmail();
// Check that the comments from the email have been persisted

View File

@ -56,9 +56,8 @@ public class UploadArchiveIT extends AbstractDaemonTest {
@Test
@GerritConfig(
name = "download.archive",
values = {"tar", "tbz2", "tgz", "txz"}
)
name = "download.archive",
values = {"tar", "tbz2", "tgz", "txz"})
public void zipFormatDisabled() throws Exception {
archiveNotPermitted();
}

View File

@ -154,10 +154,9 @@ public class Daemon extends SiteProgram {
private boolean polyGerritDev;
@Option(
name = "--init",
aliases = {"-i"},
usage = "Init site before starting the daemon"
)
name = "--init",
aliases = {"-i"},
usage = "Init site before starting the daemon")
private boolean doInit;
@Option(name = "--stop-only", usage = "Stop the daemon", hidden = true)

View File

@ -44,10 +44,9 @@ import org.kohsuke.args4j.Option;
/** Initialize a new Gerrit installation. */
public class Init extends BaseInit {
@Option(
name = "--batch",
aliases = {"-b"},
usage = "Batch mode; skip interactive prompting"
)
name = "--batch",
aliases = {"-b"},
usage = "Batch mode; skip interactive prompting")
private boolean batchMode;
@Option(name = "--delete-caches", usage = "Delete all persistent caches without asking")
@ -69,9 +68,8 @@ public class Init extends BaseInit {
private boolean installAllPlugins;
@Option(
name = "--secure-store-lib",
usage = "Path to jar providing SecureStore implementation class"
)
name = "--secure-store-lib",
usage = "Path to jar providing SecureStore implementation class")
private String secureStoreLib;
@Option(name = "--dev", usage = "Setup site with default options suitable for developers")

View File

@ -43,9 +43,8 @@ public class MigrateAccountPatchReviewDb extends SiteProgram {
private String sourceUrl;
@Option(
name = "--chunkSize",
usage = "chunk size of fetching from source and push to target on each time"
)
name = "--chunkSize",
usage = "chunk size of fetching from source and push to target on each time")
private static long chunkSize = 100000;
@Override

View File

@ -38,11 +38,10 @@ public class Passwd extends SiteProgram {
private String key;
@Argument(
metaVar = "SECTION.KEY",
index = 0,
required = true,
usage = "Section and key separated by a dot of the password to set"
)
metaVar = "SECTION.KEY",
index = 0,
required = true,
usage = "Section and key separated by a dot of the password to set")
private String sectionAndKey;
@Argument(metaVar = "PASSWORD", index = 1, required = false, usage = "Password to set")

View File

@ -32,12 +32,11 @@ import org.kohsuke.args4j.Option;
public class ProtoGen extends AbstractProgram {
@Option(
name = "--output",
aliases = {"-o"},
required = true,
metaVar = "FILE",
usage = "File to write .proto into"
)
name = "--output",
aliases = {"-o"},
required = true,
metaVar = "FILE",
usage = "File to write .proto into")
private File file;
@Override

View File

@ -65,12 +65,11 @@ import org.kohsuke.args4j.Option;
*/
public class ProtobufImport extends SiteProgram {
@Option(
name = "--file",
aliases = {"-f"},
required = true,
metaVar = "FILE",
usage = "File to import from"
)
name = "--file",
aliases = {"-f"},
required = true,
metaVar = "FILE",
usage = "File to import from")
private File file;
private final LifecycleManager manager = new LifecycleManager();

View File

@ -96,9 +96,8 @@ public class RebuildNoteDb extends SiteProgram {
private List<String> projects = new ArrayList<>();
@Option(
name = "--change",
usage = "Individual change numbers to rebuild; recommended for debugging only"
)
name = "--change",
usage = "Individual change numbers to rebuild; recommended for debugging only")
private List<Integer> changes = new ArrayList<>();
private Injector dbInjector;

View File

@ -57,9 +57,8 @@ public class Reindex extends SiteProgram {
private int threads = Runtime.getRuntime().availableProcessors();
@Option(
name = "--changes-schema-version",
usage = "Schema version to reindex, for changes; default is most recent version"
)
name = "--changes-schema-version",
usage = "Schema version to reindex, for changes; default is most recent version")
private Integer changesVersion;
@Option(name = "--verbose", usage = "Output debug information for each change")

View File

@ -44,11 +44,10 @@ public class Rulec extends SiteProgram {
private boolean quiet;
@Argument(
index = 0,
multiValued = true,
metaVar = "PROJECT",
usage = "project to compile rules for"
)
index = 0,
multiValued = true,
metaVar = "PROJECT",
usage = "project to compile rules for")
private List<String> projectNames = new ArrayList<>();
private Injector dbInjector;

View File

@ -57,10 +57,9 @@ public class SwitchSecureStore extends SiteProgram {
private static final Logger log = LoggerFactory.getLogger(SwitchSecureStore.class);
@Option(
name = "--new-secure-store-lib",
usage = "Path to new SecureStore implementation",
required = true
)
name = "--new-secure-store-lib",
usage = "Path to new SecureStore implementation",
required = true)
private String newSecureStoreLib;
@Override

View File

@ -64,10 +64,9 @@ import org.kohsuke.args4j.Option;
public abstract class SiteProgram extends AbstractProgram {
@Option(
name = "--site-path",
aliases = {"-d"},
usage = "Local directory containing site data"
)
name = "--site-path",
aliases = {"-d"},
usage = "Local directory containing site data")
private void setSitePath(String path) {
sitePath = Paths.get(path);
}

View File

@ -35,11 +35,10 @@ class ListMetrics implements RestReadView<ConfigResource> {
boolean dataOnly;
@Option(
name = "--prefix",
aliases = {"-p"},
metaVar = "PREFIX",
usage = "match metric by exact match or prefix"
)
name = "--prefix",
aliases = {"-p"},
metaVar = "PREFIX",
usage = "match metric by exact match or prefix")
List<String> query = new ArrayList<>();
@Inject

View File

@ -32,11 +32,10 @@ import org.kohsuke.args4j.Option;
public class ListAccess implements RestReadView<TopLevelResource> {
@Option(
name = "--project",
aliases = {"-p"},
metaVar = "PROJECT",
usage = "projects for which the access rights should be returned"
)
name = "--project",
aliases = {"-p"},
metaVar = "PROJECT",
usage = "projects for which the access rights should be returned")
private List<String> projects = new ArrayList<>();
private final GetAccess getAccess;

View File

@ -31,10 +31,9 @@ public class GetAvatar implements RestReadView<AccountResource> {
private int size;
@Option(
name = "--size",
aliases = {"-s"},
usage = "recommended size in pixels, height and width"
)
name = "--size",
aliases = {"-s"},
usage = "recommended size in pixels, height and width")
public void setSize(int s) {
size = s;
}

View File

@ -64,11 +64,10 @@ public class QueryAccounts implements RestReadView<TopLevelResource> {
}
@Option(
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of users to return"
)
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of users to return")
public void setLimit(int n) {
queryProcessor.setLimit(n);
@ -92,21 +91,19 @@ public class QueryAccounts implements RestReadView<TopLevelResource> {
}
@Option(
name = "--query",
aliases = {"-q"},
metaVar = "QUERY",
usage = "match users"
)
name = "--query",
aliases = {"-q"},
metaVar = "QUERY",
usage = "match users")
public void setQuery(String query) {
this.query = query;
}
@Option(
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "Number of accounts to skip"
)
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "Number of accounts to skip")
public void setStart(int start) {
this.start = start;
}

View File

@ -375,10 +375,9 @@ public class ChangeEdits
private final FileContentUtil fileContentUtil;
@Option(
name = "--base",
aliases = {"-b"},
usage = "whether to load the content on the base revision instead of the change edit"
)
name = "--base",
aliases = {"-b"},
usage = "whether to load the content on the base revision instead of the change edit")
private boolean base;
@Inject
@ -476,10 +475,9 @@ public class ChangeEdits
private final ChangeEditUtil editUtil;
@Option(
name = "--base",
aliases = {"-b"},
usage = "whether to load the message on the base revision instead of the change edit"
)
name = "--base",
aliases = {"-b"},
usage = "whether to load the message on the base revision instead of the change edit")
private boolean base;
@Inject

View File

@ -59,12 +59,11 @@ public class GetBlame implements RestReadView<FileResource> {
private final AutoMerger autoMerger;
@Option(
name = "--base",
aliases = {"-b"},
usage =
"whether to load the blame of the base revision (the direct"
+ " parent of the change) instead of the change"
)
name = "--base",
aliases = {"-b"},
usage =
"whether to load the blame of the base revision (the direct"
+ " parent of the change) instead of the change")
private boolean base;
@Inject

View File

@ -53,10 +53,9 @@ public class Mergeable implements RestReadView<RevisionResource> {
private static final Logger log = LoggerFactory.getLogger(Mergeable.class);
@Option(
name = "--other-branches",
aliases = {"-o"},
usage = "test mergeability for other branches too"
)
name = "--other-branches",
aliases = {"-o"},
usage = "test mergeability for other branches too")
private boolean otherBranches;
private final GitRepositoryManager gitManager;

View File

@ -39,10 +39,9 @@ public class SuggestChangeReviewers extends SuggestReviewers
implements RestReadView<ChangeResource> {
@Option(
name = "--exclude-groups",
aliases = {"-e"},
usage = "exclude groups from query"
)
name = "--exclude-groups",
aliases = {"-e"},
usage = "exclude groups from query")
boolean excludeGroups;
private final Provider<CurrentUser> self;

View File

@ -39,21 +39,19 @@ public class SuggestReviewers {
protected final int maxSuggestedReviewers;
@Option(
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of reviewers to list"
)
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of reviewers to list")
public void setLimit(int l) {
this.limit = l <= 0 ? maxSuggestedReviewers : Math.min(l, maxSuggestedReviewers);
}
@Option(
name = "--query",
aliases = {"-q"},
metaVar = "QUERY",
usage = "match reviewers query"
)
name = "--query",
aliases = {"-q"},
metaVar = "QUERY",
usage = "match reviewers query")
public void setQuery(String q) {
this.query = q;
}

View File

@ -1275,10 +1275,9 @@ public class ReceiveCommits {
boolean draft;
@Option(
name = "--edit",
aliases = {"-e"},
usage = "upload as change edit"
)
name = "--edit",
aliases = {"-e"},
usage = "upload as change edit")
boolean edit;
@Option(name = "--submit", usage = "immediately submit the change")
@ -1288,12 +1287,11 @@ public class ReceiveCommits {
boolean merged;
@Option(
name = "--notify",
usage =
"Notify handling that defines to whom email notifications "
+ "should be sent. Allowed values are NONE, OWNER, "
+ "OWNER_REVIEWERS, ALL. If not set, the default is ALL."
)
name = "--notify",
usage =
"Notify handling that defines to whom email notifications "
+ "should be sent. Allowed values are NONE, OWNER, "
+ "OWNER_REVIEWERS, ALL. If not set, the default is ALL.")
NotifyHandling notify = NotifyHandling.ALL;
@Option(name = "--notify-to", metaVar = "USER", usage = "user that should be notified")
@ -1306,11 +1304,10 @@ public class ReceiveCommits {
List<Account.Id> bccs = new ArrayList<>();
@Option(
name = "--reviewer",
aliases = {"-r"},
metaVar = "EMAIL",
usage = "add reviewer to changes"
)
name = "--reviewer",
aliases = {"-r"},
metaVar = "EMAIL",
usage = "add reviewer to changes")
void reviewer(Account.Id id) {
reviewer.add(id);
}
@ -1326,11 +1323,10 @@ public class ReceiveCommits {
}
@Option(
name = "--label",
aliases = {"-l"},
metaVar = "LABEL+VALUE",
usage = "label(s) to assign (defaults to +1 if no value provided"
)
name = "--label",
aliases = {"-l"},
metaVar = "LABEL+VALUE",
usage = "label(s) to assign (defaults to +1 if no value provided")
void addLabel(String token) throws CmdLineException {
LabelVote v = LabelVote.parse(token);
try {
@ -1343,22 +1339,20 @@ public class ReceiveCommits {
}
@Option(
name = "--message",
aliases = {"-m"},
metaVar = "MESSAGE",
usage = "Comment message to apply to the review"
)
name = "--message",
aliases = {"-m"},
metaVar = "MESSAGE",
usage = "Comment message to apply to the review")
void addMessage(final String token) {
// git push does not allow spaces in refs.
message = token.replace("_", " ");
}
@Option(
name = "--hashtag",
aliases = {"-t"},
metaVar = "HASHTAG",
usage = "add hashtag to changes"
)
name = "--hashtag",
aliases = {"-t"},
metaVar = "HASHTAG",
usage = "add hashtag to changes")
void addHashtag(String token) throws CmdLineException {
if (!notesMigration.readChanges()) {
throw clp.reject("cannot add hashtags; noteDb is disabled");

View File

@ -80,37 +80,33 @@ public class ListGroups implements RestReadView<TopLevelResource> {
private String suggest;
@Option(
name = "--project",
aliases = {"-p"},
usage = "projects for which the groups should be listed"
)
name = "--project",
aliases = {"-p"},
usage = "projects for which the groups should be listed")
public void addProject(ProjectControl project) {
projects.add(project);
}
@Option(
name = "--visible-to-all",
usage = "to list only groups that are visible to all registered users"
)
name = "--visible-to-all",
usage = "to list only groups that are visible to all registered users")
public void setVisibleToAll(boolean visibleToAll) {
this.visibleToAll = visibleToAll;
}
@Option(
name = "--user",
aliases = {"-u"},
usage = "user for which the groups should be listed"
)
name = "--user",
aliases = {"-u"},
usage = "user for which the groups should be listed")
public void setUser(Account.Id user) {
this.user = user;
}
@Option(
name = "--owned",
usage =
"to list only groups that are owned by the"
+ " specified user or by the calling user if no user was specifed"
)
name = "--owned",
usage =
"to list only groups that are owned by the"
+ " specified user or by the calling user if no user was specifed")
public void setOwned(boolean owned) {
this.owned = owned;
}
@ -123,58 +119,52 @@ public class ListGroups implements RestReadView<TopLevelResource> {
*/
@Deprecated
@Option(
name = "--query",
aliases = {"-q"},
usage = "group to inspect (deprecated: use --group/-g instead)"
)
name = "--query",
aliases = {"-q"},
usage = "group to inspect (deprecated: use --group/-g instead)")
void addGroup_Deprecated(AccountGroup.UUID uuid) {
addGroup(uuid);
}
@Option(
name = "--group",
aliases = {"-g"},
usage = "group to inspect"
)
name = "--group",
aliases = {"-g"},
usage = "group to inspect")
public void addGroup(AccountGroup.UUID uuid) {
groupsToInspect.add(uuid);
}
@Option(
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of groups to list"
)
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of groups to list")
public void setLimit(int limit) {
this.limit = limit;
}
@Option(
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "number of groups to skip"
)
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "number of groups to skip")
public void setStart(int start) {
this.start = start;
}
@Option(
name = "--match",
aliases = {"-m"},
metaVar = "MATCH",
usage = "match group substring"
)
name = "--match",
aliases = {"-m"},
metaVar = "MATCH",
usage = "match group substring")
public void setMatchSubstring(String matchSubstring) {
this.matchSubstring = matchSubstring;
}
@Option(
name = "--suggest",
aliases = {"-s"},
usage = "to get a suggestion of groups"
)
name = "--suggest",
aliases = {"-s"},
usage = "to get a suggestion of groups")
public void setSuggest(String suggest) {
this.suggest = suggest;
}

View File

@ -52,30 +52,27 @@ public class QueryGroups implements RestReadView<TopLevelResource> {
// removed we want to rename --query2 to --query here.
/** --query (-q) is already used by {@link ListGroups} */
@Option(
name = "--query2",
aliases = {"-q2"},
usage = "group query"
)
name = "--query2",
aliases = {"-q2"},
usage = "group query")
public void setQuery(String query) {
this.query = query;
}
@Option(
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of groups to list"
)
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of groups to list")
public void setLimit(int limit) {
this.limit = limit;
}
@Option(
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "number of groups to skip"
)
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "number of groups to skip")
public void setStart(int start) {
this.start = start;
}

View File

@ -44,10 +44,9 @@ public class ListPlugins implements RestReadView<TopLevelResource> {
private OutputFormat format = OutputFormat.TEXT;
@Option(
name = "--all",
aliases = {"-a"},
usage = "List all plugins, including disabled plugins"
)
name = "--all",
aliases = {"-a"},
usage = "List all plugins, including disabled plugins")
private boolean all;
@Inject

View File

@ -46,23 +46,21 @@ public class CheckMergeability implements RestReadView<BranchResource> {
private final Provider<ReviewDb> db;
@Option(
name = "--source",
metaVar = "COMMIT",
usage =
"the source reference to merge, which could be any git object "
+ "references expression, refer to "
+ "org.eclipse.jgit.lib.Repository#resolve(String)",
required = true
)
name = "--source",
metaVar = "COMMIT",
usage =
"the source reference to merge, which could be any git object "
+ "references expression, refer to "
+ "org.eclipse.jgit.lib.Repository#resolve(String)",
required = true)
public void setSource(String source) {
this.source = source;
}
@Option(
name = "--strategy",
metaVar = "STRATEGY",
usage = "name of the merge strategy, refer to org.eclipse.jgit.merge.MergeStrategy"
)
name = "--strategy",
metaVar = "STRATEGY",
usage = "name of the merge strategy, refer to org.eclipse.jgit.merge.MergeStrategy")
public void setStrategy(String strategy) {
this.strategy = strategy;
}

View File

@ -37,37 +37,34 @@ public class GetReflog implements RestReadView<BranchResource> {
private final GitRepositoryManager repoManager;
@Option(
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of reflog entries to list"
)
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of reflog entries to list")
public GetReflog setLimit(int limit) {
this.limit = limit;
return this;
}
@Option(
name = "--from",
metaVar = "TIMESTAMP",
usage =
"timestamp from which the reflog entries should be listed (UTC, format: "
+ TimestampHandler.TIMESTAMP_FORMAT
+ ")"
)
name = "--from",
metaVar = "TIMESTAMP",
usage =
"timestamp from which the reflog entries should be listed (UTC, format: "
+ TimestampHandler.TIMESTAMP_FORMAT
+ ")")
public GetReflog setFrom(Timestamp from) {
this.from = from;
return this;
}
@Option(
name = "--to",
metaVar = "TIMESTAMP",
usage =
"timestamp until which the reflog entries should be listed (UTC, format: "
+ TimestampHandler.TIMESTAMP_FORMAT
+ ")"
)
name = "--to",
metaVar = "TIMESTAMP",
usage =
"timestamp until which the reflog entries should be listed (UTC, format: "
+ TimestampHandler.TIMESTAMP_FORMAT
+ ")")
public GetReflog setTo(Timestamp to) {
this.to = to;
return this;

View File

@ -51,41 +51,37 @@ public class ListBranches implements RestReadView<ProjectResource> {
private final WebLinks webLinks;
@Option(
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of branches to list"
)
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of branches to list")
public void setLimit(int limit) {
this.limit = limit;
}
@Option(
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "number of branches to skip"
)
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "number of branches to skip")
public void setStart(int start) {
this.start = start;
}
@Option(
name = "--match",
aliases = {"-m"},
metaVar = "MATCH",
usage = "match branches substring"
)
name = "--match",
aliases = {"-m"},
metaVar = "MATCH",
usage = "match branches substring")
public void setMatchSubstring(String matchSubstring) {
this.matchSubstring = matchSubstring;
}
@Option(
name = "--regex",
aliases = {"-r"},
metaVar = "REGEX",
usage = "match branches regex"
)
name = "--regex",
aliases = {"-r"},
metaVar = "REGEX",
usage = "match branches regex")
public void setMatchRegex(String matchRegex) {
this.matchRegex = matchRegex;
}

View File

@ -118,21 +118,19 @@ public class ListProjects implements RestReadView<TopLevelResource> {
private OutputFormat format = OutputFormat.TEXT;
@Option(
name = "--show-branch",
aliases = {"-b"},
usage = "displays the sha of each project in the specified branch"
)
name = "--show-branch",
aliases = {"-b"},
usage = "displays the sha of each project in the specified branch")
public void addShowBranch(String branch) {
showBranch.add(branch);
}
@Option(
name = "--tree",
aliases = {"-t"},
usage =
"displays project inheritance in a tree-like format\n"
+ "this option does not work together with the show-branch option"
)
name = "--tree",
aliases = {"-t"},
usage =
"displays project inheritance in a tree-like format\n"
+ "this option does not work together with the show-branch option")
public void setShowTree(boolean showTree) {
this.showTree = showTree;
}
@ -143,10 +141,9 @@ public class ListProjects implements RestReadView<TopLevelResource> {
}
@Option(
name = "--description",
aliases = {"-d"},
usage = "include description of project in list"
)
name = "--description",
aliases = {"-d"},
usage = "include description of project in list")
public void setShowDescription(boolean showDescription) {
this.showDescription = showDescription;
}
@ -157,41 +154,37 @@ public class ListProjects implements RestReadView<TopLevelResource> {
}
@Option(
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of projects to list"
)
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of projects to list")
public void setLimit(int limit) {
this.limit = limit;
}
@Option(
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "number of projects to skip"
)
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "number of projects to skip")
public void setStart(int start) {
this.start = start;
}
@Option(
name = "--prefix",
aliases = {"-p"},
metaVar = "PREFIX",
usage = "match project prefix"
)
name = "--prefix",
aliases = {"-p"},
metaVar = "PREFIX",
usage = "match project prefix")
public void setMatchPrefix(String matchPrefix) {
this.matchPrefix = matchPrefix;
}
@Option(
name = "--match",
aliases = {"-m"},
metaVar = "MATCH",
usage = "match project substring"
)
name = "--match",
aliases = {"-m"},
metaVar = "MATCH",
usage = "match project substring")
public void setMatchSubstring(String matchSubstring) {
this.matchSubstring = matchSubstring;
}
@ -202,10 +195,9 @@ public class ListProjects implements RestReadView<TopLevelResource> {
}
@Option(
name = "--has-acl-for",
metaVar = "GROUP",
usage = "displays only projects on which access rights for this group are directly assigned"
)
name = "--has-acl-for",
metaVar = "GROUP",
usage = "displays only projects on which access rights for this group are directly assigned")
public void setGroupUuid(AccountGroup.UUID groupUuid) {
this.groupUuid = groupUuid;
}

View File

@ -59,41 +59,37 @@ public class ListTags implements RestReadView<ProjectResource> {
private final WebLinks links;
@Option(
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of tags to list"
)
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "maximum number of tags to list")
public void setLimit(int limit) {
this.limit = limit;
}
@Option(
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "number of tags to skip"
)
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "number of tags to skip")
public void setStart(int start) {
this.start = start;
}
@Option(
name = "--match",
aliases = {"-m"},
metaVar = "MATCH",
usage = "match tags substring"
)
name = "--match",
aliases = {"-m"},
metaVar = "MATCH",
usage = "match tags substring")
public void setMatchSubstring(String matchSubstring) {
this.matchSubstring = matchSubstring;
}
@Option(
name = "--regex",
aliases = {"-r"},
metaVar = "REGEX",
usage = "match tags regex"
)
name = "--regex",
aliases = {"-r"},
metaVar = "REGEX",
usage = "match tags regex")
public void setMatchRegex(String matchRegex) {
this.matchRegex = matchRegex;
}

View File

@ -46,19 +46,17 @@ public class QueryChanges implements RestReadView<TopLevelResource> {
private EnumSet<ListChangesOption> options;
@Option(
name = "--query",
aliases = {"-q"},
metaVar = "QUERY",
usage = "Query string"
)
name = "--query",
aliases = {"-q"},
metaVar = "QUERY",
usage = "Query string")
private List<String> queries;
@Option(
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "Maximum number of results to return"
)
name = "--limit",
aliases = {"-n"},
metaVar = "CNT",
usage = "Maximum number of results to return")
public void setLimit(int limit) {
imp.setLimit(limit);
}
@ -74,11 +72,10 @@ public class QueryChanges implements RestReadView<TopLevelResource> {
}
@Option(
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "Number of changes to skip"
)
name = "--start",
aliases = {"-S"},
metaVar = "CNT",
usage = "Number of changes to skip")
public void setStart(int start) {
imp.setStart(start);
}

View File

@ -44,41 +44,36 @@ import org.slf4j.LoggerFactory;
@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
@CommandMetaData(
name = "set-project-parent",
description = "Change the project permissions are inherited from"
)
name = "set-project-parent",
description = "Change the project permissions are inherited from")
final class AdminSetParent extends SshCommand {
private static final Logger log = LoggerFactory.getLogger(AdminSetParent.class);
@Option(
name = "--parent",
aliases = {"-p"},
metaVar = "NAME",
usage = "new parent project"
)
name = "--parent",
aliases = {"-p"},
metaVar = "NAME",
usage = "new parent project")
private ProjectControl newParent;
@Option(
name = "--children-of",
metaVar = "NAME",
usage = "parent project for which the child projects should be reparented"
)
name = "--children-of",
metaVar = "NAME",
usage = "parent project for which the child projects should be reparented")
private ProjectControl oldParent;
@Option(
name = "--exclude",
metaVar = "NAME",
usage = "child project of old parent project which should not be reparented"
)
name = "--exclude",
metaVar = "NAME",
usage = "child project of old parent project which should not be reparented")
private List<ProjectControl> excludedChildren = new ArrayList<>();
@Argument(
index = 0,
required = false,
multiValued = true,
metaVar = "NAME",
usage = "projects to modify"
)
index = 0,
required = false,
multiValued = true,
metaVar = "NAME",
usage = "projects to modify")
private List<ProjectControl> children = new ArrayList<>();
@Inject private ProjectCache projectCache;

View File

@ -27,10 +27,9 @@ import java.util.List;
import org.kohsuke.args4j.Argument;
@CommandMetaData(
name = "apropos",
description = "Search in Gerrit documentation",
runsAt = MASTER_OR_SLAVE
)
name = "apropos",
description = "Search in Gerrit documentation",
runsAt = MASTER_OR_SLAVE)
final class AproposCommand extends SshCommand {
@Inject private QueryDocumentationExecutor searcher;
@Inject @CanonicalWebUrl String url;

View File

@ -34,34 +34,30 @@ import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option;
@CommandMetaData(
name = "ban-commit",
description = "Ban a commit from a project's repository",
runsAt = MASTER
)
name = "ban-commit",
description = "Ban a commit from a project's repository",
runsAt = MASTER)
public class BanCommitCommand extends SshCommand {
@Option(
name = "--reason",
aliases = {"-r"},
metaVar = "REASON",
usage = "reason for banning the commit"
)
name = "--reason",
aliases = {"-r"},
metaVar = "REASON",
usage = "reason for banning the commit")
private String reason;
@Argument(
index = 0,
required = true,
metaVar = "PROJECT",
usage = "name of the project for which the commit should be banned"
)
index = 0,
required = true,
metaVar = "PROJECT",
usage = "name of the project for which the commit should be banned")
private ProjectControl projectControl;
@Argument(
index = 1,
required = true,
multiValued = true,
metaVar = "COMMIT",
usage = "commit(s) that should be banned"
)
index = 1,
required = true,
multiValued = true,
metaVar = "COMMIT",
usage = "commit(s) that should be banned")
private List<ObjectId> commitsToBan = new ArrayList<>();
@Inject private BanCommit banCommit;

View File

@ -42,17 +42,15 @@ abstract class BaseTestPrologCommand extends SshCommand {
protected String changeId;
@Option(
name = "-s",
usage =
"Read prolog script from stdin instead of reading rules.pl from the refs/meta/config branch"
)
name = "-s",
usage =
"Read prolog script from stdin instead of reading rules.pl from the refs/meta/config branch")
protected boolean useStdin;
@Option(
name = "--no-filters",
aliases = {"-n"},
usage = "Don't run the submit_filter/2 from the parent projects"
)
name = "--no-filters",
aliases = {"-n"},
usage = "Don't run the submit_filter/2 from the parent projects")
void setNoFilters(boolean no) {
input.filters = no ? Filters.SKIP : Filters.RUN;
}

View File

@ -40,10 +40,9 @@ import org.slf4j.LoggerFactory;
@AdminHighPriorityCommand
@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
@CommandMetaData(
name = "close-connection",
description = "Close the specified SSH connection",
runsAt = MASTER_OR_SLAVE
)
name = "close-connection",
description = "Close the specified SSH connection",
runsAt = MASTER_OR_SLAVE)
final class CloseConnection extends SshCommand {
private static final Logger log = LoggerFactory.getLogger(CloseConnection.class);
@ -51,12 +50,11 @@ final class CloseConnection extends SshCommand {
@Inject private SshDaemon sshDaemon;
@Argument(
index = 0,
multiValued = true,
required = true,
metaVar = "SESSION_ID",
usage = "List of SSH session IDs to be closed"
)
index = 0,
multiValued = true,
required = true,
metaVar = "SESSION_ID",
usage = "List of SSH session IDs to be closed")
private final List<String> sessionIds = new ArrayList<>();
@Option(name = "--wait", usage = "wait for connection to close before exiting")

View File

@ -42,11 +42,10 @@ import org.kohsuke.args4j.Option;
@CommandMetaData(name = "create-account", description = "Create a new batch/role account")
final class CreateAccountCommand extends SshCommand {
@Option(
name = "--group",
aliases = {"-g"},
metaVar = "GROUP",
usage = "groups to add account to"
)
name = "--group",
aliases = {"-g"},
metaVar = "GROUP",
usage = "groups to add account to")
private List<AccountGroup.Id> groups = new ArrayList<>();
@Option(name = "--full-name", metaVar = "NAME", usage = "display name of the account")
@ -59,10 +58,9 @@ final class CreateAccountCommand extends SshCommand {
private String sshKey;
@Option(
name = "--http-password",
metaVar = "PASSWORD",
usage = "password for HTTP authentication"
)
name = "--http-password",
metaVar = "PASSWORD",
usage = "password for HTTP authentication")
private String httpPassword;
@Argument(index = 0, required = true, metaVar = "USERNAME", usage = "name of the user account")

View File

@ -34,11 +34,10 @@ public final class CreateBranchCommand extends SshCommand {
private String name;
@Argument(
index = 2,
required = true,
metaVar = "REVISION",
usage = "base revision of the new branch"
)
index = 2,
required = true,
metaVar = "REVISION",
usage = "base revision of the new branch")
private String revision;
@Inject GerritApi gApi;

View File

@ -49,19 +49,17 @@ import org.kohsuke.args4j.Option;
@CommandMetaData(name = "create-group", description = "Create a new account group")
final class CreateGroupCommand extends SshCommand {
@Option(
name = "--owner",
aliases = {"-o"},
metaVar = "GROUP",
usage = "owning group, if not specified the group will be self-owning"
)
name = "--owner",
aliases = {"-o"},
metaVar = "GROUP",
usage = "owning group, if not specified the group will be self-owning")
private AccountGroup.Id ownerGroupId;
@Option(
name = "--description",
aliases = {"-d"},
metaVar = "DESC",
usage = "description of group"
)
name = "--description",
aliases = {"-d"},
metaVar = "DESC",
usage = "description of group")
private String groupDescription = "";
@Argument(index = 0, required = true, metaVar = "GROUP", usage = "name of group to be created")
@ -70,11 +68,10 @@ final class CreateGroupCommand extends SshCommand {
private final Set<Account.Id> initialMembers = new HashSet<>();
@Option(
name = "--member",
aliases = {"-m"},
metaVar = "USERNAME",
usage = "initial set of users to become members of the group"
)
name = "--member",
aliases = {"-m"},
metaVar = "USERNAME",
usage = "initial set of users to become members of the group")
void addMember(final Account.Id id) {
initialMembers.add(id);
}
@ -85,11 +82,10 @@ final class CreateGroupCommand extends SshCommand {
private final Set<AccountGroup.UUID> initialGroups = new HashSet<>();
@Option(
name = "--group",
aliases = "-g",
metaVar = "GROUP",
usage = "initial set of groups to be included in the group"
)
name = "--group",
aliases = "-g",
metaVar = "GROUP",
usage = "initial set of groups to be included in the group")
void addGroup(final AccountGroup.UUID id) {
initialGroups.add(id);
}

View File

@ -42,50 +42,44 @@ import org.kohsuke.args4j.Option;
/** Create a new project. * */
@RequiresCapability(GlobalCapability.CREATE_PROJECT)
@CommandMetaData(
name = "create-project",
description = "Create a new project and associated Git repository"
)
name = "create-project",
description = "Create a new project and associated Git repository")
final class CreateProjectCommand extends SshCommand {
@Option(
name = "--suggest-parents",
aliases = {"-S"},
usage =
"suggest parent candidates, "
+ "if this option is used all other options and arguments are ignored"
)
name = "--suggest-parents",
aliases = {"-S"},
usage =
"suggest parent candidates, "
+ "if this option is used all other options and arguments are ignored")
private boolean suggestParent;
@Option(
name = "--owner",
aliases = {"-o"},
usage = "owner(s) of project"
)
name = "--owner",
aliases = {"-o"},
usage = "owner(s) of project")
private List<AccountGroup.UUID> ownerIds;
@Option(
name = "--parent",
aliases = {"-p"},
metaVar = "NAME",
usage = "parent project"
)
name = "--parent",
aliases = {"-p"},
metaVar = "NAME",
usage = "parent project")
private ProjectControl newParent;
@Option(name = "--permissions-only", usage = "create project for use only as parent")
private boolean permissionsOnly;
@Option(
name = "--description",
aliases = {"-d"},
metaVar = "DESCRIPTION",
usage = "description of project"
)
name = "--description",
aliases = {"-d"},
metaVar = "DESCRIPTION",
usage = "description of project")
private String projectDescription = "";
@Option(
name = "--submit-type",
aliases = {"-t"},
usage = "project submit type"
)
name = "--submit-type",
aliases = {"-t"},
usage = "project submit type")
private SubmitType submitType;
@Option(name = "--contributor-agreements", usage = "if contributor agreement is required")
@ -101,25 +95,22 @@ final class CreateProjectCommand extends SshCommand {
private InheritableBoolean requireChangeID = InheritableBoolean.INHERIT;
@Option(
name = "--new-change-for-all-not-in-target",
usage = "if a new change will be created for every commit not in target branch"
)
name = "--new-change-for-all-not-in-target",
usage = "if a new change will be created for every commit not in target branch")
private InheritableBoolean createNewChangeForAllNotInTarget = InheritableBoolean.INHERIT;
@Option(
name = "--use-contributor-agreements",
aliases = {"--ca"},
usage = "if contributor agreement is required"
)
name = "--use-contributor-agreements",
aliases = {"--ca"},
usage = "if contributor agreement is required")
void setUseContributorArgreements(@SuppressWarnings("unused") boolean on) {
contributorAgreements = InheritableBoolean.TRUE;
}
@Option(
name = "--use-signed-off-by",
aliases = {"--so"},
usage = "if signed-off-by is required"
)
name = "--use-signed-off-by",
aliases = {"--so"},
usage = "if signed-off-by is required")
void setUseSignedOffBy(@SuppressWarnings("unused") boolean on) {
signedOffBy = InheritableBoolean.TRUE;
}
@ -130,29 +121,26 @@ final class CreateProjectCommand extends SshCommand {
}
@Option(
name = "--require-change-id",
aliases = {"--id"},
usage = "if change-id is required"
)
name = "--require-change-id",
aliases = {"--id"},
usage = "if change-id is required")
void setRequireChangeId(@SuppressWarnings("unused") boolean on) {
requireChangeID = InheritableBoolean.TRUE;
}
@Option(
name = "--create-new-change-for-all-not-in-target",
aliases = {"--ncfa"},
usage = "if a new change will be created for every commit not in target branch"
)
name = "--create-new-change-for-all-not-in-target",
aliases = {"--ncfa"},
usage = "if a new change will be created for every commit not in target branch")
void setNewChangeForAllNotInTarget(@SuppressWarnings("unused") boolean on) {
createNewChangeForAllNotInTarget = InheritableBoolean.TRUE;
}
@Option(
name = "--branch",
aliases = {"-b"},
metaVar = "BRANCH",
usage = "initial branch name\n(default: master)"
)
name = "--branch",
aliases = {"-b"},
metaVar = "BRANCH",
usage = "initial branch name\n(default: master)")
private List<String> branch;
@Option(name = "--empty-commit", usage = "to create initial empty commit")
@ -162,9 +150,8 @@ final class CreateProjectCommand extends SshCommand {
private String maxObjectSizeLimit;
@Option(
name = "--plugin-config",
usage = "plugin configuration parameter with format '<plugin-name>.<parameter-name>=<value>'"
)
name = "--plugin-config",
usage = "plugin configuration parameter with format '<plugin-name>.<parameter-name>=<value>'")
private List<String> pluginConfigValues;
@Argument(index = 0, metaVar = "NAME", usage = "name of project to be created")

View File

@ -36,10 +36,9 @@ import org.kohsuke.args4j.Option;
/** Causes the caches to purge all entries and reload. */
@RequiresAnyCapability({FLUSH_CACHES, MAINTAIN_SERVER})
@CommandMetaData(
name = "flush-caches",
description = "Flush some/all server caches from memory",
runsAt = MASTER_OR_SLAVE
)
name = "flush-caches",
description = "Flush some/all server caches from memory",
runsAt = MASTER_OR_SLAVE)
final class FlushCaches extends SshCommand {
@Option(name = "--cache", usage = "flush named cache", metaVar = "NAME")
private List<String> caches = new ArrayList<>();

View File

@ -48,12 +48,11 @@ public class GarbageCollectionCommand extends SshCommand {
private boolean aggressive;
@Argument(
index = 0,
required = false,
multiValued = true,
metaVar = "NAME",
usage = "projects for which the Git garbage collection should be run"
)
index = 0,
required = false,
multiValued = true,
metaVar = "NAME",
usage = "projects for which the Git garbage collection should be run")
private List<ProjectControl> projects = new ArrayList<>();
@Inject private ProjectCache projectCache;

View File

@ -35,12 +35,11 @@ final class IndexChangesCommand extends SshCommand {
@Inject private ChangeArgumentParser changeArgumentParser;
@Argument(
index = 0,
required = true,
multiValued = true,
metaVar = "CHANGE",
usage = "changes to index"
)
index = 0,
required = true,
multiValued = true,
metaVar = "CHANGE",
usage = "changes to index")
void addChange(String token) {
try {
changeArgumentParser.addChange(token, changes, null, false);

View File

@ -34,12 +34,11 @@ final class IndexProjectCommand extends SshCommand {
@Inject private Index index;
@Argument(
index = 0,
required = true,
multiValued = true,
metaVar = "PROJECT",
usage = "projects for which the changes should be indexed"
)
index = 0,
required = true,
multiValued = true,
metaVar = "PROJECT",
usage = "projects for which the changes should be indexed")
private List<ProjectControl> projects = new ArrayList<>();
@Override

View File

@ -39,10 +39,9 @@ import java.io.PrintWriter;
import org.kohsuke.args4j.Option;
@CommandMetaData(
name = "ls-groups",
description = "List groups visible to the caller",
runsAt = MASTER_OR_SLAVE
)
name = "ls-groups",
description = "List groups visible to the caller",
runsAt = MASTER_OR_SLAVE)
public class ListGroupsCommand extends SshCommand {
@Inject private MyListGroups impl;
@ -61,13 +60,12 @@ public class ListGroupsCommand extends SshCommand {
private static class MyListGroups extends ListGroups {
@Option(
name = "--verbose",
aliases = {"-v"},
usage =
"verbose output format with tab-separated columns for the "
+ "group name, UUID, description, owner group name, "
+ "owner group UUID, and whether the group is visible to all"
)
name = "--verbose",
aliases = {"-v"},
usage =
"verbose output format with tab-separated columns for the "
+ "group name, UUID, description, owner group name, "
+ "owner group UUID, and whether the group is visible to all")
private boolean verboseOutput;
@Inject

View File

@ -29,10 +29,9 @@ import org.kohsuke.args4j.Argument;
@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
@CommandMetaData(
name = "ls-level",
description = "list the level of loggers",
runsAt = MASTER_OR_SLAVE
)
name = "ls-level",
description = "list the level of loggers",
runsAt = MASTER_OR_SLAVE)
public class ListLoggingLevelCommand extends SshCommand {
@Argument(index = 0, required = false, metaVar = "NAME", usage = "used to match loggers")

View File

@ -35,10 +35,9 @@ import org.kohsuke.args4j.Argument;
/** Implements a command that allows the user to see the members of a group. */
@CommandMetaData(
name = "ls-members",
description = "List the members of a given group",
runsAt = MASTER_OR_SLAVE
)
name = "ls-members",
description = "List the members of a given group",
runsAt = MASTER_OR_SLAVE)
public class ListMembersCommand extends SshCommand {
@Inject ListMembersCommandImpl impl;

View File

@ -23,10 +23,9 @@ import com.google.inject.Inject;
import java.util.List;
@CommandMetaData(
name = "ls-projects",
description = "List projects visible to the caller",
runsAt = MASTER_OR_SLAVE
)
name = "ls-projects",
description = "List projects visible to the caller",
runsAt = MASTER_OR_SLAVE)
final class ListProjectsCommand extends SshCommand {
@Inject private ListProjects impl;

View File

@ -44,10 +44,9 @@ import org.kohsuke.args4j.Option;
@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
@CommandMetaData(
name = "ls-user-refs",
description = "List refs visible to a specific user",
runsAt = MASTER_OR_SLAVE
)
name = "ls-user-refs",
description = "List refs visible to a specific user",
runsAt = MASTER_OR_SLAVE)
public class LsUserRefs extends SshCommand {
@Inject private AccountResolver accountResolver;
@ -62,21 +61,19 @@ public class LsUserRefs extends SshCommand {
@Inject @Nullable private SearchingChangeCacheImpl changeCache;
@Option(
name = "--project",
aliases = {"-p"},
metaVar = "PROJECT",
required = true,
usage = "project for which the refs should be listed"
)
name = "--project",
aliases = {"-p"},
metaVar = "PROJECT",
required = true,
usage = "project for which the refs should be listed")
private ProjectControl projectControl;
@Option(
name = "--user",
aliases = {"-u"},
metaVar = "USER",
required = true,
usage = "user for which the groups should be listed"
)
name = "--user",
aliases = {"-u"},
metaVar = "USER",
required = true,
usage = "user for which the groups should be listed")
private String userName;
@Option(name = "--only-refs-heads", usage = "list only refs under refs/heads")

View File

@ -37,10 +37,9 @@ import org.kohsuke.args4j.Option;
@CommandMetaData(name = "install", description = "Install/Add a plugin", runsAt = MASTER_OR_SLAVE)
final class PluginInstallCommand extends SshCommand {
@Option(
name = "--name",
aliases = {"-n"},
usage = "install under name"
)
name = "--name",
aliases = {"-n"},
usage = "install under name")
private String name;
@Option(name = "-")

View File

@ -43,9 +43,8 @@ class Query extends SshCommand {
}
@Option(
name = "--all-approvals",
usage = "Include information about all patch sets and approvals"
)
name = "--all-approvals",
usage = "Include information about all patch sets and approvals")
void setApprovals(boolean on) {
if (on) {
processor.setIncludePatchSets(on);
@ -84,21 +83,19 @@ class Query extends SshCommand {
}
@Option(
name = "--start",
aliases = {"-S"},
usage = "Number of changes to skip"
)
name = "--start",
aliases = {"-S"},
usage = "Number of changes to skip")
void setStart(int start) {
processor.setStart(start);
}
@Argument(
index = 0,
required = true,
multiValued = true,
metaVar = "QUERY",
usage = "Query to execute"
)
index = 0,
required = true,
multiValued = true,
metaVar = "QUERY",
usage = "Query to execute")
private List<String> query;
@Override

View File

@ -42,9 +42,8 @@ import org.slf4j.LoggerFactory;
/** Receives change upload over SSH using the Git receive-pack protocol. */
@CommandMetaData(
name = "receive-pack",
description = "Standard Git server side command for client side git push"
)
name = "receive-pack",
description = "Standard Git server side command for client side git push")
final class Receive extends AbstractGitCommand {
private static final Logger log = LoggerFactory.getLogger(Receive.class);
@ -56,21 +55,19 @@ final class Receive extends AbstractGitCommand {
private final Set<Account.Id> ccId = new HashSet<>();
@Option(
name = "--reviewer",
aliases = {"--re"},
metaVar = "EMAIL",
usage = "request reviewer for change(s)"
)
name = "--reviewer",
aliases = {"--re"},
metaVar = "EMAIL",
usage = "request reviewer for change(s)")
void addReviewer(final Account.Id id) {
reviewerId.add(id);
}
@Option(
name = "--cc",
aliases = {},
metaVar = "EMAIL",
usage = "CC user on change(s)"
)
name = "--cc",
aliases = {},
metaVar = "EMAIL",
usage = "CC user on change(s)")
void addCC(final Account.Id id) {
ccId.add(id);
}

View File

@ -31,11 +31,10 @@ import org.kohsuke.args4j.Argument;
@CommandMetaData(name = "rename-group", description = "Rename an account group")
public class RenameGroupCommand extends SshCommand {
@Argument(
index = 0,
required = true,
metaVar = "GROUP",
usage = "name of the group to be renamed"
)
index = 0,
required = true,
metaVar = "GROUP",
usage = "name of the group to be renamed")
private String groupName;
@Argument(index = 1, required = true, metaVar = "NEWNAME", usage = "new name of the group")

View File

@ -72,12 +72,11 @@ public class ReviewCommand extends SshCommand {
private final Set<PatchSet> patchSets = new HashSet<>();
@Argument(
index = 0,
required = true,
multiValued = true,
metaVar = "{COMMIT | CHANGE,PATCHSET}",
usage = "list of commits or patch sets to review"
)
index = 0,
required = true,
multiValued = true,
metaVar = "{COMMIT | CHANGE,PATCHSET}",
usage = "list of commits or patch sets to review")
void addPatchSetId(final String token) {
try {
PatchSet ps = psParser.parsePatchSet(token, projectControl, branch);
@ -90,29 +89,26 @@ public class ReviewCommand extends SshCommand {
}
@Option(
name = "--project",
aliases = "-p",
usage = "project containing the specified patch set(s)"
)
name = "--project",
aliases = "-p",
usage = "project containing the specified patch set(s)")
private ProjectControl projectControl;
@Option(name = "--branch", aliases = "-b", usage = "branch containing the specified patch set(s)")
private String branch;
@Option(
name = "--message",
aliases = "-m",
usage = "cover message to publish on change(s)",
metaVar = "MESSAGE"
)
name = "--message",
aliases = "-m",
usage = "cover message to publish on change(s)",
metaVar = "MESSAGE")
private String changeComment;
@Option(
name = "--notify",
aliases = "-n",
usage = "Who to send email notifications to after the review is stored.",
metaVar = "NOTIFYHANDLING"
)
name = "--notify",
aliases = "-n",
usage = "Who to send email notifications to after the review is stored.",
metaVar = "NOTIFYHANDLING")
private NotifyHandling notify;
@Option(name = "--abandon", usage = "abandon the specified change(s)")
@ -140,25 +136,22 @@ public class ReviewCommand extends SshCommand {
private boolean json;
@Option(
name = "--strict-labels",
usage = "Strictly check if the labels specified can be applied to the given patch set(s)"
)
name = "--strict-labels",
usage = "Strictly check if the labels specified can be applied to the given patch set(s)")
private boolean strictLabels;
@Option(
name = "--tag",
aliases = "-t",
usage = "applies a tag to the given review",
metaVar = "TAG"
)
name = "--tag",
aliases = "-t",
usage = "applies a tag to the given review",
metaVar = "TAG")
private String changeTag;
@Option(
name = "--label",
aliases = "-l",
usage = "custom label(s) to assign",
metaVar = "LABEL=VALUE"
)
name = "--label",
aliases = "-l",
usage = "custom label(s) to assign",
metaVar = "LABEL=VALUE")
void addLabel(final String token) {
LabelVote v = LabelVote.parseWithEquals(token);
LabelType.checkName(v.label()); // Disallow SUBM.

View File

@ -64,11 +64,10 @@ import org.kohsuke.args4j.Option;
final class SetAccountCommand extends SshCommand {
@Argument(
index = 0,
required = true,
metaVar = "USER",
usage = "full name, email-address, ssh username or account id"
)
index = 0,
required = true,
metaVar = "USER",
usage = "full name, email-address, ssh username or account id")
private Account.Id id;
@Option(name = "--full-name", metaVar = "NAME", usage = "display name of the account")
@ -84,34 +83,30 @@ final class SetAccountCommand extends SshCommand {
private List<String> addEmails = new ArrayList<>();
@Option(
name = "--delete-email",
metaVar = "EMAIL",
usage = "email addresses to delete from the account"
)
name = "--delete-email",
metaVar = "EMAIL",
usage = "email addresses to delete from the account")
private List<String> deleteEmails = new ArrayList<>();
@Option(
name = "--preferred-email",
metaVar = "EMAIL",
usage = "a registered email address from the account"
)
name = "--preferred-email",
metaVar = "EMAIL",
usage = "a registered email address from the account")
private String preferredEmail;
@Option(name = "--add-ssh-key", metaVar = "-|KEY", usage = "public keys to add to the account")
private List<String> addSshKeys = new ArrayList<>();
@Option(
name = "--delete-ssh-key",
metaVar = "-|KEY",
usage = "public keys to delete from the account"
)
name = "--delete-ssh-key",
metaVar = "-|KEY",
usage = "public keys to delete from the account")
private List<String> deleteSshKeys = new ArrayList<>();
@Option(
name = "--http-password",
metaVar = "PASSWORD",
usage = "password for HTTP authentication for the account"
)
name = "--http-password",
metaVar = "PASSWORD",
usage = "password for HTTP authentication for the account")
private String httpPassword;
@Option(name = "--clear-http-password", usage = "clear HTTP password for the account")

View File

@ -33,10 +33,9 @@ import org.kohsuke.args4j.Argument;
@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
@CommandMetaData(
name = "set-level",
description = "Change the level of loggers",
runsAt = MASTER_OR_SLAVE
)
name = "set-level",
description = "Change the level of loggers",
runsAt = MASTER_OR_SLAVE)
public class SetLoggingLevelCommand extends SshCommand {
private static final String LOG_CONFIGURATION = "log4j.properties";
private static final String JAVA_OPTIONS_LOG_CONFIG = "log4j.configuration";

View File

@ -42,50 +42,44 @@ import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option;
@CommandMetaData(
name = "set-members",
description = "Modify members of specific group or number of groups"
)
name = "set-members",
description = "Modify members of specific group or number of groups")
public class SetMembersCommand extends SshCommand {
@Option(
name = "--add",
aliases = {"-a"},
metaVar = "USER",
usage = "users that should be added as group member"
)
name = "--add",
aliases = {"-a"},
metaVar = "USER",
usage = "users that should be added as group member")
private List<Account.Id> accountsToAdd = new ArrayList<>();
@Option(
name = "--remove",
aliases = {"-r"},
metaVar = "USER",
usage = "users that should be removed from the group"
)
name = "--remove",
aliases = {"-r"},
metaVar = "USER",
usage = "users that should be removed from the group")
private List<Account.Id> accountsToRemove = new ArrayList<>();
@Option(
name = "--include",
aliases = {"-i"},
metaVar = "GROUP",
usage = "group that should be included as group member"
)
name = "--include",
aliases = {"-i"},
metaVar = "GROUP",
usage = "group that should be included as group member")
private List<AccountGroup.UUID> groupsToInclude = new ArrayList<>();
@Option(
name = "--exclude",
aliases = {"-e"},
metaVar = "GROUP",
usage = "group that should be excluded from the group"
)
name = "--exclude",
aliases = {"-e"},
metaVar = "GROUP",
usage = "group that should be excluded from the group")
private List<AccountGroup.UUID> groupsToRemove = new ArrayList<>();
@Argument(
index = 0,
required = true,
multiValued = true,
metaVar = "GROUP",
usage = "groups to modify"
)
index = 0,
required = true,
multiValued = true,
metaVar = "GROUP",
usage = "groups to modify")
private List<AccountGroup.UUID> groups = new ArrayList<>();
@Inject private AddMembers addMembers;

View File

@ -41,18 +41,16 @@ final class SetProjectCommand extends SshCommand {
private ProjectControl projectControl;
@Option(
name = "--description",
aliases = {"-d"},
metaVar = "DESCRIPTION",
usage = "description of project"
)
name = "--description",
aliases = {"-d"},
metaVar = "DESCRIPTION",
usage = "description of project")
private String projectDescription;
@Option(
name = "--submit-type",
aliases = {"-t"},
usage = "project submit type\n(default: MERGE_IF_NECESSARY)"
)
name = "--submit-type",
aliases = {"-t"},
usage = "project submit type\n(default: MERGE_IF_NECESSARY)")
private SubmitType submitType;
@Option(name = "--contributor-agreements", usage = "if contributor agreement is required")
@ -68,37 +66,33 @@ final class SetProjectCommand extends SshCommand {
private InheritableBoolean requireChangeID;
@Option(
name = "--use-contributor-agreements",
aliases = {"--ca"},
usage = "if contributor agreement is required"
)
name = "--use-contributor-agreements",
aliases = {"--ca"},
usage = "if contributor agreement is required")
void setUseContributorArgreements(@SuppressWarnings("unused") boolean on) {
contributorAgreements = InheritableBoolean.TRUE;
}
@Option(
name = "--no-contributor-agreements",
aliases = {"--nca"},
usage = "if contributor agreement is not required"
)
name = "--no-contributor-agreements",
aliases = {"--nca"},
usage = "if contributor agreement is not required")
void setNoContributorArgreements(@SuppressWarnings("unused") boolean on) {
contributorAgreements = InheritableBoolean.FALSE;
}
@Option(
name = "--use-signed-off-by",
aliases = {"--so"},
usage = "if signed-off-by is required"
)
name = "--use-signed-off-by",
aliases = {"--so"},
usage = "if signed-off-by is required")
void setUseSignedOffBy(@SuppressWarnings("unused") boolean on) {
signedOffBy = InheritableBoolean.TRUE;
}
@Option(
name = "--no-signed-off-by",
aliases = {"--nso"},
usage = "if signed-off-by is not required"
)
name = "--no-signed-off-by",
aliases = {"--nso"},
usage = "if signed-off-by is not required")
void setNoSignedOffBy(@SuppressWarnings("unused") boolean on) {
signedOffBy = InheritableBoolean.FALSE;
}
@ -109,36 +103,32 @@ final class SetProjectCommand extends SshCommand {
}
@Option(
name = "--no-content-merge",
usage = "don't allow automatic conflict resolving within files"
)
name = "--no-content-merge",
usage = "don't allow automatic conflict resolving within files")
void setNoContentMerge(@SuppressWarnings("unused") boolean on) {
contentMerge = InheritableBoolean.FALSE;
}
@Option(
name = "--require-change-id",
aliases = {"--id"},
usage = "if change-id is required"
)
name = "--require-change-id",
aliases = {"--id"},
usage = "if change-id is required")
void setRequireChangeId(@SuppressWarnings("unused") boolean on) {
requireChangeID = InheritableBoolean.TRUE;
}
@Option(
name = "--no-change-id",
aliases = {"--nid"},
usage = "if change-id is not required"
)
name = "--no-change-id",
aliases = {"--nid"},
usage = "if change-id is not required")
void setNoChangeId(@SuppressWarnings("unused") boolean on) {
requireChangeID = InheritableBoolean.FALSE;
}
@Option(
name = "--project-state",
aliases = {"--ps"},
usage = "project's visibility state"
)
name = "--project-state",
aliases = {"--ps"},
usage = "project's visibility state")
private ProjectState state;
@Option(name = "--max-object-size-limit", usage = "max Git object size for this project")

View File

@ -48,30 +48,27 @@ public class SetReviewersCommand extends SshCommand {
private ProjectControl projectControl;
@Option(
name = "--add",
aliases = {"-a"},
metaVar = "REVIEWER",
usage = "user or group that should be added as reviewer"
)
name = "--add",
aliases = {"-a"},
metaVar = "REVIEWER",
usage = "user or group that should be added as reviewer")
private List<String> toAdd = new ArrayList<>();
@Option(
name = "--remove",
aliases = {"-r"},
metaVar = "REVIEWER",
usage = "user that should be removed from the reviewer list"
)
name = "--remove",
aliases = {"-r"},
metaVar = "REVIEWER",
usage = "user that should be removed from the reviewer list")
void optionRemove(Account.Id who) {
toRemove.add(who);
}
@Argument(
index = 0,
required = true,
multiValued = true,
metaVar = "CHANGE",
usage = "changes to modify"
)
index = 0,
required = true,
multiValued = true,
metaVar = "CHANGE",
usage = "changes to modify")
void addChange(String token) {
try {
changeArgumentParser.addChange(token, changes, projectControl);

View File

@ -53,10 +53,9 @@ import org.kohsuke.args4j.Option;
/** Show the current cache states. */
@RequiresAnyCapability({VIEW_CACHES, MAINTAIN_SERVER})
@CommandMetaData(
name = "show-caches",
description = "Display current cache statistics",
runsAt = MASTER_OR_SLAVE
)
name = "show-caches",
description = "Display current cache statistics",
runsAt = MASTER_OR_SLAVE)
final class ShowCaches extends SshCommand {
private static volatile long serverStarted;
@ -88,11 +87,10 @@ final class ShowCaches extends SshCommand {
@Inject private CurrentUser self;
@Option(
name = "--width",
aliases = {"-w"},
metaVar = "COLS",
usage = "width of output table"
)
name = "--width",
aliases = {"-w"},
metaVar = "COLS",
usage = "width of output table")
private int columns = 80;
private int nw;

View File

@ -50,23 +50,20 @@ import org.kohsuke.args4j.Option;
/** Show the current SSH connections. */
@RequiresCapability(GlobalCapability.VIEW_CONNECTIONS)
@CommandMetaData(
name = "show-connections",
description = "Display active client SSH connections",
runsAt = MASTER_OR_SLAVE
)
name = "show-connections",
description = "Display active client SSH connections",
runsAt = MASTER_OR_SLAVE)
final class ShowConnections extends SshCommand {
@Option(
name = "--numeric",
aliases = {"-n"},
usage = "don't resolve names"
)
name = "--numeric",
aliases = {"-n"},
usage = "don't resolve names")
private boolean numeric;
@Option(
name = "--wide",
aliases = {"-w"},
usage = "display without line width truncation"
)
name = "--wide",
aliases = {"-w"},
usage = "display without line width truncation")
private boolean wide;
@Inject private SshDaemon daemon;

View File

@ -41,23 +41,20 @@ import org.kohsuke.args4j.Option;
/** Display the current work queue. */
@AdminHighPriorityCommand
@CommandMetaData(
name = "show-queue",
description = "Display the background work queues",
runsAt = MASTER_OR_SLAVE
)
name = "show-queue",
description = "Display the background work queues",
runsAt = MASTER_OR_SLAVE)
final class ShowQueue extends SshCommand {
@Option(
name = "--wide",
aliases = {"-w"},
usage = "display without line width truncation"
)
name = "--wide",
aliases = {"-w"},
usage = "display without line width truncation")
private boolean wide;
@Option(
name = "--by-queue",
aliases = {"-q"},
usage = "group tasks by queue and print queue info"
)
name = "--by-queue",
aliases = {"-q"},
usage = "group tasks by queue and print queue info")
private boolean groupByQueue;
@Inject private ListTasks listTasks;

View File

@ -60,11 +60,10 @@ final class StreamEvents extends BaseCommand {
private static final int BATCH_SIZE = 32;
@Option(
name = "--subscribe",
aliases = {"-s"},
metaVar = "SUBSCRIBE",
usage = "subscribe to specific stream-events"
)
name = "--subscribe",
aliases = {"-s"},
metaVar = "SUBSCRIBE",
usage = "subscribe to specific stream-events")
private List<String> subscribedToEvents = new ArrayList<>();
@Inject private IdentifiedUser currentUser;

View File

@ -51,15 +51,14 @@ public class UploadArchive extends AbstractGitCommand {
*/
static class Options {
@Option(
name = "-f",
aliases = {"--format"},
usage =
"Format of the"
+ " resulting archive: tar or zip... If this option is not given, and"
+ " the output file is specified, the format is inferred from the"
+ " filename if possible (e.g. writing to \"foo.zip\" makes the output"
+ " to be in the zip format). Otherwise the output format is tar."
)
name = "-f",
aliases = {"--format"},
usage =
"Format of the"
+ " resulting archive: tar or zip... If this option is not given, and"
+ " the output file is specified, the format is inferred from the"
+ " filename if possible (e.g. writing to \"foo.zip\" makes the output"
+ " to be in the zip format). Otherwise the output format is tar.")
private String format = "tar";
@Option(name = "--prefix", usage = "Prepend <prefix>/ to each filename in the archive.")
@ -93,25 +92,23 @@ public class UploadArchive extends AbstractGitCommand {
private boolean level8;
@Option(
name = "-9",
usage =
"Highest and slowest compression level. You "
+ "can specify any number from 1 to 9 to adjust compression speed and "
+ "ratio."
)
name = "-9",
usage =
"Highest and slowest compression level. You "
+ "can specify any number from 1 to 9 to adjust compression speed and "
+ "ratio.")
private boolean level9;
@Argument(index = 0, required = true, usage = "The tree or commit to produce an archive for.")
private String treeIsh = "master";
@Argument(
index = 1,
multiValued = true,
usage =
"Without an optional path parameter, all files and subdirectories of "
+ "the current working directory are included in the archive. If one "
+ "or more paths are specified, only these are included."
)
index = 1,
multiValued = true,
usage =
"Without an optional path parameter, all files and subdirectories of "
+ "the current working directory are included in the archive. If one "
+ "or more paths are specified, only these are included.")
private List<String> path;
}