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
24 #include "LogCommand.h"
\r
26 #include "CreateRepositoryCommand.h"
\r
27 #include "CloneCommand.h"
\r
28 #include "PrevDiffCommand.h"
\r
29 #include "DiffCommand.h"
\r
31 #include "RenameCommand.h"
\r
32 #include "RepoStatusCommand.h"
\r
34 #include "RevertCommand.h"
\r
35 #include "RemoveCommand.h"
\r
36 #include "PullCommand.h"
\r
37 #include "FetchCommand.h"
\r
38 #include "PushCommand.h"
\r
39 #include "BranchCommand.h"
\r
40 #include "TagCommand.h"
\r
41 #include "MergeCommand.h"
\r
42 #include "SwitchCommand.h"
\r
43 #include "ExportCommand.h"
\r
44 #include "AddCommand.h"
\r
45 #include "IgnoreCommand.h"
\r
46 #include "FormatPatchCommand.h"
\r
47 #include "ImportPatchCommand.h"
\r
48 #include "BlameCommand.h"
\r
49 #include "SettingsCommand.h"
\r
53 #include "CatCommand.h"
\r
54 #include "CheckoutCommand.h"
\r
55 #include "CleanupCommand.h"
\r
57 #include "ConflictEditorCommand.h"
\r
58 #include "CopyCommand.h"
\r
59 #include "CrashCommand.h"
\r
60 #include "CreatePatchCommand.h"
\r
62 #include "DelUnversionedCommand.h"
\r
64 #include "DropCopyAddCommand.h"
\r
65 #include "DropCopyCommand.h"
\r
66 #include "DropExportCommand.h"
\r
67 #include "DropMoveCommand.h"
\r
69 #include "HelpCommand.h"
\r
71 #include "ImportCommand.h"
\r
72 #include "LockCommand.h"
\r
75 #include "MergeAllCommand.h"
\r
76 #include "PasteCopyCommand.h"
\r
77 #include "PasteMoveCommand.h"
\r
79 #include "PropertiesCommand.h"
\r
80 #include "RebuildIconCacheCommand.h"
\r
81 #include "RelocateCommand.h"
\r
82 #include "RemoveCommand.h"
\r
84 #include "RepositoryBrowserCommand.h"
\r
86 #include "ResolveCommand.h"
\r
87 #include "RevertCommand.h"
\r
88 #include "RevisiongraphCommand.h"
\r
89 #include "RTFMCommand.h"
\r
91 #include "ShowCompareCommand.h"
\r
93 #include "UnIgnoreCommand.h"
\r
94 #include "UnLockCommand.h"
\r
95 #include "UpdateCheckCommand.h"
\r
96 #include "UpdateCommand.h"
\r
97 #include "UrlDiffCommand.h"
\r
138 cmdRebuildIconCache,
\r
160 static const struct CommandInfo
\r
162 TGitCommand command;
\r
163 LPCTSTR pCommandName;
\r
166 { cmdAbout, _T("about") },
\r
167 { cmdAdd, _T("add") },
\r
168 { cmdBlame, _T("blame") },
\r
169 { cmdBranch, _T("branch") },
\r
170 { cmdCat, _T("cat") },
\r
171 { cmdCheckout, _T("checkout") },
\r
172 { cmdCleanup, _T("cleanup") },
\r
173 { cmdClone, _T("clone") },
\r
174 { cmdCommit, _T("commit") },
\r
175 { cmdConflictEditor, _T("conflicteditor") },
\r
176 { cmdCopy, _T("copy") },
\r
177 { cmdCrash, _T("crash") },
\r
178 { cmdCreatePatch, _T("createpatch") },
\r
179 { cmdDelUnversioned, _T("delunversioned") },
\r
180 { cmdDiff, _T("diff") },
\r
181 { cmdDropCopy, _T("dropcopy") },
\r
182 { cmdDropCopyAdd, _T("dropcopyadd") },
\r
183 { cmdDropExport, _T("dropexport") },
\r
184 { cmdDropMove, _T("dropmove") },
\r
185 { cmdFetch, _T("fetch") },
\r
186 { cmdFormatPatch, _T("formatpatch") },
\r
187 { cmdExport, _T("export") },
\r
188 { cmdHelp, _T("help") },
\r
189 { cmdIgnore, _T("ignore") },
\r
190 { cmdImport, _T("import") },
\r
191 { cmdImportPatch, _T("importpatch") },
\r
192 { cmdLock, _T("lock") },
\r
193 { cmdLog, _T("log") },
\r
194 { cmdMerge, _T("merge") },
\r
195 { cmdMergeAll, _T("mergeall") },
\r
196 { cmdPasteCopy, _T("pastecopy") },
\r
197 { cmdPasteMove, _T("pastemove") },
\r
198 { cmdPrevDiff, _T("prevdiff") },
\r
199 { cmdProperties, _T("properties") },
\r
200 { cmdPull, _T("pull") },
\r
201 { cmdPush, _T("push") },
\r
202 { cmdRTFM, _T("rtfm") },
\r
203 { cmdRebuildIconCache,_T("rebuildiconcache") },
\r
204 { cmdRelocate, _T("relocate") },
\r
205 { cmdRemove, _T("remove") },
\r
206 { cmdRename, _T("rename") },
\r
207 { cmdRepoBrowser, _T("repobrowser") },
\r
208 { cmdRepoCreate, _T("repocreate") },
\r
209 { cmdRepoStatus, _T("repostatus") },
\r
210 { cmdResolve, _T("resolve") },
\r
211 { cmdRevert, _T("revert") },
\r
212 { cmdRevisionGraph, _T("revisiongraph") },
\r
213 { cmdSettings, _T("settings") },
\r
214 { cmdShowCompare, _T("showcompare") },
\r
215 { cmdSwitch, _T("switch") },
\r
216 { cmdTag, _T("tag") },
\r
217 { cmdUnIgnore, _T("unignore") },
\r
218 { cmdUnlock, _T("unlock") },
\r
219 { cmdUpdate, _T("update") },
\r
220 { cmdUpdateCheck, _T("updatecheck") },
\r
221 { cmdUrlDiff, _T("urldiff") },
\r
227 Command * CommandServer::GetCommand(const CString& sCmd)
\r
229 // Look up the command
\r
230 TGitCommand command = cmdAbout; // Something harmless as a default
\r
231 for (int nCommand = 0; nCommand < (sizeof(commandInfo)/sizeof(commandInfo[0])); nCommand++)
\r
233 if (sCmd.Compare(commandInfo[nCommand].pCommandName) == 0)
\r
235 // We've found the command
\r
236 command = commandInfo[nCommand].command;
\r
237 // If this fires, you've let the enum get out of sync with the commandInfo array
\r
238 ASSERT((int)command == nCommand);
\r
248 return new AboutCommand;
\r
250 return new CommitCommand;
\r
252 return new LogCommand;
\r
253 case cmdRepoCreate:
\r
254 return new CreateRepositoryCommand;
\r
256 return new CloneCommand;
\r
258 return new PrevDiffCommand;
\r
260 return new DiffCommand;
\r
262 return new RenameCommand;
\r
263 case cmdRepoStatus:
\r
264 return new RepoStatusCommand;
\r
266 return new RemoveCommand;
\r
268 return new RevertCommand;
\r
270 return new PullCommand;
\r
272 return new FetchCommand;
\r
274 return new PushCommand;
\r
276 return new BranchCommand;
\r
278 return new TagCommand;
\r
280 return new MergeCommand;
\r
282 return new SwitchCommand;
\r
284 return new ExportCommand;
\r
286 return new AddCommand;
\r
288 return new IgnoreCommand;
\r
289 case cmdFormatPatch:
\r
290 return new FormatPatchCommand;
\r
291 case cmdImportPatch:
\r
292 return new ImportPatchCommand;
\r
294 return new BlameCommand;
\r
296 return new SettingsCommand;
\r
300 return new CatCommand;
\r
302 return new CheckoutCommand;
\r
304 return new CleanupCommand;
\r
306 case cmdConflictEditor:
\r
307 return new ConflictEditorCommand;
\r
309 return new CopyCommand;
\r
311 return new CrashCommand;
\r
312 case cmdCreatePatch:
\r
313 return new CreatePatchCommand;
\r
314 case cmdDelUnversioned:
\r
315 return new DelUnversionedCommand;
\r
318 return new DropCopyCommand;
\r
319 case cmdDropCopyAdd:
\r
320 return new DropCopyAddCommand;
\r
321 case cmdDropExport:
\r
322 return new DropExportCommand;
\r
324 return new DropMoveCommand;
\r
327 return new HelpCommand;
\r
330 return new ImportCommand;
\r
332 return new LockCommand;
\r
335 return new MergeCommand;
\r
337 return new MergeAllCommand;
\r
339 return new PasteCopyCommand;
\r
341 return new PasteMoveCommand;
\r
343 return new PrevDiffCommand;
\r
344 case cmdProperties:
\r
345 return new PropertiesCommand;
\r
347 return new RTFMCommand;
\r
348 case cmdRebuildIconCache:
\r
349 return new RebuildIconCacheCommand;
\r
351 return new RelocateCommand;
\r
354 case cmdRepoBrowser:
\r
355 return new RepositoryBrowserCommand;
\r
359 return new ResolveCommand;
\r
361 case cmdRevisionGraph:
\r
362 return new RevisionGraphCommand;
\r
364 case cmdShowCompare:
\r
365 return new ShowCompareCommand;
\r
368 return new UnIgnoreCommand;
\r
370 return new UnLockCommand;
\r
372 return new UpdateCommand;
\r
373 case cmdUpdateCheck:
\r
374 return new UpdateCheckCommand;
\r
376 return new UrlDiffCommand;
\r
379 CMessageBox::Show(hWndExplorer, _T("Have not implemented"), _T("TortoiseGit"), MB_ICONERROR);
\r
380 return new AboutCommand;
\r