1 | |
package org.apache.maven.scm.provider.cvslib.command.tag; |
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
import java.io.File; |
23 | |
import java.util.Iterator; |
24 | |
|
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.ScmTagParameters; |
29 | |
import org.apache.maven.scm.command.tag.AbstractTagCommand; |
30 | |
import org.apache.maven.scm.command.tag.TagScmResult; |
31 | |
import org.apache.maven.scm.provider.ScmProviderRepository; |
32 | |
import org.apache.maven.scm.provider.cvslib.command.CvsCommand; |
33 | |
import org.apache.maven.scm.provider.cvslib.command.CvsCommandUtils; |
34 | |
import org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository; |
35 | |
import org.apache.maven.scm.provider.cvslib.util.CvsUtil; |
36 | |
import org.apache.maven.scm.providers.cvslib.settings.Settings; |
37 | |
import org.codehaus.plexus.util.cli.Commandline; |
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | 0 | public abstract class AbstractCvsTagCommand |
45 | |
extends AbstractTagCommand |
46 | |
implements CvsCommand |
47 | |
{ |
48 | |
|
49 | |
public ScmResult executeTagCommand( ScmProviderRepository repo, ScmFileSet fileSet, String tag, String message ) |
50 | |
throws ScmException |
51 | |
{ |
52 | 0 | return executeTagCommand( repo, fileSet, tag, new ScmTagParameters( message ) ); |
53 | |
} |
54 | |
|
55 | |
|
56 | |
public ScmResult executeTagCommand( ScmProviderRepository repo, ScmFileSet fileSet, String tag, |
57 | |
ScmTagParameters scmTagParameters ) |
58 | |
throws ScmException |
59 | |
{ |
60 | 0 | CvsScmProviderRepository repository = (CvsScmProviderRepository) repo; |
61 | |
|
62 | 0 | Commandline cl = CvsCommandUtils.getBaseCommand( "tag", repository, fileSet, false ); |
63 | |
|
64 | 0 | Settings settings = CvsUtil.getSettings(); |
65 | 0 | if ( settings.isUseForceTag() ) |
66 | |
{ |
67 | 0 | cl.createArg().setValue( "-F" ); |
68 | |
} |
69 | |
|
70 | 0 | cl.createArg().setValue( "-c" ); |
71 | |
|
72 | 0 | cl.createArg().setValue( tag ); |
73 | |
|
74 | 0 | if ( fileSet.getFileList() != null && !fileSet.getFileList().isEmpty() ) |
75 | |
{ |
76 | 0 | for ( Iterator<File> it = fileSet.getFileList().iterator(); it.hasNext(); ) |
77 | |
{ |
78 | 0 | File fileName = it.next(); |
79 | 0 | cl.createArg().setValue( fileName.toString() ); |
80 | 0 | } |
81 | |
} |
82 | |
|
83 | 0 | if ( getLogger().isInfoEnabled() ) |
84 | |
{ |
85 | 0 | getLogger().info( "Executing: " + cl ); |
86 | 0 | getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() ); |
87 | |
} |
88 | |
|
89 | 0 | return executeCvsCommand( cl ); |
90 | |
} |
91 | |
|
92 | |
protected abstract TagScmResult executeCvsCommand( Commandline cl ) |
93 | |
throws ScmException; |
94 | |
} |