1 package org.apache.maven.scm.provider.cvslib.cvsjava.command.add;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.List;
23
24 import org.apache.maven.scm.ScmException;
25 import org.apache.maven.scm.ScmFile;
26 import org.apache.maven.scm.command.add.AddScmResult;
27 import org.apache.maven.scm.provider.cvslib.command.add.AbstractCvsAddCommand;
28 import org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsConnection;
29 import org.apache.maven.scm.provider.cvslib.cvsjava.util.CvsLogListener;
30 import org.codehaus.plexus.util.cli.Commandline;
31
32
33
34
35
36 public class CvsJavaAddCommand
37 extends AbstractCvsAddCommand
38 {
39
40 protected AddScmResult executeCvsCommand( Commandline cl, List<ScmFile> addedFiles )
41 throws ScmException
42 {
43 CvsLogListener logListener = new CvsLogListener();
44
45 try
46 {
47 boolean isSuccess = CvsConnection.processCommand( cl.getArguments(),
48 cl.getWorkingDirectory().getAbsolutePath(), logListener,
49 getLogger() );
50
51
52 if ( !isSuccess )
53 {
54 return new AddScmResult( cl.toString(), "The cvs command failed.", logListener.getStdout().toString(),
55 false );
56 }
57
58 return new AddScmResult( cl.toString(), addedFiles );
59 }
60 catch ( Exception e )
61 {
62 e.printStackTrace();
63 return new AddScmResult( cl.toString(), "The cvs command failed.", logListener.getStdout().toString(),
64 false );
65 }
66 }
67 }