1 package org.apache.maven.scm.provider.accurev.command.blame;
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.CommandParameter;
23 import org.apache.maven.scm.CommandParameters;
24 import org.apache.maven.scm.ScmException;
25 import org.apache.maven.scm.ScmFileSet;
26 import org.apache.maven.scm.command.blame.BlameLine;
27 import org.apache.maven.scm.command.blame.BlameScmResult;
28 import org.apache.maven.scm.log.ScmLogger;
29 import org.apache.maven.scm.provider.ScmProviderRepository;
30 import org.apache.maven.scm.provider.accurev.AccuRev;
31 import org.apache.maven.scm.provider.accurev.AccuRevException;
32 import org.apache.maven.scm.provider.accurev.AccuRevScmProviderRepository;
33 import org.apache.maven.scm.provider.accurev.command.AbstractAccuRevCommand;
34
35 import java.io.File;
36 import java.util.List;
37
38
39
40
41
42
43 public class AccuRevBlameCommand
44 extends AbstractAccuRevCommand
45 {
46
47 public AccuRevBlameCommand( ScmLogger logger )
48 {
49 super( logger );
50 }
51
52 @Override
53 protected BlameScmResult executeAccurevCommand( AccuRevScmProviderRepository repository, ScmFileSet fileSet,
54 CommandParameters parameters )
55 throws ScmException, AccuRevException
56 {
57
58 AccuRev accuRev = repository.getAccuRev();
59
60 File file = new File( parameters.getString( CommandParameter.FILE ) );
61
62 List<BlameLine> lines = accuRev.annotate( fileSet.getBasedir(), file );
63
64 if ( lines != null )
65 {
66 return new BlameScmResult( accuRev.getCommandLines(), lines );
67 }
68 else
69 {
70 return new BlameScmResult( accuRev.getCommandLines(), "AccuRev Error", accuRev.getErrorOutput(), false );
71 }
72
73 }
74
75 public BlameScmResult blame( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters )
76 throws ScmException
77 {
78 return (BlameScmResult) execute( repository, fileSet, parameters );
79 }
80 }