From f71776c9ffa61ca0c55d8d124fdb8535a0c5176e Mon Sep 17 00:00:00 2001 From: Emmanuel Venisse Date: Tue, 17 May 2005 07:08:01 +0000 Subject: [PATCH] Add checkIn feature git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@170527 13f79535-47bb-0310-9956-ffa450edef68 --- .../plugin/release/PrepareReleaseMojo.java | 20 +++++++++++-- .../org/apache/maven/plugin/scm/ScmBean.java | 28 +++++++++++++------ 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java b/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java index 4bbf82486e..b0eaf38393 100644 --- a/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java +++ b/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java @@ -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 { diff --git a/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/scm/ScmBean.java b/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/scm/ScmBean.java index e698c30953..61e6688661 100644 --- a/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/scm/ScmBean.java +++ b/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/scm/ScmBean.java @@ -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 Brett Porter * @author Emmanuel Venisse - * @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