Coverage Report - org.apache.maven.scm.provider.cvslib.command.tag.AbstractCvsTagCommand
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractCvsTagCommand
0 %
0/18
0 %
0/10
2,667
 
 1  
 package org.apache.maven.scm.provider.cvslib.command.tag;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  * http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.io.File;
 23  
 import java.util.Iterator;
 24  
 
 25  
 import org.apache.maven.scm.ScmException;
 26  
 import org.apache.maven.scm.ScmFileSet;
 27  
 import org.apache.maven.scm.ScmResult;
 28  
 import org.apache.maven.scm.ScmTagParameters;
 29  
 import org.apache.maven.scm.command.tag.AbstractTagCommand;
 30  
 import org.apache.maven.scm.command.tag.TagScmResult;
 31  
 import org.apache.maven.scm.provider.ScmProviderRepository;
 32  
 import org.apache.maven.scm.provider.cvslib.command.CvsCommand;
 33  
 import org.apache.maven.scm.provider.cvslib.command.CvsCommandUtils;
 34  
 import org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository;
 35  
 import org.apache.maven.scm.provider.cvslib.util.CvsUtil;
 36  
 import org.apache.maven.scm.providers.cvslib.settings.Settings;
 37  
 import org.codehaus.plexus.util.cli.Commandline;
 38  
 
 39  
 /**
 40  
  * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse </a>
 41  
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
 42  
  * @version $Id: AbstractCvsTagCommand.java 1056959 2011-01-09 15:02:55Z olamy $
 43  
  */
 44  0
 public abstract class AbstractCvsTagCommand
 45  
     extends AbstractTagCommand
 46  
     implements CvsCommand
 47  
 {
 48  
     
 49  
     public ScmResult executeTagCommand( ScmProviderRepository repo, ScmFileSet fileSet, String tag, String message )
 50  
         throws ScmException
 51  
     {
 52  0
         return executeTagCommand( repo, fileSet, tag, new ScmTagParameters( message ) );
 53  
     }
 54  
 
 55  
     /** {@inheritDoc} */
 56  
     public ScmResult executeTagCommand( ScmProviderRepository repo, ScmFileSet fileSet, String tag,
 57  
                                         ScmTagParameters scmTagParameters )
 58  
         throws ScmException
 59  
     {
 60  0
         CvsScmProviderRepository repository = (CvsScmProviderRepository) repo;
 61  
 
 62  0
         Commandline cl = CvsCommandUtils.getBaseCommand( "tag", repository, fileSet, false );
 63  
 
 64  0
         Settings settings = CvsUtil.getSettings();
 65  0
         if ( settings.isUseForceTag() )
 66  
         {
 67  0
             cl.createArg().setValue( "-F" );
 68  
         }
 69  
 
 70  0
         cl.createArg().setValue( "-c" );
 71  
 
 72  0
         cl.createArg().setValue( tag );
 73  
 
 74  0
         if ( fileSet.getFileList() != null && !fileSet.getFileList().isEmpty() )
 75  
         {
 76  0
             for ( Iterator<File> it = fileSet.getFileList().iterator(); it.hasNext(); )
 77  
             {
 78  0
                 File fileName = it.next();
 79  0
                 cl.createArg().setValue( fileName.toString() );
 80  0
             }
 81  
         }
 82  
 
 83  0
         if ( getLogger().isInfoEnabled() )
 84  
         {
 85  0
             getLogger().info( "Executing: " + cl );
 86  0
             getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() );
 87  
         }
 88  
 
 89  0
         return executeCvsCommand( cl );
 90  
     }
 91  
 
 92  
     protected abstract TagScmResult executeCvsCommand( Commandline cl )
 93  
         throws ScmException;
 94  
 }