1 | |
package org.apache.maven.scm.provider.tfs.command; |
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.ScmException; |
23 | |
import org.apache.maven.scm.ScmFileSet; |
24 | |
import org.apache.maven.scm.ScmResult; |
25 | |
import org.apache.maven.scm.command.add.AbstractAddCommand; |
26 | |
import org.apache.maven.scm.command.add.AddScmResult; |
27 | |
import org.apache.maven.scm.provider.ScmProviderRepository; |
28 | |
import org.apache.maven.scm.provider.tfs.command.consumer.ErrorStreamConsumer; |
29 | |
import org.apache.maven.scm.provider.tfs.command.consumer.FileListConsumer; |
30 | |
|
31 | 1 | public class TfsAddCommand |
32 | |
extends AbstractAddCommand |
33 | |
{ |
34 | |
|
35 | |
protected ScmResult executeAddCommand( ScmProviderRepository r, ScmFileSet f, String m, boolean b ) |
36 | |
throws ScmException |
37 | |
{ |
38 | 0 | TfsCommand command = createCommand( r, f ); |
39 | |
|
40 | 0 | FileListConsumer fileConsumer = new FileListConsumer(); |
41 | 0 | ErrorStreamConsumer err = new ErrorStreamConsumer(); |
42 | |
|
43 | 0 | int status = command.execute( fileConsumer, err ); |
44 | 0 | if ( status != 0 || err.hasBeenFed() ) |
45 | |
{ |
46 | 0 | return new AddScmResult( command.getCommandString(), "Error code for TFS add command - " + status, |
47 | |
err.getOutput(), false ); |
48 | |
} |
49 | |
|
50 | 0 | return new AddScmResult( command.getCommandString(), fileConsumer.getFiles() ); |
51 | |
} |
52 | |
|
53 | |
public TfsCommand createCommand( ScmProviderRepository r, ScmFileSet f ) |
54 | |
{ |
55 | 1 | TfsCommand command = new TfsCommand( "add", r, f, getLogger() ); |
56 | 1 | command.addArgument( f ); |
57 | 1 | return command; |
58 | |
} |
59 | |
|
60 | |
} |