1 package org.apache.maven.scm.provider.git.gitexe;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.File;
23
24 import org.apache.maven.scm.ScmException;
25 import org.apache.maven.scm.ScmFileSet;
26 import org.apache.maven.scm.command.info.InfoScmResult;
27 import org.apache.maven.scm.provider.git.AbstractGitScmProvider;
28 import org.apache.maven.scm.provider.git.command.GitCommand;
29 import org.apache.maven.scm.provider.git.gitexe.command.add.GitAddCommand;
30 import org.apache.maven.scm.provider.git.gitexe.command.blame.GitBlameCommand;
31 import org.apache.maven.scm.provider.git.gitexe.command.branch.GitBranchCommand;
32 import org.apache.maven.scm.provider.git.gitexe.command.changelog.GitChangeLogCommand;
33 import org.apache.maven.scm.provider.git.gitexe.command.checkin.GitCheckInCommand;
34 import org.apache.maven.scm.provider.git.gitexe.command.checkout.GitCheckOutCommand;
35 import org.apache.maven.scm.provider.git.gitexe.command.diff.GitDiffCommand;
36 import org.apache.maven.scm.provider.git.gitexe.command.info.GitInfoCommand;
37 import org.apache.maven.scm.provider.git.gitexe.command.remoteinfo.GitRemoteInfoCommand;
38 import org.apache.maven.scm.provider.git.gitexe.command.remove.GitRemoveCommand;
39 import org.apache.maven.scm.provider.git.gitexe.command.status.GitStatusCommand;
40 import org.apache.maven.scm.provider.git.gitexe.command.tag.GitTagCommand;
41 import org.apache.maven.scm.provider.git.gitexe.command.update.GitUpdateCommand;
42 import org.apache.maven.scm.provider.git.repository.GitScmProviderRepository;
43 import org.apache.maven.scm.repository.ScmRepositoryException;
44
45
46
47
48
49
50 public class GitExeScmProvider
51 extends AbstractGitScmProvider
52 {
53
54 protected GitCommand getAddCommand()
55 {
56 return new GitAddCommand();
57 }
58
59
60 protected GitCommand getBranchCommand()
61 {
62 return new GitBranchCommand();
63 }
64
65
66 protected GitCommand getChangeLogCommand()
67 {
68 return new GitChangeLogCommand();
69 }
70
71
72 protected GitCommand getCheckInCommand()
73 {
74 return new GitCheckInCommand();
75 }
76
77
78 protected GitCommand getCheckOutCommand()
79 {
80 return new GitCheckOutCommand();
81 }
82
83
84 protected GitCommand getDiffCommand()
85 {
86 return new GitDiffCommand();
87 }
88
89
90 protected GitCommand getExportCommand()
91 {
92 return null;
93 }
94
95
96 protected GitCommand getRemoveCommand()
97 {
98 return new GitRemoveCommand();
99 }
100
101
102 protected GitCommand getStatusCommand()
103 {
104 return new GitStatusCommand();
105 }
106
107
108 protected GitCommand getTagCommand()
109 {
110 return new GitTagCommand();
111 }
112
113
114 protected GitCommand getUpdateCommand()
115 {
116 return new GitUpdateCommand();
117 }
118
119
120 public GitCommand getInfoCommand()
121 {
122 return new GitInfoCommand();
123 }
124
125
126 protected GitCommand getBlameCommand()
127 {
128 return new GitBlameCommand();
129 }
130
131
132 protected GitCommand getRemoteInfoCommand()
133 {
134 return new GitRemoteInfoCommand();
135 }
136
137
138 protected String getRepositoryURL( File path )
139 throws ScmException
140 {
141
142
143
144 InfoScmResult result = info( new GitScmProviderRepository( path.getPath() ), new ScmFileSet( path ), null );
145
146 if ( result.getInfoItems().size() != 1 )
147 {
148 throw new ScmRepositoryException( "Cannot find URL: "
149 + ( result.getInfoItems().size() == 0 ? "no" : "multiple" ) + " items returned by the info command" );
150 }
151
152 return result.getInfoItems().get( 0 ).getURL();
153 }
154 }