tag command ignores custom message parameter
--------------------------------------------

                 Key: SCM-460
                 URL: http://jira.codehaus.org/browse/SCM-460
             Project: Maven SCM
          Issue Type: Bug
          Components: maven-scm-api
    Affects Versions: 1.2
         Environment: maven-release-plugin-2.0-beta-9
            Reporter: Stas Garifulin


{code:title=org.apache.maven.scm.command.provider.AbstractScmProvider}
    public TagScmResult tag( ScmRepository repository, ScmFileSet fileSet, 
String tagName, ScmTagParameters scmTagParameters )
        throws ScmException
    {
        login( repository, fileSet );

        CommandParameters parameters = new CommandParameters();

        parameters.setString( CommandParameter.TAG_NAME, tagName );

        parameters.setScmTagParameters( CommandParameter.SCM_TAG_PARAMETERS, 
scmTagParameters );

        return tag( repository.getProviderRepository(), fileSet, parameters );
    }
{code}

{code:title=org.apache.maven.scm.command.tag.AbstractTagCommand}
    public ScmResult executeCommand( ScmProviderRepository repository, 
ScmFileSet fileSet,
                                     CommandParameters parameters )
        throws ScmException
    {
        String tagName = parameters.getString( CommandParameter.TAG_NAME );

        String message = parameters.getString( CommandParameter.MESSAGE, 
"[maven-scm] copy for tag " + tagName );

        ScmTagParameters scmTagParameters = parameters.getScmTagParameters( 
CommandParameter.SCM_TAG_PARAMETERS );
        if (message != null)
        {
            scmTagParameters.setMessage( message );
        }
        
        return executeTagCommand( repository, fileSet, tagName, 
scmTagParameters );
    }
{code}

Maven release manager passes custom message to scm provider using the 
scmTagParameters argument. 
Scm provider passes scmTagParameters to scm tag command 
(CommandParameter.SCM_TAG_PARAMETERS).
Scm tag command overrides the passed ScmTagParameters#message.

Correct implementation should be like this:

{code:title=org.apache.maven.scm.command.tag.AbstractTagCommand}
    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 );

        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 );
    }
{code}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to