1 package org.apache.maven.scm.provider.cvslib.cvsexe.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.ScmException;
23 import org.apache.maven.scm.command.branch.BranchScmResult;
24 import org.apache.maven.scm.provider.cvslib.command.branch.AbstractCvsBranchCommand;
25 import org.apache.maven.scm.provider.cvslib.command.branch.CvsBranchConsumer;
26 import org.codehaus.plexus.util.cli.CommandLineException;
27 import org.codehaus.plexus.util.cli.CommandLineUtils;
28 import org.codehaus.plexus.util.cli.Commandline;
29
30
31
32
33
34
35 public class CvsExeBranchCommand
36 extends AbstractCvsBranchCommand
37 {
38
39 protected BranchScmResult executeCvsCommand( Commandline cl )
40 throws ScmException
41 {
42 int exitCode;
43
44 CvsBranchConsumer consumer = new CvsBranchConsumer( getLogger() );
45
46 CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer();
47
48 try
49 {
50 exitCode = CommandLineUtils.executeCommandLine( cl, consumer, stderr );
51 }
52 catch ( CommandLineException ex )
53 {
54 throw new ScmException( "Error while executing command.", ex );
55 }
56
57 if ( exitCode != 0 )
58 {
59 return new BranchScmResult( cl.toString(), "The cvs branch command failed.", stderr.getOutput(), false );
60 }
61
62 return new BranchScmResult( cl.toString(), consumer.getTaggedFiles() );
63
64 }
65 }