Search in sources :

Example 6 with TfsScmProviderRepository

use of org.apache.maven.scm.provider.tfs.TfsScmProviderRepository in project maven-scm by apache.

the class TfsListCommandTest method testCommandline.

public void testCommandline() throws Exception {
    TfsScmProviderRepository repo = getScmProviderRepository();
    Commandline cmd = new TfsListCommand().createCommand(repo, getScmFileSet(), true).getCommandline();
    String expected = "tf dir -login:user,password -recursive " + getFileList();
    assertCommandLine(expected, getWorkingDirectory(), cmd);
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) TfsScmProviderRepository(org.apache.maven.scm.provider.tfs.TfsScmProviderRepository)

Example 7 with TfsScmProviderRepository

use of org.apache.maven.scm.provider.tfs.TfsScmProviderRepository in project maven-scm by apache.

the class TfsCheckOutCommand method executeUnmapCommand.

public int executeUnmapCommand(ScmProviderRepository r, ScmFileSet f) throws ScmException {
    TfsScmProviderRepository tfsRepo = (TfsScmProviderRepository) r;
    String url = tfsRepo.getServerPath();
    String workspace = tfsRepo.getWorkspace();
    ErrorStreamConsumer out = new ErrorStreamConsumer();
    ErrorStreamConsumer err = new ErrorStreamConsumer();
    TfsCommand command = new TfsCommand("workfold", r, null, getLogger());
    command.addArgument("-workspace:" + workspace);
    command.addArgument("-unmap");
    command.addArgument(url);
    return command.execute(out, err);
}
Also used : TfsScmProviderRepository(org.apache.maven.scm.provider.tfs.TfsScmProviderRepository) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)

Example 8 with TfsScmProviderRepository

use of org.apache.maven.scm.provider.tfs.TfsScmProviderRepository in project maven-scm by apache.

the class TfsTagCommandTest method testCommandline.

public void testCommandline() throws Exception {
    TfsScmProviderRepository repo = getScmProviderRepository();
    ScmTagParameters param = new ScmTagParameters("Message of many words");
    Commandline cmd = new TfsTagCommand().createCommand(repo, getScmFileSet(), "tag", param).getCommandline();
    String expected = "tf label -login:user,password tag " + repo.getServerPath() + " -recursive -child:replace -comment:\"Message of many words\"";
    assertCommandLine(expected, getWorkingDirectory(), cmd);
}
Also used : Commandline(org.codehaus.plexus.util.cli.Commandline) ScmTagParameters(org.apache.maven.scm.ScmTagParameters) TfsScmProviderRepository(org.apache.maven.scm.provider.tfs.TfsScmProviderRepository)

Example 9 with TfsScmProviderRepository

use of org.apache.maven.scm.provider.tfs.TfsScmProviderRepository in project maven-scm by apache.

the class TfsUpdateCommandTest method testCommandline.

public void testCommandline() throws Exception {
    TfsScmProviderRepository repo = getScmProviderRepository();
    ScmRevision rev = new ScmRevision("revision");
    Commandline cmd = new TfsUpdateCommand().createCommand(repo, getScmFileSet(), rev).getCommandline();
    String path = repo.getServerPath();
    String expected = "tf get -login:user,password " + path + " -version:Crevision";
    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 10 with TfsScmProviderRepository

use of org.apache.maven.scm.provider.tfs.TfsScmProviderRepository in project maven-scm by apache.

the class TfsCheckOutCommand method executeCheckOutCommand.

protected CheckOutScmResult executeCheckOutCommand(ScmProviderRepository r, ScmFileSet f, ScmVersion v, boolean recursive, boolean shallow) throws ScmException {
    TfsScmProviderRepository tfsRepo = (TfsScmProviderRepository) r;
    String url = tfsRepo.getServerPath();
    String tfsUrl = tfsRepo.getTfsUrl();
    String workspace = tfsRepo.getWorkspace();
    // Try creating workspace
    boolean workspaceProvided = workspace != null && !workspace.trim().equals("");
    if (workspaceProvided) {
        createWorkspace(r, f, workspace, tfsUrl);
    }
    TfsCommand command;
    int status;
    if (workspaceProvided) {
        status = executeUnmapCommand(r, f);
    }
    ErrorStreamConsumer out = new ErrorStreamConsumer();
    ErrorStreamConsumer err = new ErrorStreamConsumer();
    if (workspaceProvided) {
        command = new TfsCommand("workfold", r, null, getLogger());
        command.addArgument("-workspace:" + workspace);
        command.addArgument("-map");
        command.addArgument(url);
        command.addArgument(f.getBasedir().getAbsolutePath());
        status = command.execute(out, err);
        if (status != 0 || err.hasBeenFed()) {
            return new CheckOutScmResult(command.getCommandString(), "Error code for TFS checkout (workfold map) command - " + status, err.getOutput(), false);
        }
    }
    FileListConsumer fileConsumer = new FileListConsumer();
    err = new ErrorStreamConsumer();
    command = createGetCommand(r, f, v, recursive);
    status = command.execute(fileConsumer, err);
    if (status != 0 || err.hasBeenFed()) {
        return new CheckOutScmResult(command.getCommandString(), "Error code for TFS checkout (get) command - " + status, err.getOutput(), false);
    }
    return new CheckOutScmResult(command.getCommandString(), fileConsumer.getFiles());
}
Also used : FileListConsumer(org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer) CheckOutScmResult(org.apache.maven.scm.command.checkout.CheckOutScmResult) TfsScmProviderRepository(org.apache.maven.scm.provider.tfs.TfsScmProviderRepository) ErrorStreamConsumer(org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)

Aggregations

TfsScmProviderRepository (org.apache.maven.scm.provider.tfs.TfsScmProviderRepository)16 Commandline (org.codehaus.plexus.util.cli.Commandline)11 ErrorStreamConsumer (org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer)3 ScmFile (org.apache.maven.scm.ScmFile)2 ScmRevision (org.apache.maven.scm.ScmRevision)2 File (java.io.File)1 ScmTagParameters (org.apache.maven.scm.ScmTagParameters)1 CheckOutScmResult (org.apache.maven.scm.command.checkout.CheckOutScmResult)1 StatusScmResult (org.apache.maven.scm.command.status.StatusScmResult)1 ChangedFileConsumer (org.apache.maven.scm.provider.tfs.command.consumer.ChangedFileConsumer)1 FileListConsumer (org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer)1