Search in sources :

Example 1 with ScmTagParameters

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

the class AbstractTagCommand method executeCommand.

/**
 * {@inheritDoc}
 */
public ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    String tagName = parameters.getString(CommandParameter.TAG_NAME);
    ScmTagParameters scmTagParameters = parameters.getScmTagParameters(CommandParameter.SCM_TAG_PARAMETERS);
    String message = parameters.getString(CommandParameter.MESSAGE, null);
    if (message != null) {
        // if message was passed by CommandParameter.MESSAGE then use it.
        scmTagParameters.setMessage(message);
    }
    if (scmTagParameters.getMessage() == null) {
        // if message hasn't been passed nor by ScmTagParameters nor by CommandParameter.MESSAGE then use default.
        scmTagParameters.setMessage("[maven-scm] copy for tag " + tagName);
    }
    return executeTagCommand(repository, fileSet, tagName, scmTagParameters);
}
Also used : ScmTagParameters(org.apache.maven.scm.ScmTagParameters)

Example 2 with ScmTagParameters

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

the class AbstractScmProvider method tag.

/**
 * {@inheritDoc}
 */
public TagScmResult tag(ScmRepository repository, ScmFileSet fileSet, String tagName, String message) throws ScmException {
    login(repository, fileSet);
    CommandParameters parameters = new CommandParameters();
    parameters.setString(CommandParameter.TAG_NAME, tagName);
    if (StringUtils.isNotEmpty(message)) {
        parameters.setString(CommandParameter.MESSAGE, message);
    }
    ScmTagParameters scmTagParameters = new ScmTagParameters(message);
    parameters.setScmTagParameters(CommandParameter.SCM_TAG_PARAMETERS, scmTagParameters);
    return tag(repository.getProviderRepository(), fileSet, parameters);
}
Also used : ScmTagParameters(org.apache.maven.scm.ScmTagParameters) CommandParameters(org.apache.maven.scm.CommandParameters)

Example 3 with ScmTagParameters

use of org.apache.maven.scm.ScmTagParameters 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 4 with ScmTagParameters

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

the class SvnExeTagCommandTckTest method testTagRemoteTagHttps.

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

Example 5 with ScmTagParameters

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

the class SvnExeTagCommandTckTest method testTagRemoteTagHttpsWithRevision.

public void testTagRemoteTagHttpsWithRevision() throws Exception {
    File messageFile = File.createTempFile("maven-scm", "commit");
    messageFile.deleteOnExit();
    ScmTagParameters scmTagParameters = new ScmTagParameters();
    scmTagParameters.setRemoteTagging(true);
    scmTagParameters.setScmRevision("12");
    testCommandLine("scm:svn:https://foo.com/svn/trunk", "svntag", messageFile, "user", "svn --username user --no-auth-cache --non-interactive copy --file " + messageFile.getAbsolutePath() + " --parents --revision 12 https://foo.com/svn/trunk https://foo.com/svn/tags/svntag", scmTagParameters);
}
Also used : ScmTagParameters(org.apache.maven.scm.ScmTagParameters) File(java.io.File)

Aggregations

ScmTagParameters (org.apache.maven.scm.ScmTagParameters)9 File (java.io.File)3 Commandline (org.codehaus.plexus.util.cli.Commandline)3 IOException (java.io.IOException)2 ScmException (org.apache.maven.scm.ScmException)2 TagScmResult (org.apache.maven.scm.command.tag.TagScmResult)2 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 CommandParameters (org.apache.maven.scm.CommandParameters)1 ScmFile (org.apache.maven.scm.ScmFile)1 ScmProvider (org.apache.maven.scm.provider.ScmProvider)1 SvnScmProviderRepository (org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository)1 SvnCommandLineUtils (org.apache.maven.scm.provider.svn.svnexe.command.SvnCommandLineUtils)1 TfsScmProviderRepository (org.apache.maven.scm.provider.tfs.TfsScmProviderRepository)1 ScmRepository (org.apache.maven.scm.repository.ScmRepository)1 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)1 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)1