Search in sources :

Example 1 with SvnInfoCommand

use of org.apache.maven.scm.provider.svn.svnexe.command.info.SvnInfoCommand in project maven-scm by apache.

the class SvnExeScmProvider method getRepositoryURL.

/**
 * {@inheritDoc}
 */
protected String getRepositoryURL(File path) throws ScmException {
    // Note: I need to supply just 1 absolute path, but ScmFileSet won't let me without
    // a basedir (which isn't used here anyway), so use a dummy file.
    SvnInfoCommand infoCmd = (SvnInfoCommand) getInfoCommand();
    infoCmd.setLogger(this.getLogger());
    InfoScmResult result = infoCmd.executeInfoCommand(null, new ScmFileSet(new File(""), path), null, false, null);
    if (result.getInfoItems().size() != 1) {
        throw new ScmRepositoryException("Cannot find URL: " + (result.getInfoItems().size() == 0 ? "no" : "multiple") + " items returned by the info command");
    }
    return result.getInfoItems().get(0).getURL();
}
Also used : ScmFileSet(org.apache.maven.scm.ScmFileSet) ScmRepositoryException(org.apache.maven.scm.repository.ScmRepositoryException) RemoteInfoScmResult(org.apache.maven.scm.command.remoteinfo.RemoteInfoScmResult) InfoScmResult(org.apache.maven.scm.command.info.InfoScmResult) File(java.io.File) SvnInfoCommand(org.apache.maven.scm.provider.svn.svnexe.command.info.SvnInfoCommand)

Aggregations

File (java.io.File)1 ScmFileSet (org.apache.maven.scm.ScmFileSet)1 InfoScmResult (org.apache.maven.scm.command.info.InfoScmResult)1 RemoteInfoScmResult (org.apache.maven.scm.command.remoteinfo.RemoteInfoScmResult)1 SvnInfoCommand (org.apache.maven.scm.provider.svn.svnexe.command.info.SvnInfoCommand)1 ScmRepositoryException (org.apache.maven.scm.repository.ScmRepositoryException)1