Uploaded image for project: 'Maven SCM'
  1. Maven SCM
  2. SCM-460

tag command ignores custom message parameter

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.3
    • Component/s: maven-scm-api
    • Labels:
      None
    • Environment:
      maven-release-plugin-2.0-beta-9

      Description

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

      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:

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                olamy Olivier Lamy
                Reporter:
                feerbach Stas Garifulin
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: