svn commit: r170527 - in /maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin: release/PrepareReleaseMojo.java scm/ScmBean.java

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r170527 - in /maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin: release/PrepareReleaseMojo.java scm/ScmBean.java

Emmanuel Venisse
Author: evenisse
Date: Tue May 17 00:08:01 2005
New Revision: 170527

URL: http://svn.apache.org/viewcvs?rev=170527&view=rev
Log:
Add checkIn feature

Modified:
    maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java
    maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/scm/ScmBean.java

Modified: maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java?rev=170527&r1=170526&r2=170527&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/release/PrepareReleaseMojo.java Tue May 17 00:08:01 2005
@@ -62,6 +62,8 @@
 
     private static final String SNAPSHOT = "-SNAPSHOT";
 
+    private String projectVersion;
+
     protected void executeTask()
         throws MojoExecutionException
     {
@@ -71,7 +73,7 @@
 
         transformPom();
 
-        //commit();
+        //checkin();
 
         tag();
     }
@@ -175,7 +177,8 @@
         }
 
         //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() )
@@ -237,6 +240,19 @@
         catch ( IOException e )
         {
             throw new MojoExecutionException( "Can't update pom.", e );
+        }
+    }
+
+    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 );
         }
     }
 

Modified: maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/scm/ScmBean.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/scm/ScmBean.java?rev=170527&r1=170526&r2=170527&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/scm/ScmBean.java (original)
+++ maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugin/scm/ScmBean.java Tue May 17 00:08:01 2005
@@ -17,11 +17,12 @@
  * ====================================================================
  */
 
-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 @@
  *
  * @author <a href="mailto:[hidden email]">Brett Porter</a>
  * @author <a href="mailto:[hidden email]">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 @@
         checkResult( result );
     }
 
-    public List getStatus()
-        throws ScmException
-    {
-        List changedFiles;
+    public List getStatus()
+        throws ScmException
+    {
+        List changedFiles;
 
         ScmRepository repository = getScmRepository();
 
@@ -168,8 +169,19 @@
 
         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



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]