maven-scm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r526209 - in /maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm: command/branch/ manager/ provider/
Date Fri, 06 Apr 2007 15:57:35 GMT
Author: evenisse
Date: Fri Apr  6 08:57:34 2007
New Revision: 526209

URL: http://svn.apache.org/viewvc?view=rev&rev=526209
Log:
Add branch command

Added:
    maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/command/branch/BranchScmResult.java
  (with props)
Modified:
    maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/command/branch/AbstractBranchCommand.java
    maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/manager/AbstractScmManager.java
    maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/manager/ScmManager.java
    maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java
    maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java

Modified: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/command/branch/AbstractBranchCommand.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/command/branch/AbstractBranchCommand.java?view=diff&rev=526209&r1=526208&r2=526209
==============================================================================
--- maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/command/branch/AbstractBranchCommand.java
(original)
+++ maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/command/branch/AbstractBranchCommand.java
Fri Apr  6 08:57:34 2007
@@ -29,6 +29,7 @@
 import java.io.File;
 
 /**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
  * @version $Id$
  */
@@ -36,13 +37,17 @@
     extends AbstractCommand
 {
     protected abstract ScmResult executeBranch( ScmProviderRepository repository, File workingDirectory,
-                                                String branchName )
+                                                String branchName, String message )
         throws ScmException;
 
     public ScmResult executeCommand( ScmProviderRepository repository, File workingDirectory,
                                      CommandParameters parameters )
         throws ScmException
     {
-        return executeBranch( repository, workingDirectory, parameters.getString( CommandParameter.BRANCH_NAME
) );
+        String branchName = parameters.getString( CommandParameter.BRANCH_NAME );
+
+        String message = parameters.getString( CommandParameter.MESSAGE, "[maven-scm] copy
for branch " + branchName );
+
+        return executeBranch( repository, workingDirectory, branchName, message );
     }
 }

Added: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/command/branch/BranchScmResult.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/command/branch/BranchScmResult.java?view=auto&rev=526209
==============================================================================
--- maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/command/branch/BranchScmResult.java
(added)
+++ maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/command/branch/BranchScmResult.java
Fri Apr  6 08:57:34 2007
@@ -0,0 +1,58 @@
+package org.apache.maven.scm.command.branch;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * 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
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.scm.ScmResult;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ */
+public class BranchScmResult
+    extends ScmResult
+{
+    private List branchedFiles;
+
+    public BranchScmResult( String commandLine, String providerMessage, String commandOutput,
boolean success )
+    {
+        super( commandLine, providerMessage, commandOutput, success );
+    }
+
+    public BranchScmResult( String commandLine, List branchedFiles )
+    {
+        super( commandLine, null, null, true );
+
+        this.branchedFiles = branchedFiles;
+    }
+
+    public BranchScmResult( List branchedFiles, ScmResult result )
+    {
+        super( result );
+
+        this.branchedFiles = branchedFiles;
+    }
+
+    public List getBranchedFiles()
+    {
+        return branchedFiles;
+    }
+}

Propchange: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/command/branch/BranchScmResult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/command/branch/BranchScmResult.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/manager/AbstractScmManager.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/manager/AbstractScmManager.java?view=diff&rev=526209&r1=526208&r2=526209
==============================================================================
--- maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/manager/AbstractScmManager.java
(original)
+++ maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/manager/AbstractScmManager.java
Fri Apr  6 08:57:34 2007
@@ -24,6 +24,7 @@
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.ScmVersion;
 import org.apache.maven.scm.command.add.AddScmResult;
+import org.apache.maven.scm.command.branch.BranchScmResult;
 import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
 import org.apache.maven.scm.command.checkin.CheckInScmResult;
 import org.apache.maven.scm.command.checkout.CheckOutScmResult;
@@ -298,6 +299,24 @@
         throws ScmException
     {
         return this.getProviderByRepository( repository ).add( repository, fileSet, message
);
+    }
+
+    /**
+     *
+     */
+    public BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName
)
+        throws ScmException
+    {
+        return this.getProviderByRepository( repository ).branch( repository, fileSet, branchName
);
+    }
+
+    /**
+     *
+     */
+    public BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName,
String message )
+        throws ScmException
+    {
+        return this.getProviderByRepository( repository ).branch( repository, fileSet, branchName,
message );
     }
 
     /**

Modified: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/manager/ScmManager.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/manager/ScmManager.java?view=diff&rev=526209&r1=526208&r2=526209
==============================================================================
--- maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/manager/ScmManager.java
(original)
+++ maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/manager/ScmManager.java
Fri Apr  6 08:57:34 2007
@@ -24,6 +24,7 @@
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.ScmVersion;
 import org.apache.maven.scm.command.add.AddScmResult;
+import org.apache.maven.scm.command.branch.BranchScmResult;
 import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
 import org.apache.maven.scm.command.checkin.CheckInScmResult;
 import org.apache.maven.scm.command.checkout.CheckOutScmResult;
@@ -130,6 +131,33 @@
      * @throws ScmException
      */
     AddScmResult add( ScmRepository repository, ScmFileSet fileSet, String message )
