public RemoteInfoScmResult executeRemoteInfoCommand()

in maven-scm-providers/maven-scm-providers-svn/maven-scm-provider-svnexe/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/remoteinfo/SvnRemoteInfoCommand.java [45:108]


    public RemoteInfoScmResult executeRemoteInfoCommand(
            ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {

        String url = ((SvnScmProviderRepository) repository).getUrl();
        // use a default svn layout, url is here http://svn.apache.org/repos/asf/maven/maven-3/trunk
        // so as we presume we have good users using standard svn layout, we calculate tags and branches url
        url = StringUtils.stripEnd(url, "/");
        int idx = url.lastIndexOf("/");
        String baseUrl = url.substring(0, idx);

        Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(
                fileSet == null ? null : fileSet.getBasedir(), (SvnScmProviderRepository) repository);

        cl.createArg().setValue("ls");

        cl.createArg().setValue(baseUrl + "/tags" + "@");

        CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();

        LsConsumer consumer = new LsConsumer(baseUrl + "/tags");

        int exitCode = 0;

        Map<String, String> tagsInfos = null;

        try {
            exitCode = SvnCommandLineUtils.execute(cl, consumer, stderr);
            tagsInfos = consumer.infos;

        } catch (CommandLineException ex) {
            throw new ScmException("Error while executing svn command.", ex);
        }

        if (exitCode != 0) {
            return new RemoteInfoScmResult(cl.toString(), "The svn command failed.", stderr.getOutput(), false);
        }

        cl = SvnCommandLineUtils.getBaseSvnCommandLine(
                fileSet == null ? null : fileSet.getBasedir(), (SvnScmProviderRepository) repository);

        cl.createArg().setValue("ls");

        cl.createArg().setValue(baseUrl + "/branches" + "@");

        stderr = new CommandLineUtils.StringStreamConsumer();

        consumer = new LsConsumer(baseUrl + "/branches");

        Map<String, String> branchesInfos = null;

        try {
            exitCode = SvnCommandLineUtils.execute(cl, consumer, stderr);
            branchesInfos = consumer.infos;

        } catch (CommandLineException ex) {
            throw new ScmException("Error while executing svn command.", ex);
        }

        if (exitCode != 0) {
            return new RemoteInfoScmResult(cl.toString(), "The svn command failed.", stderr.getOutput(), false);
        }

        return new RemoteInfoScmResult(cl.toString(), branchesInfos, tagsInfos);
    }