Search in sources :

Example 1 with ScmBranchParameters

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

the class SvnExeBranchCommandTckTest method testBranchUserNameSvnHttpsRemoteBranchingWithRev.

// --no-auth-cache
public void testBranchUserNameSvnHttpsRemoteBranchingWithRev() throws Exception {
    File messageFile = File.createTempFile("maven-scm", "commit");
    messageFile.deleteOnExit();
    ScmBranchParameters scmBranchParameters = new ScmBranchParameters();
    scmBranchParameters.setRemoteBranching(true);
    scmBranchParameters.setScmRevision("2");
    testCommandLine("scm:svn:https://foo.com/svn/trunk", "svnbranch", messageFile, "user", "svn --username user --no-auth-cache --non-interactive copy --parents --file " + messageFile.getAbsolutePath() + " --revision 2 https://foo.com/svn/trunk https://foo.com/svn/branches/svnbranch", scmBranchParameters);
}
Also used : File(java.io.File) ScmBranchParameters(org.apache.maven.scm.ScmBranchParameters)

Example 2 with ScmBranchParameters

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

the class SvnBranchCommand method createCommandLine.

// ----------------------------------------------------------------------
// 
// ----------------------------------------------------------------------
public static Commandline createCommandLine(SvnScmProviderRepository repository, File workingDirectory, String branch, File messageFile) {
    ScmBranchParameters scmBranchParameters = new ScmBranchParameters();
    scmBranchParameters.setRemoteBranching(false);
    return createCommandLine(repository, workingDirectory, branch, messageFile, scmBranchParameters);
}
Also used : ScmBranchParameters(org.apache.maven.scm.ScmBranchParameters)

Example 3 with ScmBranchParameters

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

the class BranchMojo method execute.

/**
 * {@inheritDoc}
 */
public void execute() throws MojoExecutionException {
    super.execute();
    try {
        ScmRepository repository = getScmRepository();
        ScmProvider provider = getScmManager().getProviderByRepository(repository);
        String finalBranch = provider.sanitizeTagName(branch);
        getLog().info("Final Branch Name: '" + finalBranch + "'");
        ScmBranchParameters scmBranchParameters = new ScmBranchParameters(message);
        scmBranchParameters.setRemoteBranching(remoteBranching);
        BranchScmResult result = provider.branch(repository, getFileSet(), finalBranch, scmBranchParameters);
        checkResult(result);
    } catch (IOException e) {
        throw new MojoExecutionException("Cannot run branch command : ", e);
    } catch (ScmException e) {
        throw new MojoExecutionException("Cannot run branch command : ", e);
    }
}
Also used : ScmProvider(org.apache.maven.scm.provider.ScmProvider) ScmRepository(org.apache.maven.scm.repository.ScmRepository) ScmException(org.apache.maven.scm.ScmException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) IOException(java.io.IOException) BranchScmResult(org.apache.maven.scm.command.branch.BranchScmResult) ScmBranchParameters(org.apache.maven.scm.ScmBranchParameters)

Example 4 with ScmBranchParameters

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

the class AbstractBranchCommand method executeCommand.

/**
 * {@inheritDoc}
 */
public ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    String branchName = parameters.getString(CommandParameter.BRANCH_NAME);
    ScmBranchParameters scmBranchParameters = parameters.getScmBranchParameters(CommandParameter.SCM_BRANCH_PARAMETERS);
    String message = parameters.getString(CommandParameter.MESSAGE, "[maven-scm] copy for branch " + branchName);
    if (StringUtils.isBlank(scmBranchParameters.getMessage()) && StringUtils.isNotBlank(message)) {
        scmBranchParameters.setMessage(message);
    }
    return executeBranchCommand(repository, fileSet, branchName, scmBranchParameters);
}
Also used : ScmBranchParameters(org.apache.maven.scm.ScmBranchParameters)

Example 5 with ScmBranchParameters

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

the class SvnExeBranchCommandTckTest method testBranchUserNameSvnHttpsRemoteBranchingNoRev.

public void testBranchUserNameSvnHttpsRemoteBranchingNoRev() throws Exception {
    File messageFile = File.createTempFile("maven-scm", "commit");
    messageFile.deleteOnExit();
    ScmBranchParameters scmBranchParameters = new ScmBranchParameters();
    scmBranchParameters.setRemoteBranching(true);
    testCommandLine("scm:svn:https://foo.com/svn/trunk", "svnbranch", messageFile, "user", "svn --username user --no-auth-cache --non-interactive copy --parents --file " + messageFile.getAbsolutePath() + " https://foo.com/svn/trunk https://foo.com/svn/branches/svnbranch", scmBranchParameters);
}
Also used : File(java.io.File) ScmBranchParameters(org.apache.maven.scm.ScmBranchParameters)

Aggregations

ScmBranchParameters (org.apache.maven.scm.ScmBranchParameters)5 File (java.io.File)2 IOException (java.io.IOException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 ScmException (org.apache.maven.scm.ScmException)1 BranchScmResult (org.apache.maven.scm.command.branch.BranchScmResult)1 ScmProvider (org.apache.maven.scm.provider.ScmProvider)1 ScmRepository (org.apache.maven.scm.repository.ScmRepository)1