Support hidden commands and hide create-repo and review
| | |
| | | public @interface CommandMetaData { |
| | | String name(); |
| | | String description() default ""; |
| | | boolean hidden() default false; |
| | | } |
| | |
| | | |
| | | import com.gitblit.transport.ssh.CommandMetaData; |
| | | |
| | | @CommandMetaData(name = "create-repository", description = "Create new GIT repository") |
| | | @CommandMetaData(name = "create-repository", description = "Create new GIT repository", hidden = true) |
| | | public class CreateRepository extends SshCommand { |
| | | |
| | | @Option(name = "--name", aliases = {"-n"}, required = true, metaVar = "NAME", usage = "name of repository to be created") |
| | |
| | | String format = "%-" + maxLength + "s %s"; |
| | | for (String name : Sets.newTreeSet(m.keySet())) { |
| | | final Class<? extends Command> c = m.get(name); |
| | | usage.append(" "); |
| | | CommandMetaData meta = c.getAnnotation(CommandMetaData.class); |
| | | if (meta != null) { |
| | | if (meta.hidden()) { |
| | | continue; |
| | | } |
| | | usage.append(" "); |
| | | usage.append(String.format(format, name, |
| | | Strings.nullToEmpty(meta.description()))); |
| | | } |
| | |
| | | import com.gitblit.transport.ssh.CommandMetaData; |
| | | import com.gitblit.wicket.GitBlitWebSession; |
| | | |
| | | @CommandMetaData(name = "review", description = "Verify, approve and/or submit one or more patch sets") |
| | | @CommandMetaData(name = "review", description = "Verify, approve and/or submit one or more patch sets", hidden = true) |
| | | public class ReviewCommand extends SshCommand { |
| | | |
| | | private final static short REV_ID_LEN = 40; |
| | |
| | | @Override |
| | | public void run() throws UnloggedFailure { |
| | | UserModel user = GitBlitWebSession.get().getUser(); |
| | | // TODO ensure user has permission to score +2/-2 |
| | | for (Patchset ps : patchSets) { |
| | | // review |
| | | Change change = new Change(user.username); |