1 package org.apache.maven.scm.provider.svn.svnexe;
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.CommandParameters;
25 import org.apache.maven.scm.ScmException;
26 import org.apache.maven.scm.ScmFileSet;
27 import org.apache.maven.scm.command.info.InfoScmResult;
28 import org.apache.maven.scm.command.remoteinfo.RemoteInfoScmResult;
29 import org.apache.maven.scm.provider.ScmProviderRepository;
30 import org.apache.maven.scm.provider.svn.AbstractSvnScmProvider;
31 import org.apache.maven.scm.provider.svn.command.SvnCommand;
32 import org.apache.maven.scm.provider.svn.svnexe.command.add.SvnAddCommand;
33 import org.apache.maven.scm.provider.svn.svnexe.command.blame.SvnBlameCommand;
34 import org.apache.maven.scm.provider.svn.svnexe.command.branch.SvnBranchCommand;
35 import org.apache.maven.scm.provider.svn.svnexe.command.changelog.SvnChangeLogCommand;
36 import org.apache.maven.scm.provider.svn.svnexe.command.checkin.SvnCheckInCommand;
37 import org.apache.maven.scm.provider.svn.svnexe.command.checkout.SvnCheckOutCommand;
38 import org.apache.maven.scm.provider.svn.svnexe.command.diff.SvnDiffCommand;
39 import org.apache.maven.scm.provider.svn.svnexe.command.export.SvnExeExportCommand;
40 import org.apache.maven.scm.provider.svn.svnexe.command.info.SvnInfoCommand;
41 import org.apache.maven.scm.provider.svn.svnexe.command.list.SvnListCommand;
42 import org.apache.maven.scm.provider.svn.svnexe.command.mkdir.SvnMkdirCommand;
43 import org.apache.maven.scm.provider.svn.svnexe.command.remoteinfo.SvnRemoteInfoCommand;
44 import org.apache.maven.scm.provider.svn.svnexe.command.remove.SvnRemoveCommand;
45 import org.apache.maven.scm.provider.svn.svnexe.command.status.SvnStatusCommand;
46 import org.apache.maven.scm.provider.svn.svnexe.command.tag.SvnTagCommand;
47 import org.apache.maven.scm.provider.svn.svnexe.command.update.SvnUpdateCommand;
48 import org.apache.maven.scm.repository.ScmRepositoryException;
49
50
51
52
53
54
55 public class SvnExeScmProvider
56 extends AbstractSvnScmProvider
57 {
58
59
60
61 protected SvnCommand getAddCommand()
62 {
63 return new SvnAddCommand();
64 }
65
66
67
68
69 protected SvnCommand getBranchCommand()
70 {
71 return new SvnBranchCommand();
72 }
73
74
75
76
77 protected SvnCommand getChangeLogCommand()
78 {
79 return new SvnChangeLogCommand();
80 }
81
82
83
84
85 protected SvnCommand getCheckInCommand()
86 {
87 return new SvnCheckInCommand();
88 }
89
90
91
92
93 protected SvnCommand getCheckOutCommand()
94 {
95 return new SvnCheckOutCommand();
96 }
97
98
99
100
101 protected SvnCommand getDiffCommand()
102 {
103 return new SvnDiffCommand();
104 }
105
106
107
108
109 protected SvnCommand getExportCommand()
110 {
111 return new SvnExeExportCommand();
112 }
113
114
115
116
117 protected SvnCommand getRemoveCommand()
118 {
119 return new SvnRemoveCommand();
120 }
121
122
123
124
125 protected SvnCommand getStatusCommand()
126 {
127 return new SvnStatusCommand();
128 }
129
130
131
132
133 protected SvnCommand getTagCommand()
134 {
135 return new SvnTagCommand();
136 }
137
138
139
140
141 protected SvnCommand getUpdateCommand()
142 {
143 return new SvnUpdateCommand();
144 }
145
146
147
148
149 protected SvnCommand getListCommand()
150 {
151 return new SvnListCommand();
152 }
153
154 public SvnCommand getInfoCommand()
155 {
156 return new SvnInfoCommand();
157 }
158
159
160
161
162 protected SvnCommand getBlameCommand()
163 {
164 return new SvnBlameCommand();
165 }
166
167
168
169
170 protected SvnCommand getMkdirCommand()
171 {
172 return new SvnMkdirCommand();
173 }
174
175
176
177
178 protected String getRepositoryURL( File path )
179 throws ScmException
180 {
181
182
183 SvnInfoCommand infoCmd = (SvnInfoCommand) getInfoCommand();
184 infoCmd.setLogger( this.getLogger() );
185 InfoScmResult result =
186 infoCmd.executeInfoCommand( null, new ScmFileSet( new File( "" ), path ), null, false, null );
187
188 if ( result.getInfoItems().size() != 1 )
189 {
190 throw new ScmRepositoryException(
191 "Cannot find URL: " + ( result.getInfoItems().size() == 0 ? "no" : "multiple" )
192 + " items returned by the info command" );
193 }
194
195 return result.getInfoItems().get( 0 ).getURL();
196 }
197
198 @Override
199 public RemoteInfoScmResult remoteInfo( ScmProviderRepository repository, ScmFileSet fileSet,
200 CommandParameters parameters )
201 throws ScmException
202 {
203 SvnRemoteInfoCommand svnRemoteInfoCommand = new SvnRemoteInfoCommand();
204 return svnRemoteInfoCommand.executeRemoteInfoCommand( repository, fileSet, parameters );
205 }
206
207 @Override
208 public boolean remoteUrlExist( ScmProviderRepository repository, CommandParameters parameters )
209 throws ScmException
210 {
211 SvnRemoteInfoCommand svnRemoteInfoCommand = new SvnRemoteInfoCommand();
212 return svnRemoteInfoCommand.remoteUrlExist( repository, parameters );
213 }
214 }