587
|
1 |
/*
|
|
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 |
*/
|
|
17 |
|
|
18 |
package com.nokia.maven.scm.provider.hg.command.branch;
|
|
19 |
|
628
|
20 |
import java.io.File;
|
|
21 |
import java.util.ArrayList;
|
|
22 |
import java.util.List;
|
|
23 |
|
587
|
24 |
import org.apache.maven.scm.ScmException;
|
|
25 |
import org.apache.maven.scm.ScmFileSet;
|
|
26 |
import org.apache.maven.scm.ScmResult;
|
|
27 |
import org.apache.maven.scm.command.branch.AbstractBranchCommand;
|
|
28 |
import org.apache.maven.scm.command.branch.BranchScmResult;
|
|
29 |
import org.apache.maven.scm.provider.ScmProviderRepository;
|
|
30 |
import org.apache.maven.scm.provider.hg.HgUtils;
|
|
31 |
|
|
32 |
/**
|
|
33 |
* Branch command to create a new branch
|
|
34 |
*/
|
|
35 |
public class HgBranchCommand
|
|
36 |
extends AbstractBranchCommand
|
|
37 |
{
|
|
38 |
/** {@inheritDoc} */
|
|
39 |
protected ScmResult executeBranchCommand( ScmProviderRepository repository, ScmFileSet fileSet, String name, String message )
|
|
40 |
throws ScmException
|
|
41 |
{
|
|
42 |
// Create command
|
|
43 |
File workingDir = fileSet.getBasedir();
|
|
44 |
List<String> branchCmd = new ArrayList<String>();
|
|
45 |
|
|
46 |
//branch command
|
|
47 |
branchCmd.add("branch");
|
|
48 |
branchCmd.add(name);
|
|
49 |
|
|
50 |
ScmResult branchResult = HgUtils.execute(workingDir, branchCmd.toArray(new String[branchCmd.size()]));
|
|
51 |
|
|
52 |
return new BranchScmResult(branchResult.getCommandLine(),
|
|
53 |
branchResult.getProviderMessage(), branchResult
|
|
54 |
.getCommandOutput(), branchResult.isSuccess());
|
|
55 |
}
|
|
56 |
}
|