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
50 #include "ConflictEditorCommand.h"
\r
51 #include "CleanupCommand.h"
\r
52 #include "RebaseCommand.h"
\r
57 #include "CatCommand.h"
\r
58 #include "CheckoutCommand.h"
\r
62 #include "CopyCommand.h"
\r
63 #include "CrashCommand.h"
\r
64 #include "CreatePatchCommand.h"
\r
66 #include "DelUnversionedCommand.h"
\r
68 #include "DropCopyAddCommand.h"
\r
69 #include "DropCopyCommand.h"
\r
70 #include "DropExportCommand.h"
\r
71 #include "DropMoveCommand.h"
\r
73 #include "HelpCommand.h"
\r
75 #include "ImportCommand.h"
\r
76 #include "LockCommand.h"
\r
79 #include "MergeAllCommand.h"
\r
80 #include "PasteCopyCommand.h"
\r
81 #include "PasteMoveCommand.h"
\r
83 #include "PropertiesCommand.h"
\r
84 #include "RebuildIconCacheCommand.h"
\r
85 #include "RelocateCommand.h"
\r
86 #include "RemoveCommand.h"
\r
88 #include "RepositoryBrowserCommand.h"
\r
90 #include "ResolveCommand.h"
\r
91 #include "RevertCommand.h"
\r
92 #include "RevisiongraphCommand.h"
\r
93 #include "RTFMCommand.h"
\r
95 #include "ShowCompareCommand.h"
\r
97 #include "UnIgnoreCommand.h"
\r
98 #include "UnLockCommand.h"
\r
99 #include "UpdateCheckCommand.h"
\r
100 #include "UpdateCommand.h"
\r
101 #include "UrlDiffCommand.h"
\r
142 cmdRebuildIconCache,
\r
165 static const struct CommandInfo
\r
167 TGitCommand command;
\r
168 LPCTSTR pCommandName;
\r
171 { cmdAbout, _T("about") },
\r
172 { cmdAdd, _T("add") },
\r
173 { cmdBlame, _T("blame") },
\r
174 { cmdBranch, _T("branch") },
\r
175 { cmdCat, _T("cat") },
\r
176 { cmdCheckout, _T("checkout") },
\r
177 { cmdCleanup, _T("cleanup") },
\r
178 { cmdClone, _T("clone") },
\r
179 { cmdCommit, _T("commit") },
\r
180 { cmdConflictEditor, _T("conflicteditor") },
\r
181 { cmdCopy, _T("copy") },
\r
182 { cmdCrash, _T("crash") },
\r
183 { cmdCreatePatch, _T("createpatch") },
\r
184 { cmdDelUnversioned, _T("delunversioned") },
\r
185 { cmdDiff, _T("diff") },
\r
186 { cmdDropCopy, _T("dropcopy") },
\r
187 { cmdDropCopyAdd, _T("dropcopyadd") },
\r
188 { cmdDropExport, _T("dropexport") },
\r
189 { cmdDropMove, _T("dropmove") },
\r
190 { cmdFetch, _T("fetch") },
\r
191 { cmdFormatPatch, _T("formatpatch") },
\r
192 { cmdExport, _T("export") },
\r
193 { cmdHelp, _T("help") },
\r
194 { cmdIgnore, _T("ignore") },
\r
195 { cmdImport, _T("import") },
\r
196 { cmdImportPatch, _T("importpatch") },
\r
197 { cmdLock, _T("lock") },
\r
198 { cmdLog, _T("log") },
\r
199 { cmdMerge, _T("merge") },
\r
200 { cmdMergeAll, _T("mergeall") },
\r
201 { cmdPasteCopy, _T("pastecopy") },
\r
202 { cmdPasteMove, _T("pastemove") },
\r
203 { cmdPrevDiff, _T("prevdiff") },
\r
204 { cmdProperties, _T("properties") },
\r
205 { cmdPull, _T("pull") },
\r
206 { cmdPush, _T("push") },
\r
207 { cmdRTFM, _T("rtfm") },
\r
208 { cmdRebuildIconCache,_T("rebuildiconcache") },
\r
209 { cmdRelocate, _T("relocate") },
\r
210 { cmdRemove, _T("remove") },
\r
211 { cmdRebase, _T("rebase") },
\r
212 { cmdRename, _T("rename") },
\r
213 { cmdRepoBrowser, _T("repobrowser") },
\r
214 { cmdRepoCreate, _T("repocreate") },
\r
215 { cmdRepoStatus, _T("repostatus") },
\r
216 { cmdResolve, _T("resolve") },
\r
217 { cmdRevert, _T("revert") },
\r
218 { cmdRevisionGraph, _T("revisiongraph") },
\r
219 { cmdSettings, _T("settings") },
\r
220 { cmdShowCompare, _T("showcompare") },
\r
221 { cmdSwitch, _T("switch") },
\r
222 { cmdTag, _T("tag") },
\r
223 { cmdUnIgnore, _T("unignore") },
\r
224 { cmdUnlock, _T("unlock") },
\r
225 { cmdUpdate, _T("update") },
\r
226 { cmdUpdateCheck, _T("updatecheck") },
\r
227 { cmdUrlDiff, _T("urldiff") },
\r
233 Command * CommandServer::GetCommand(const CString& sCmd)
\r
235 // Look up the command
\r
236 TGitCommand command = cmdAbout; // Something harmless as a default
\r
237 for (int nCommand = 0; nCommand < (sizeof(commandInfo)/sizeof(commandInfo[0])); nCommand++)
\r
239 if (sCmd.Compare(commandInfo[nCommand].pCommandName) == 0)
\r
241 // We've found the command
\r
242 command = commandInfo[nCommand].command;
\r
243 // If this fires, you've let the enum get out of sync with the commandInfo array
\r
244 ASSERT((int)command == nCommand);
\r
254 return new AboutCommand;
\r
256 return new CommitCommand;
\r
258 return new LogCommand;
\r
259 case cmdRepoCreate:
\r
260 return new CreateRepositoryCommand;
\r
262 return new CloneCommand;
\r
264 return new PrevDiffCommand;
\r
266 return new DiffCommand;
\r
268 return new RenameCommand;
\r
269 case cmdRepoStatus:
\r
270 return new RepoStatusCommand;
\r
272 return new RemoveCommand;
\r
274 return new RevertCommand;
\r
276 return new PullCommand;
\r
278 return new FetchCommand;
\r
280 return new PushCommand;
\r
282 return new BranchCommand;
\r
284 return new TagCommand;
\r
286 return new MergeCommand;
\r
288 return new SwitchCommand;
\r
290 return new ExportCommand;
\r
292 return new AddCommand;
\r
294 return new IgnoreCommand;
\r
295 case cmdFormatPatch:
\r
296 return new FormatPatchCommand;
\r
297 case cmdImportPatch:
\r
298 return new ImportPatchCommand;
\r
300 return new BlameCommand;
\r
302 return new SettingsCommand;
\r
303 case cmdConflictEditor:
\r
304 return new ConflictEditorCommand;
\r
306 return new CleanupCommand;
\r
308 return new RebaseCommand;
\r
312 return new CatCommand;
\r
314 return new CheckoutCommand;
\r
319 return new CopyCommand;
\r
321 return new CrashCommand;
\r
322 case cmdCreatePatch:
\r
323 return new CreatePatchCommand;
\r
324 case cmdDelUnversioned:
\r
325 return new DelUnversionedCommand;
\r
328 return new DropCopyCommand;
\r
329 case cmdDropCopyAdd:
\r
330 return new DropCopyAddCommand;
\r
331 case cmdDropExport:
\r
332 return new DropExportCommand;
\r
334 return new DropMoveCommand;
\r
337 return new HelpCommand;
\r
340 return new ImportCommand;
\r
342 return new LockCommand;
\r
345 return new MergeCommand;
\r
347 return new MergeAllCommand;
\r
349 return new PasteCopyCommand;
\r
351 return new PasteMoveCommand;
\r
353 return new PrevDiffCommand;
\r
354 case cmdProperties:
\r
355 return new PropertiesCommand;
\r
357 return new RTFMCommand;
\r
358 case cmdRebuildIconCache:
\r
359 return new RebuildIconCacheCommand;
\r
361 return new RelocateCommand;
\r
364 case cmdRepoBrowser:
\r
365 return new RepositoryBrowserCommand;
\r
369 return new ResolveCommand;
\r
371 case cmdRevisionGraph:
\r
372 return new RevisionGraphCommand;
\r
374 case cmdShowCompare:
\r
375 return new ShowCompareCommand;
\r
378 return new UnIgnoreCommand;
\r
380 return new UnLockCommand;
\r
382 return new UpdateCommand;
\r
383 case cmdUpdateCheck:
\r
384 return new UpdateCheckCommand;
\r
386 return new UrlDiffCommand;
\r
389 CMessageBox::Show(hWndExplorer, _T("Have not implemented"), _T("TortoiseGit"), MB_ICONERROR);
\r
390 return new AboutCommand;
\r