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 @@ public class PrepareReleaseMojo
transformPom();
//commit();
//checkin();
tag();
}
@ -175,7 +177,8 @@ public class PrepareReleaseMojo
}
//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 @@ public class PrepareReleaseMojo
}
}
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

@ -17,11 +17,12 @@ package org.apache.maven.plugin.scm;
* ====================================================================
*/
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFile;
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;
@ -42,7 +43,7 @@ import java.util.List;
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id: DoxiaMojo.java 169372 2005-05-09 22:47:34Z evenisse $
* @version $Id: DoxiaMojo.java 169372 2005-05-09 22:47:34Z evenisse $
*/
public class ScmBean
{
@ -154,10 +155,10 @@ public class ScmBean
checkResult( result );
}
public List getStatus()
throws ScmException
{
List changedFiles;
public List getStatus()
throws ScmException
{
List changedFiles;
ScmRepository repository = getScmRepository();
@ -168,8 +169,19 @@ public class ScmBean
changedFiles = result.getChangedFiles();
return changedFiles;
}
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