Search in sources :

Example 1 with Settings

use of org.apache.maven.scm.providers.svn.settings.Settings in project maven-scm by apache.

the class SvnUpdateCommand method createCommandLine.

// ----------------------------------------------------------------------
// 
// ----------------------------------------------------------------------
public static Commandline createCommandLine(SvnScmProviderRepository repository, File workingDirectory, ScmVersion version) {
    Settings settings = SvnUtil.getSettings();
    String workingDir = workingDirectory.getAbsolutePath();
    if (settings.isUseCygwinPath()) {
        workingDir = settings.getCygwinMountPath() + "/" + workingDir;
        workingDir = StringUtils.replace(workingDir, ":", "");
        workingDir = StringUtils.replace(workingDir, "\\", "/");
    }
    if (version != null && StringUtils.isEmpty(version.getName())) {
        version = null;
    }
    Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory, repository);
    if (version == null || SvnTagBranchUtils.isRevisionSpecifier(version)) {
        cl.createArg().setValue("update");
        if (version != null && StringUtils.isNotEmpty(version.getName())) {
            cl.createArg().setValue("-r");
            cl.createArg().setValue(version.getName());
        }
        cl.createArg().setValue(workingDir);
    } else {
        if (version instanceof ScmBranch) {
            // The tag specified does not appear to be numeric, so assume it refers
            // to a branch/tag url and perform a switch operation rather than update
            cl.createArg().setValue("switch");
            if (version instanceof ScmTag) {
                cl.createArg().setValue(SvnTagBranchUtils.resolveTagUrl(repository, (ScmTag) version));
            } else {
                cl.createArg().setValue(SvnTagBranchUtils.resolveBranchUrl(repository, (ScmBranch) version));
            }
            cl.createArg().setValue(workingDir);
        }
    }
    return cl;
}
Also used : ScmBranch(org.apache.maven.scm.ScmBranch) Commandline(org.codehaus.plexus.util.cli.Commandline) ScmTag(org.apache.maven.scm.ScmTag) Settings(org.apache.maven.scm.providers.svn.settings.Settings)

Aggregations

ScmBranch (org.apache.maven.scm.ScmBranch)1 ScmTag (org.apache.maven.scm.ScmTag)1 Settings (org.apache.maven.scm.providers.svn.settings.Settings)1 Commandline (org.codehaus.plexus.util.cli.Commandline)1