Skip to content

Commit

Permalink
[MRELEASE-1064] [REGRESSION] release:branch uses @releaseLabel instea…
Browse files Browse the repository at this point in the history
…d of @branchName in default SCM commit

This closes #221
  • Loading branch information
michael-o committed Jun 13, 2024
1 parent fa6c3db commit f3bbb77
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand All @@ -17,12 +17,15 @@
* under the License.
*/

File buildLog = new File( basedir, 'build.log' )
assert buildLog.exists()

assert buildLog.getText().contains("[INFO] Full run would be commit 1 files with message: '[maven-release-plugin] prepare branch test-1.0.x'")

try
{
File buildLog = new File( basedir, "build.log" );

{
System.out.println( "Checking logs..." );

StringBuffer data = new StringBuffer( 1024 );
BufferedReader reader = new BufferedReader( new FileReader( buildLog ) );
char[] buf = new char[1024];
Expand All @@ -37,13 +40,13 @@ try
String contents = data.toString();

String one_expected = "Checking in modified POMs";

int pos = contents.indexOf( one_expected );

if( contents.indexOf( one_expected, pos ) == -1 )
{
return true;
}
}
}
catch( Throwable t )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@

import groovy.xml.XmlSlurper

File buildLog = new File( basedir, 'build.log' )
assert buildLog.exists()

assert buildLog.getText().contains("[INFO] Full run would be commit 1 files with message: '[maven-release-plugin] prepare branch RELEASE-2.6.0'")

def projectBranch = new XmlSlurper().parse( new File( basedir, "pom.xml.branch" ) )
assert projectBranch.version.text() == "2.6.0-BRANCH-SNAPSHOT"

def projectNext = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) )
assert projectNext.version.text() == "2.6.1-DEV-SNAPSHOT"

return true
return true
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@ assert project.version.text() == "1.0-SNAPSHOT"
def projectNext = new XmlSlurper().parse( new File( basedir, "pom.xml.next" ) )
assert projectNext.version.text() == "1.0-SNAPSHOT"

File buildLog = new File( basedir, 'build.log' )
assert buildLog.exists()

assert buildLog.getText().contains("[INFO] Full run would be commit 1 files with message: '[maven-release-plugin] prepare branch branch-mrelease-976'")

return true
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public class BranchReleaseMojo extends AbstractScmReleaseMojo {

/**
* The SCM commit comment when branching.
* Defaults to "@{prefix} prepare branch @{releaseLabel}".
* Defaults to "@{prefix} prepare branch @{branchName}".
* <p>
* Property interpolation is performed on the value, but in order to ensure that the interpolation occurs
* during release, you must use <code>@{...}</code> to reference the properties rather than <code>${...}</code>.
Expand All @@ -227,13 +227,13 @@ public class BranchReleaseMojo extends AbstractScmReleaseMojo {
* <li><code>prefix</code> - The comment prefix.
* <li><code>groupId</code> - The groupId of the root project.
* <li><code>artifactId</code> - The artifactId of the root project.
* <li><code>releaseLabel</code> - The release version of the root project.
* <li><code>branchName</code> - The branch name of the root project.
* </ul>
*
* @since 3.0.0-M1
*/
@Parameter(defaultValue = "@{prefix} prepare branch @{releaseLabel}", property = "scmBranchCommitComment")
private String scmBranchCommitComment = "@{prefix} prepare branch @{releaseLabel}";
@Parameter(defaultValue = "@{prefix} prepare branch @{branchName}", property = "scmBranchCommitComment")
private String scmBranchCommitComment = "@{prefix} prepare branch @{branchName}";

/**
* Currently only implemented with svn scm. Enable the {@code --pin-externals} option in
Expand Down

0 comments on commit f3bbb77

Please sign in to comment.