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.ScmVersion; |
25 | |
import org.apache.maven.scm.command.checkin.AbstractCheckInCommand; |
26 | |
import org.apache.maven.scm.command.checkin.CheckInScmResult; |
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 TfsCheckInCommand |
32 | |
extends AbstractCheckInCommand |
33 | |
{ |
34 | |
|
35 | |
protected CheckInScmResult executeCheckInCommand( ScmProviderRepository r, ScmFileSet f, String m, ScmVersion v ) |
36 | |
throws ScmException |
37 | |
{ |
38 | |
|
39 | 0 | TfsCommand command = createCommand( r, f, m ); |
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 CheckInScmResult( command.getCommandString(), "Error code for TFS checkin command - " + status, |
47 | |
err.getOutput(), false ); |
48 | |
} |
49 | 0 | return new CheckInScmResult( command.getCommandString(), fileConsumer.getFiles() ); |
50 | |
} |
51 | |
|
52 | |
public TfsCommand createCommand( ScmProviderRepository r, ScmFileSet f, String m ) |
53 | |
{ |
54 | 1 | TfsCommand command = new TfsCommand( "checkin", r, f, getLogger() ); |
55 | 1 | command.addArgument( "-noprompt" ); |
56 | 1 | if ( m != null && !m.equals( "" ) ) |
57 | |
{ |
58 | 1 | command.addArgument( "-comment:" + m + "" ); |
59 | |
} |
60 | 1 | command.addArgument( f ); |
61 | 1 | return command; |
62 | |
} |
63 | |
|
64 | |
} |