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 |
|
|
19 |
package com.nokia.maven.scm.command.pull;
|
|
20 |
|
|
21 |
import org.apache.maven.scm.CommandParameter;
|
|
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.ScmTag;
|
|
27 |
import org.apache.maven.scm.ScmVersion;
|
|
28 |
import org.apache.maven.scm.command.AbstractCommand;
|
|
29 |
import org.apache.maven.scm.provider.ScmProviderRepository;
|
|
30 |
|
628
|
31 |
|
587
|
32 |
/**
|
|
33 |
* Abstract class to representing a pull command.
|
|
34 |
* This functionality is mainly targeted for distributed
|
|
35 |
* repository like Git or Mercurial.
|
|
36 |
*/
|
|
37 |
public abstract class AbstractPullCommand extends AbstractCommand
|
|
38 |
{
|
|
39 |
|
|
40 |
/**
|
|
41 |
* {@inheritDoc}
|
|
42 |
*/
|
|
43 |
@Override
|
|
44 |
public ScmResult executeCommand(ScmProviderRepository repository, ScmFileSet fileSet,
|
|
45 |
CommandParameters parameters) throws ScmException
|
|
46 |
{
|
|
47 |
return executePullCommand(repository, fileSet, parameters.getScmVersion(CommandParameter.SCM_VERSION, new ScmTag("tip")));
|
|
48 |
}
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Implements the pull functionality.
|
|
52 |
* @param repository the reporsitory.
|
|
53 |
* @param fileSet
|
|
54 |
* @param scmVersion what revision to pull.
|
|
55 |
* @return
|
|
56 |
* @throws ScmException
|
|
57 |
*/
|
|
58 |
protected abstract PullScmResult executePullCommand(ScmProviderRepository repository, ScmFileSet fileSet, ScmVersion scmVersion) throws ScmException;
|
|
59 |
|
|
60 |
}
|