1 | |
package org.apache.maven.scm.command.branch; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import org.apache.maven.scm.CommandParameter; |
23 | |
import org.apache.maven.scm.CommandParameters; |
24 | |
import org.apache.maven.scm.ScmBranchParameters; |
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.command.AbstractCommand; |
29 | |
import org.apache.maven.scm.provider.ScmProviderRepository; |
30 | |
import org.codehaus.plexus.util.StringUtils; |
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | 0 | public abstract class AbstractBranchCommand |
38 | |
extends AbstractCommand |
39 | |
{ |
40 | |
protected abstract ScmResult executeBranchCommand( ScmProviderRepository repository, ScmFileSet fileSet, |
41 | |
String branchName, String message ) |
42 | |
throws ScmException; |
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
|
53 | |
|
54 | |
protected ScmResult executeBranchCommand( ScmProviderRepository repository, ScmFileSet fileSet, String branchName, |
55 | |
ScmBranchParameters scmBranchParameters ) |
56 | |
throws ScmException |
57 | |
{ |
58 | 0 | return executeBranchCommand( repository, fileSet, branchName, scmBranchParameters.getMessage() ); |
59 | |
} |
60 | |
|
61 | |
|
62 | |
public ScmResult executeCommand( ScmProviderRepository repository, ScmFileSet fileSet, |
63 | |
CommandParameters parameters ) |
64 | |
throws ScmException |
65 | |
{ |
66 | 0 | String branchName = parameters.getString( CommandParameter.BRANCH_NAME ); |
67 | |
|
68 | 0 | ScmBranchParameters scmBranchParameters = parameters.getScmBranchParameters( CommandParameter.SCM_BRANCH_PARAMETERS ); |
69 | |
|
70 | 0 | String message = parameters.getString( CommandParameter.MESSAGE, "[maven-scm] copy for branch " + branchName ); |
71 | |
|
72 | 0 | if (StringUtils.isBlank( scmBranchParameters.getMessage()) && StringUtils.isNotBlank( message ) ) |
73 | |
{ |
74 | 0 | scmBranchParameters.setMessage( message ); |
75 | |
} |
76 | |
|
77 | 0 | return executeBranchCommand( repository, fileSet, branchName, scmBranchParameters ); |
78 | |
} |
79 | |
} |