allow retrieving repositories by using type/name instead of repository id

This commit is contained in:
Sebastian Sdorra
2014-02-25 08:04:31 +01:00
parent 32fa25a322
commit 562e4e6bb4
2 changed files with 18 additions and 2 deletions

View File

@@ -98,7 +98,22 @@ public class GetRepositorySubCommand extends TemplateSubCommand
protected void run()
{
ScmClientSession session = createSession();
Repository repository = session.getRepositoryHandler().get(id);
Repository repository;
int index = id.indexOf("/");
if (index > 0)
{
String type = id.substring(0, index);
String name = id.substring(index + 1);
repository = session.getRepositoryHandler().get(type, name);
}
else
{
repository = session.getRepositoryHandler().get(id);
}
if (repository != null)
{
@@ -117,7 +132,7 @@ public class GetRepositorySubCommand extends TemplateSubCommand
/** Field description */
@Argument(
usage = "optionRepositoryId",
usage = "optionRepositoryIdOrTypeAndName",
metaVar = "repositoryid",
required = true
)

View File

@@ -44,6 +44,7 @@ optionLoggingLevel = Logging level (DEBUG, INFO, WARN, ERROR)
optionTemplate = Template
optionTemplateFile = Template file
optionRepositoryId = Repository Id
optionRepositoryIdOrTypeAndName = Repository Id or type/name
optionRepositoryName = Repository name
optionRepositoryType = Repository name
optionRepositoryContact = Repository contact