Search in sources :

Example 16 with ScmRevision

use of org.apache.maven.scm.ScmRevision in project maven-scm by apache.

the class TfsCheckOutCommandTest method testCommandline.

public void testCommandline() throws Exception {
    TfsScmProviderRepository repo = getScmProviderRepository();
    ScmRevision rev = new ScmRevision("revision");
    String path = getScmFileSet().getBasedir().getAbsolutePath();
    Commandline cmd = new TfsCheckOutCommand().createGetCommand(repo, getScmFileSet(), rev, true).getCommandline();
    String expected = "tf get -login:user,password -recursive -force -version:Crevision " + path;
    assertCommandLine(expected, getWorkingDirectory(), cmd);
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) ScmRevision(org.apache.maven.scm.ScmRevision) TfsScmProviderRepository(org.apache.maven.scm.provider.tfs.TfsScmProviderRepository)

Example 17 with ScmRevision

use of org.apache.maven.scm.ScmRevision in project maven-scm by apache.

the class JazzCheckOutCommandTest method testCreateJazzLoadCommand.

public void testCreateJazzLoadCommand() throws Exception {
    ScmRevision rev = new ScmRevision("revision");
    // TODO figure out what Jazz SCM does in terms of branch/tag/revision
    // TODO figure out how/when to load specific files
    Commandline cmd = new JazzCheckOutCommand().createJazzLoadCommand(repo, getScmFileSet(), rev).getCommandline();
    String expected = "scm load --force --repository-uri https://localhost:9443/jazz --username myUserName --password myPassword --dir " + getScmFileSet().getBasedir().getAbsolutePath() + " \"Dave's Repository Workspace\"";
    assertCommandLine(expected, getWorkingDirectory(), cmd);
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) ScmRevision(org.apache.maven.scm.ScmRevision)

Example 18 with ScmRevision

use of org.apache.maven.scm.ScmRevision in project maven-scm by apache.

the class SvnCheckOutCommand method createCommandLine.

/**
 * Create SVN check out command line.
 *
 * @param repository       not null
 * @param workingDirectory not null
 * @param version          not null
 * @param url              not null
 * @param recursive        <code>true</code> if recursive check out is wanted, <code>false</code> otherwise.
 * @return the SVN command line for the SVN check out.
 * @since 1.1.1
 */
public static Commandline createCommandLine(SvnScmProviderRepository repository, File workingDirectory, ScmVersion version, String url, boolean recursive) {
    Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory.getParentFile(), repository);
    cl.createArg().setValue("checkout");
    // add non recursive option
    if (!recursive) {
        cl.createArg().setValue("-N");
    }
    if (version != null && StringUtils.isNotEmpty(version.getName())) {
        if (version instanceof ScmRevision) {
            cl.createArg().setValue("-r");
            cl.createArg().setValue(version.getName());
        }
    }
    cl.createArg().setValue(url);
    cl.createArg().setValue(workingDirectory.getAbsolutePath());
    return cl;
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) ScmRevision(org.apache.maven.scm.ScmRevision)

Example 19 with ScmRevision

use of org.apache.maven.scm.ScmRevision in project maven-scm by apache.

the class SvnListCommand method createCommandLine.

static Commandline createCommandLine(SvnScmProviderRepository repository, ScmFileSet fileSet, boolean recursive, ScmVersion version) {
    Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(TMP_DIR, repository);
    cl.createArg().setValue("list");
    if (recursive) {
        cl.createArg().setValue("--recursive");
    }
    if (version != null && StringUtils.isNotEmpty(version.getName())) {
        if (version instanceof ScmRevision) {
            cl.createArg().setValue("-r");
            cl.createArg().setValue(version.getName());
        }
    }
    Iterator<File> it = fileSet.getFileList().iterator();
    while (it.hasNext()) {
        File file = it.next();
        cl.createArg().setValue(repository.getUrl() + "/" + file.getPath().replace('\\', '/'));
    }
    return cl;
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) ScmRevision(org.apache.maven.scm.ScmRevision) File(java.io.File)

Example 20 with ScmRevision

use of org.apache.maven.scm.ScmRevision in project maven-scm by apache.

the class SvnExeExportCommand method createCommandLine.

// ----------------------------------------------------------------------
// 
// ----------------------------------------------------------------------
public static Commandline createCommandLine(SvnScmProviderRepository repository, File workingDirectory, ScmVersion version, String url, String outputSirectory) {
    if (version != null && StringUtils.isEmpty(version.getName())) {
        version = null;
    }
    Commandline cl = SvnCommandLineUtils.getBaseSvnCommandLine(workingDirectory, repository);
    cl.createArg().setValue("export");
    if (version != null && StringUtils.isNotEmpty(version.getName())) {
        if (version instanceof ScmRevision) {
            cl.createArg().setValue("-r");
            cl.createArg().setValue(version.getName());
        }
    }
    // support exporting to an existing directory
    cl.createArg().setValue("--force");
    cl.createArg().setValue(url);
    if (StringUtils.isNotEmpty(outputSirectory)) {
        cl.createArg().setValue(outputSirectory);
    }
    return cl;
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) ScmRevision(org.apache.maven.scm.ScmRevision)

Aggregations

ScmRevision (org.apache.maven.scm.ScmRevision)28 File (java.io.File)12 ScmFileSet (org.apache.maven.scm.ScmFileSet)12 Commandline (org.codehaus.plexus.util.cli.Commandline)10 Date (java.util.Date)5 CommandParameters (org.apache.maven.scm.CommandParameters)5 AbstractAccuRevCommandTest (org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommandTest)5 Test (org.junit.Test)5 ChangeFile (org.apache.maven.scm.ChangeFile)4 ScmException (org.apache.maven.scm.ScmException)4 ScmFile (org.apache.maven.scm.ScmFile)4 ScmVersion (org.apache.maven.scm.ScmVersion)4 ChangeLogScmResult (org.apache.maven.scm.command.changelog.ChangeLogScmResult)4 ScmRepository (org.apache.maven.scm.repository.ScmRepository)4 ChangeFileMatcher.changeFile (org.apache.maven.scm.ChangeFileMatcher.changeFile)3 ScmBranch (org.apache.maven.scm.ScmBranch)3 ChangeLogSet (org.apache.maven.scm.command.changelog.ChangeLogSet)3 FileDifference (org.apache.maven.scm.provider.accurev.FileDifference)3 Stream (org.apache.maven.scm.provider.accurev.Stream)3 Transaction (org.apache.maven.scm.provider.accurev.Transaction)3