+        throws ScmException;
+
+    /**
+     * Branch (or label in some systems) will create a branch of the source file with a certain
branch name
+     *
+     * @param repository the source control system
+     * @param fileSet    the files to branch. Implementations can also give the changes
+     *                   from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
+     * @param branchName the branch name to apply to the files
+     * @return
+     * @throws ScmException
+     */
+    BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName
)
+        throws ScmException;
+
+    /**
+     * Branch (or label in some systems) will create a branch of the source file with a certain
branch name
+     *
+     * @param repository the source control system
+     * @param fileSet    the files to branch. Implementations can also give the changes
+     *                   from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
+     * @param branchName the branch name to apply to the files
+     * @param message    the commit message used for the tag creation
+     * @return
+     * @throws ScmException
+     */
+    BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName,
String message )
         throws ScmException;
 
     /**

Modified: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java?view=diff&rev=526209&r1=526208&r2=526209
==============================================================================
--- maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java
(original)
+++ maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/AbstractScmProvider.java
Fri Apr  6 08:57:34 2007
@@ -28,6 +28,7 @@
 import org.apache.maven.scm.ScmRevision;
 import org.apache.maven.scm.ScmVersion;
 import org.apache.maven.scm.command.add.AddScmResult;
+import org.apache.maven.scm.command.branch.BranchScmResult;
 import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
 import org.apache.maven.scm.command.checkin.CheckInScmResult;
 import org.apache.maven.scm.command.checkout.CheckOutScmResult;
@@ -148,6 +149,42 @@
         throws ScmException
     {
         throw new NoSuchCommandScmException( "add" );
+    }
+
+    /**
+     * @see org.apache.maven.scm.provider.ScmProvider#branch(org.apache.maven.scm.repository.ScmRepository,org.apache.maven.scm.ScmFileSet,java.lang.String)
+     */
+    public BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName
)
+        throws ScmException
+    {
+        return branch( repository, fileSet, branchName, null );
+    }
+
+    /**
+     * @see org.apache.maven.scm.provider.ScmProvider#branch(org.apache.maven.scm.repository.ScmRepository,org.apache.maven.scm.ScmFileSet,java.lang.String,java.lang.String)
+     */
+    public BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName,
String message )
+        throws ScmException
+    {
+        login( repository, fileSet );
+
+        CommandParameters parameters = new CommandParameters();
+
+        parameters.setString( CommandParameter.BRANCH_NAME, branchName );
+
+        if ( StringUtils.isNotEmpty( message ) )
+        {
+            parameters.setString( CommandParameter.MESSAGE, message );
+        }
+
+        return branch( repository.getProviderRepository(), fileSet, parameters );
+    }
+
+    protected BranchScmResult branch( ScmProviderRepository repository, ScmFileSet fileSet,
+                                      CommandParameters parameters )
+        throws ScmException
+    {
+        throw new NoSuchCommandScmException( "branch" );
     }
 
     /**

Modified: maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java
URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java?view=diff&rev=526209&r1=526208&r2=526209
==============================================================================
--- maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java
(original)
+++ maven/scm/trunk/maven-scm-api/src/main/java/org/apache/maven/scm/provider/ScmProvider.java
Fri Apr  6 08:57:34 2007
@@ -24,6 +24,7 @@
 import org.apache.maven.scm.ScmFileSet;
 import org.apache.maven.scm.ScmVersion;
 import org.apache.maven.scm.command.add.AddScmResult;
+import org.apache.maven.scm.command.branch.BranchScmResult;
 import org.apache.maven.scm.command.changelog.ChangeLogScmResult;
 import org.apache.maven.scm.command.checkin.CheckInScmResult;
 import org.apache.maven.scm.command.checkout.CheckOutScmResult;
@@ -123,6 +124,33 @@
      * @throws ScmException
      */
     AddScmResult add( ScmRepository repository, ScmFileSet fileSet, String message )
+        throws ScmException;
+
+    /**
+     * Branch (or label in some systems) will create a branch of the source file with a certain
branch name
+     *
+     * @param repository the source control system
+     * @param fileSet    the files to branch. Implementations can also give the changes
+     *                   from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
+     * @param branchName the branch name to apply to the files
+     * @return
+     * @throws ScmException
+     */
+    BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName
)
+        throws ScmException;
+
+    /**
+     * Branch (or label in some systems) will create a branch of the source file with a certain
branch name
+     *
+     * @param repository the source control system
+     * @param fileSet    the files to branch. Implementations can also give the changes
+     *                   from the {@link org.apache.maven.scm.ScmFileSet#getBasedir()} downwards.
+     * @param branchName the branch name to apply to the files
+     * @param message    the commit message used for the tag creation
+     * @return
+     * @throws ScmException
+     */
+    BranchScmResult branch( ScmRepository repository, ScmFileSet fileSet, String branchName,
String message )
         throws ScmException;
 
     /**



Mime
View raw message