buildframework/helium/sf/java/scm/src/com/nokia/maven/scm/provider/hg/command/info/HgInfoCommand.java
changeset 628 7c4a911dc066
parent 587 85df38eb4012
equal deleted inserted replaced
588:c7c26511138f 628:7c4a911dc066
     1 /*
     1 /*
     2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
     2  * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3  * All rights reserved.
     4 * This component and the accompanying materials are made available
     4  * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     5  * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6  * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     8  *
     9 * Initial Contributors:
     9  * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10  * Nokia Corporation - initial contribution.
    11 *
    11  *
    12 * Contributors:
    12  * Contributors:
    13 *
    13  *
    14 * Description:  
    14  * Description:  
    15 *
    15  *
    16 */
    16  */
    17 
       
    18 
    17 
    19 package com.nokia.maven.scm.provider.hg.command.info;
    18 package com.nokia.maven.scm.provider.hg.command.info;
    20 
    19 
    21 import java.io.File;
    20 import java.io.File;
    22 
    21 
    32 import com.nokia.maven.scm.command.info.InfoScmResult;
    31 import com.nokia.maven.scm.command.info.InfoScmResult;
    33 
    32 
    34 /**
    33 /**
    35  * 'hg info' command implementation.
    34  * 'hg info' command implementation.
    36  */
    35  */
    37 public class HgInfoCommand extends AbstractInfoCommand
    36 public class HgInfoCommand extends AbstractInfoCommand {
    38 {
       
    39     @Override
    37     @Override
    40     protected InfoScmResult executeInfoCommand(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    38     protected InfoScmResult executeInfoCommand(ScmProviderRepository repository,
       
    39         ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
    41 
    40 
    42         File workingDir = fileSet.getBasedir();
    41         File workingDir = fileSet.getBasedir();
    43         // Update branch
    42         // Update branch
    44         String[] updateCmd = new String[] {
    43         String[] updateCmd = new String[] { HgCommandConstants.REVNO_CMD };
    45             HgCommandConstants.REVNO_CMD
       
    46         };
       
    47         
       
    48         HgInfoConsumer consumer = new HgInfoConsumer( getLogger() );
       
    49         
       
    50         ScmResult infoResult = HgUtils.execute(consumer , getLogger(), workingDir, updateCmd );
       
    51 
    44 
    52         if ( !infoResult.isSuccess() )
    45         HgInfoConsumer consumer = new HgInfoConsumer(getLogger());
    53         {
    46 
    54             return new InfoScmResult(infoResult.getCommandLine(), infoResult.getProviderMessage(), infoResult.getCommandOutput(), infoResult.isSuccess() );
    47         ScmResult infoResult = HgUtils.execute(consumer, getLogger(), workingDir, updateCmd);
       
    48 
       
    49         if (!infoResult.isSuccess()) {
       
    50             return new InfoScmResult(infoResult.getCommandLine(), infoResult.getProviderMessage(), infoResult.getCommandOutput(), infoResult.isSuccess());
    55         }
    51         }
    56         
    52 
    57         this.getLogger().info(infoResult.getCommandOutput());
    53         this.getLogger().info(infoResult.getCommandOutput());
    58         return new InfoScmResult(infoResult.getCommandLine(), infoResult.getProviderMessage(), infoResult.getCommandOutput(), infoResult.isSuccess(), consumer.getRevision());
    54         return new InfoScmResult(infoResult.getCommandLine(), infoResult.getProviderMessage(), infoResult.getCommandOutput(), infoResult.isSuccess(), consumer.getRevision());
    59         
    55 
    60     }
    56     }
    61 }
    57 }
    62 
       
    63