Add checkIn feature

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@170527 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2005-05-17 07:08:01 +00:00
parent c85f4fd8c8
commit f71776c9ff
2 changed files with 38 additions and 10 deletions

View File

@ -62,6 +62,8 @@ public class PrepareReleaseMojo
private static final String SNAPSHOT = "-SNAPSHOT";
private String projectVersion;
protected void executeTask()
throws MojoExecutionException
{
@ -71,7 +73,7 @@ protected void executeTask()
transformPom();
//commit();
//checkin();
tag();
}
@ -175,7 +177,8 @@ private void transformPom()
}
//Rewrite project version
model.setVersion( model.getVersion().substring( 0, model.getVersion().length() - SNAPSHOT.length() ) );
projectVersion = model.getVersion().substring( 0, model.getVersion().length() - SNAPSHOT.length() );
model.setVersion( projectVersion );
//Rewrite parent version
if ( project.hasParent() )
@ -240,6 +243,19 @@ private void transformPom()
}
}
private void checkin()
throws MojoExecutionException
{
try
{
getScm().checkin( "[maven-release-plugin] prepare release " + projectVersion, "pom.xml", null );
}
catch ( Exception e )
{
throw new MojoExecutionException( "An error is occurred in the tag process.", e );
}
}
private void tag()
throws MojoExecutionException
{

View File

@ -22,6 +22,7 @@
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmResult;
import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
import org.apache.maven.scm.command.checkin.CheckInScmResult;
import org.apache.maven.scm.command.checkout.CheckOutScmResult;
import org.apache.maven.scm.command.status.StatusScmResult;
import org.apache.maven.scm.command.tag.TagScmResult;
@ -171,6 +172,17 @@ public List getStatus()
return changedFiles;
}
public void checkin( String message, String includes, String excludes )
throws Exception
{
ScmRepository repository = getScmRepository();
CheckInScmResult result = getScmManager().checkIn( repository,
new ScmFileSet( new File( workingDirectory ), includes, excludes ),
tag, message );
checkResult( result );
}
public void tag()
throws ScmException
{