1 // TortoiseSVN - a Windows shell extension for easy version control
\r
3 // Copyright (C) 2007-2008 - TortoiseSVN
\r
5 // This program is free software; you can redistribute it and/or
\r
6 // modify it under the terms of the GNU General Public License
\r
7 // as published by the Free Software Foundation; either version 2
\r
8 // of the License, or (at your option) any later version.
\r
10 // This program is distributed in the hope that it will be useful,
\r
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 // GNU General Public License for more details.
\r
15 // You should have received a copy of the GNU General Public License
\r
16 // along with this program; if not, write to the Free Software Foundation,
\r
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
20 #include "Command.h"
\r
22 #include "AboutCommand.h"
\r
23 #include "CommitCommand.h"
\r
25 #include "AddCommand.h"
\r
26 #include "BlameCommand.h"
\r
27 #include "CatCommand.h"
\r
28 #include "CheckoutCommand.h"
\r
29 #include "CleanupCommand.h"
\r
31 #include "ConflictEditorCommand.h"
\r
32 #include "CopyCommand.h"
\r
33 #include "CrashCommand.h"
\r
34 #include "CreatePatchCommand.h"
\r
35 #include "CreateRepositoryCommand.h"
\r
36 #include "DelUnversionedCommand.h"
\r
37 #include "DiffCommand.h"
\r
38 #include "DropCopyAddCommand.h"
\r
39 #include "DropCopyCommand.h"
\r
40 #include "DropExportCommand.h"
\r
41 #include "DropMoveCommand.h"
\r
42 #include "ExportCommand.h"
\r
43 #include "HelpCommand.h"
\r
44 #include "IgnoreCommand.h"
\r
45 #include "ImportCommand.h"
\r
46 #include "LockCommand.h"
\r
47 #include "LogCommand.h"
\r
48 #include "MergeCommand.h"
\r
49 #include "MergeAllCommand.h"
\r
50 #include "PasteCopyCommand.h"
\r
51 #include "PasteMoveCommand.h"
\r
52 #include "PrevDiffCommand.h"
\r
53 #include "PropertiesCommand.h"
\r
54 #include "RebuildIconCacheCommand.h"
\r
55 #include "RelocateCommand.h"
\r
56 #include "RemoveCommand.h"
\r
57 #include "RenameCommand.h"
\r
58 #include "RepositoryBrowserCommand.h"
\r
59 #include "RepoStatusCommand.h"
\r
60 #include "ResolveCommand.h"
\r
61 #include "RevertCommand.h"
\r
62 #include "RevisiongraphCommand.h"
\r
63 #include "RTFMCommand.h"
\r
64 #include "SettingsCommand.h"
\r
65 #include "ShowCompareCommand.h"
\r
66 #include "SwitchCommand.h"
\r
67 #include "UnIgnoreCommand.h"
\r
68 #include "UnLockCommand.h"
\r
69 #include "UpdateCheckCommand.h"
\r
70 #include "UpdateCommand.h"
\r
71 #include "UrlDiffCommand.h"
\r
105 cmdRebuildIconCache,
\r
125 static const struct CommandInfo
\r
127 TGitCommand command;
\r
128 LPCTSTR pCommandName;
\r
131 { cmdAbout, _T("about") },
\r
132 { cmdAdd, _T("add") },
\r
133 { cmdBlame, _T("blame") },
\r
134 { cmdCat, _T("cat") },
\r
135 { cmdCheckout, _T("checkout") },
\r
136 { cmdCleanup, _T("cleanup") },
\r
137 { cmdCommit, _T("commit") },
\r
138 { cmdConflictEditor, _T("conflicteditor") },
\r
139 { cmdCopy, _T("copy") },
\r
140 { cmdCrash, _T("crash") },
\r
141 { cmdCreatePatch, _T("createpatch") },
\r
142 { cmdDelUnversioned, _T("delunversioned") },
\r
143 { cmdDiff, _T("diff") },
\r
144 { cmdDropCopy, _T("dropcopy") },
\r
145 { cmdDropCopyAdd, _T("dropcopyadd") },
\r
146 { cmdDropExport, _T("dropexport") },
\r
147 { cmdDropMove, _T("dropmove") },
\r
148 { cmdExport, _T("export") },
\r
149 { cmdHelp, _T("help") },
\r
150 { cmdIgnore, _T("ignore") },
\r
151 { cmdImport, _T("import") },
\r
152 { cmdLock, _T("lock") },
\r
153 { cmdLog, _T("log") },
\r
154 { cmdMerge, _T("merge") },
\r
155 { cmdMergeAll, _T("mergeall") },
\r
156 { cmdPasteCopy, _T("pastecopy") },
\r
157 { cmdPasteMove, _T("pastemove") },
\r
158 { cmdPrevDiff, _T("prevdiff") },
\r
159 { cmdProperties, _T("properties") },
\r
160 { cmdRTFM, _T("rtfm") },
\r
161 { cmdRebuildIconCache,_T("rebuildiconcache") },
\r
162 { cmdRelocate, _T("relocate") },
\r
163 { cmdRemove, _T("remove") },
\r
164 { cmdRename, _T("rename") },
\r
165 { cmdRepoBrowser, _T("repobrowser") },
\r
166 { cmdRepoCreate, _T("repocreate") },
\r
167 { cmdRepoStatus, _T("repostatus") },
\r
168 { cmdResolve, _T("resolve") },
\r
169 { cmdRevert, _T("revert") },
\r
170 { cmdRevisionGraph, _T("revisiongraph") },
\r
171 { cmdSettings, _T("settings") },
\r
172 { cmdShowCompare, _T("showcompare") },
\r
173 { cmdSwitch, _T("switch") },
\r
174 { cmdUnIgnore, _T("unignore") },
\r
175 { cmdUnlock, _T("unlock") },
\r
176 { cmdUpdate, _T("update") },
\r
177 { cmdUpdateCheck, _T("updatecheck") },
\r
178 { cmdUrlDiff, _T("urldiff") },
\r
184 Command * CommandServer::GetCommand(const CString& sCmd)
\r
186 // Look up the command
\r
187 TGitCommand command = cmdAbout; // Something harmless as a default
\r
188 for (int nCommand = 0; nCommand < (sizeof(commandInfo)/sizeof(commandInfo[0])); nCommand++)
\r
190 if (sCmd.Compare(commandInfo[nCommand].pCommandName) == 0)
\r
192 // We've found the command
\r
193 command = commandInfo[nCommand].command;
\r
194 // If this fires, you've let the enum get out of sync with the commandInfo array
\r
195 ASSERT((int)command == nCommand);
\r
205 return new AboutCommand;
\r
207 return new CommitCommand;
\r
210 return new AddCommand;
\r
212 return new BlameCommand;
\r
214 return new CatCommand;
\r
216 return new CheckoutCommand;
\r
218 return new CleanupCommand;
\r
220 case cmdConflictEditor:
\r
221 return new ConflictEditorCommand;
\r
223 return new CopyCommand;
\r
225 return new CrashCommand;
\r
226 case cmdCreatePatch:
\r
227 return new CreatePatchCommand;
\r
228 case cmdDelUnversioned:
\r
229 return new DelUnversionedCommand;
\r
231 return new DiffCommand;
\r
233 return new DropCopyCommand;
\r
234 case cmdDropCopyAdd:
\r
235 return new DropCopyAddCommand;
\r
236 case cmdDropExport:
\r
237 return new DropExportCommand;
\r
239 return new DropMoveCommand;
\r
241 return new ExportCommand;
\r
243 return new HelpCommand;
\r
245 return new IgnoreCommand;
\r
247 return new ImportCommand;
\r
249 return new LockCommand;
\r
251 return new LogCommand;
\r
253 return new MergeCommand;
\r
255 return new MergeAllCommand;
\r
257 return new PasteCopyCommand;
\r
259 return new PasteMoveCommand;
\r
261 return new PrevDiffCommand;
\r
262 case cmdProperties:
\r
263 return new PropertiesCommand;
\r
265 return new RTFMCommand;
\r
266 case cmdRebuildIconCache:
\r
267 return new RebuildIconCacheCommand;
\r
269 return new RelocateCommand;
\r
271 return new RemoveCommand;
\r
273 return new RenameCommand;
\r
274 case cmdRepoBrowser:
\r
275 return new RepositoryBrowserCommand;
\r
276 case cmdRepoCreate:
\r
277 return new CreateRepositoryCommand;
\r
278 case cmdRepoStatus:
\r
279 return new RepoStatusCommand;
\r
281 return new ResolveCommand;
\r
283 return new RevertCommand;
\r
284 case cmdRevisionGraph:
\r
285 return new RevisionGraphCommand;
\r
287 return new SettingsCommand;
\r
288 case cmdShowCompare:
\r
289 return new ShowCompareCommand;
\r
291 return new SwitchCommand;
\r
293 return new UnIgnoreCommand;
\r
295 return new UnLockCommand;
\r
297 return new UpdateCommand;
\r
298 case cmdUpdateCheck:
\r
299 return new UpdateCheckCommand;
\r
301 return new UrlDiffCommand;
\r
304 return new AboutCommand;
\r