587
|
1 |
/*
|
628
|
2 |
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
587
|
17 |
|
|
18 |
package com.nokia.maven.scm.provider.hg.command.info;
|
|
19 |
|
|
20 |
import java.io.File;
|
|
21 |
|
|
22 |
import org.apache.maven.scm.CommandParameters;
|
|
23 |
import org.apache.maven.scm.ScmException;
|
|
24 |
import org.apache.maven.scm.ScmFileSet;
|
|
25 |
import org.apache.maven.scm.ScmResult;
|
|
26 |
import org.apache.maven.scm.provider.ScmProviderRepository;
|
|
27 |
import org.apache.maven.scm.provider.hg.HgUtils;
|
|
28 |
import org.apache.maven.scm.provider.hg.command.HgCommandConstants;
|
|
29 |
|
|
30 |
import com.nokia.maven.scm.command.info.AbstractInfoCommand;
|
|
31 |
import com.nokia.maven.scm.command.info.InfoScmResult;
|
|
32 |
|
|
33 |
/**
|
|
34 |
* 'hg info' command implementation.
|
|
35 |
*/
|
628
|
36 |
public class HgInfoCommand extends AbstractInfoCommand {
|
587
|
37 |
@Override
|
628
|
38 |
protected InfoScmResult executeInfoCommand(ScmProviderRepository repository,
|
|
39 |
ScmFileSet fileSet, CommandParameters parameters) throws ScmException {
|
587
|
40 |
|
|
41 |
File workingDir = fileSet.getBasedir();
|
|
42 |
// Update branch
|
628
|
43 |
String[] updateCmd = new String[] { HgCommandConstants.REVNO_CMD };
|
|
44 |
|
|
45 |
HgInfoConsumer consumer = new HgInfoConsumer(getLogger());
|
587
|
46 |
|
628
|
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());
|
587
|
51 |
}
|
628
|
52 |
|
587
|
53 |
this.getLogger().info(infoResult.getCommandOutput());
|
|
54 |
return new InfoScmResult(infoResult.getCommandLine(), infoResult.getProviderMessage(), infoResult.getCommandOutput(), infoResult.isSuccess(), consumer.getRevision());
|
628
|
55 |
|
587
|
56 |
}
|
|
57 |
}
|