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
53 #include "ResolveCommand.h"
\r
54 #include "DropMoveCommand.h"
\r
55 #include "DropCopyAddCommand.h"
\r
56 #include "DropCopyCommand.h"
\r
57 #include "DropExportCommand.h"
\r
58 #include "HelpCommand.h"
\r
59 #include "StashCommand.h"
\r
60 #include "SubmoduleCommand.h"
\r
61 #include "ReflogCommand.h"
\r
66 #include "CatCommand.h"
\r
67 #include "CheckoutCommand.h"
\r
71 #include "CopyCommand.h"
\r
72 #include "CrashCommand.h"
\r
73 #include "CreatePatchCommand.h"
\r
75 #include "DelUnversionedCommand.h"
\r
82 #include "ImportCommand.h"
\r
83 #include "LockCommand.h"
\r
86 #include "MergeAllCommand.h"
\r
87 #include "PasteCopyCommand.h"
\r
88 #include "PasteMoveCommand.h"
\r
90 #include "PropertiesCommand.h"
\r
91 #include "RebuildIconCacheCommand.h"
\r
92 #include "RelocateCommand.h"
\r
93 #include "RemoveCommand.h"
\r
95 #include "RepositoryBrowserCommand.h"
\r
98 #include "RevertCommand.h"
\r
99 #include "RevisiongraphCommand.h"
\r
100 #include "RTFMCommand.h"
\r
102 #include "ShowCompareCommand.h"
\r
104 #include "UnIgnoreCommand.h"
\r
105 #include "UnLockCommand.h"
\r
106 #include "UpdateCheckCommand.h"
\r
107 #include "UpdateCommand.h"
\r
108 #include "UrlDiffCommand.h"
\r
149 cmdRebuildIconCache,
\r
179 static const struct CommandInfo
\r
181 TGitCommand command;
\r
182 LPCTSTR pCommandName;
\r
185 { cmdAbout, _T("about") },
\r
186 { cmdAdd, _T("add") },
\r
187 { cmdBlame, _T("blame") },
\r
188 { cmdBranch, _T("branch") },
\r
189 { cmdCat, _T("cat") },
\r
190 { cmdCheckout, _T("checkout") },
\r
191 { cmdCleanup, _T("cleanup") },
\r
192 { cmdClone, _T("clone") },
\r
193 { cmdCommit, _T("commit") },
\r
194 { cmdConflictEditor, _T("conflicteditor") },
\r
195 { cmdCopy, _T("copy") },
\r
196 { cmdCrash, _T("crash") },
\r
197 { cmdCreatePatch, _T("createpatch") },
\r
198 { cmdDelUnversioned, _T("delunversioned") },
\r
199 { cmdDiff, _T("diff") },
\r
200 { cmdDropCopy, _T("dropcopy") },
\r
201 { cmdDropCopyAdd, _T("dropcopyadd") },
\r
202 { cmdDropExport, _T("dropexport") },
\r
203 { cmdDropMove, _T("dropmove") },
\r
204 { cmdFetch, _T("fetch") },
\r
205 { cmdFormatPatch, _T("formatpatch") },
\r
206 { cmdExport, _T("export") },
\r
207 { cmdHelp, _T("help") },
\r
208 { cmdIgnore, _T("ignore") },
\r
209 { cmdImport, _T("import") },
\r
210 { cmdImportPatch, _T("importpatch") },
\r
211 { cmdLock, _T("lock") },
\r
212 { cmdLog, _T("log") },
\r
213 { cmdMerge, _T("merge") },
\r
214 { cmdMergeAll, _T("mergeall") },
\r
215 { cmdPasteCopy, _T("pastecopy") },
\r
216 { cmdPasteMove, _T("pastemove") },
\r
217 { cmdPrevDiff, _T("prevdiff") },
\r
218 { cmdProperties, _T("properties") },
\r
219 { cmdPull, _T("pull") },
\r
220 { cmdPush, _T("push") },
\r
221 { cmdRTFM, _T("rtfm") },
\r
222 { cmdRebuildIconCache,_T("rebuildiconcache") },
\r
223 { cmdRelocate, _T("relocate") },
\r
224 { cmdRemove, _T("remove") },
\r
225 { cmdRebase, _T("rebase") },
\r
226 { cmdRename, _T("rename") },
\r
227 { cmdRepoBrowser, _T("repobrowser") },
\r
228 { cmdRepoCreate, _T("repocreate") },
\r
229 { cmdRepoStatus, _T("repostatus") },
\r
230 { cmdResolve, _T("resolve") },
\r
231 { cmdRevert, _T("revert") },
\r
232 { cmdRevisionGraph, _T("revisiongraph") },
\r
233 { cmdSettings, _T("settings") },
\r
234 { cmdShowCompare, _T("showcompare") },
\r
235 { cmdSwitch, _T("switch") },
\r
236 { cmdTag, _T("tag") },
\r
237 { cmdUnIgnore, _T("unignore") },
\r
238 { cmdUnlock, _T("unlock") },
\r
239 { cmdUpdate, _T("update") },
\r
240 { cmdUpdateCheck, _T("updatecheck") },
\r
241 { cmdUrlDiff, _T("urldiff") },
\r
242 { cmdStashSave, _T("stashsave") },
\r
243 { cmdStashApply, _T("stashapply") },
\r
244 { cmdStashList, _T("stashlist") },
\r
245 { cmdSubAdd, _T("subadd") },
\r
246 { cmdSubUpdate, _T("subupdate") },
\r
247 { cmdSubSync, _T("subsync") },
\r
248 { cmdRefLog, _T("reflog") }
\r
254 Command * CommandServer::GetCommand(const CString& sCmd)
\r
256 // Look up the command
\r
257 TGitCommand command = cmdAbout; // Something harmless as a default
\r
258 for (int nCommand = 0; nCommand < (sizeof(commandInfo)/sizeof(commandInfo[0])); nCommand++)
\r
260 if (sCmd.Compare(commandInfo[nCommand].pCommandName) == 0)
\r
262 // We've found the command
\r
263 command = commandInfo[nCommand].command;
\r
264 // If this fires, you've let the enum get out of sync with the commandInfo array
\r
265 ASSERT((int)command == nCommand);
\r
275 return new AboutCommand;
\r
277 return new CommitCommand;
\r
279 return new LogCommand;
\r
280 case cmdRepoCreate:
\r
281 return new CreateRepositoryCommand;
\r
283 return new CloneCommand;
\r
285 return new PrevDiffCommand;
\r
287 return new DiffCommand;
\r
289 return new RenameCommand;
\r
290 case cmdRepoStatus:
\r
291 return new RepoStatusCommand;
\r
293 return new RemoveCommand;
\r
295 return new RevertCommand;
\r
297 return new PullCommand;
\r
299 return new FetchCommand;
\r
301 return new PushCommand;
\r
303 return new BranchCommand;
\r
305 return new TagCommand;
\r
307 return new MergeCommand;
\r
309 return new SwitchCommand;
\r
311 return new ExportCommand;
\r
313 return new AddCommand;
\r
315 return new IgnoreCommand;
\r
316 case cmdFormatPatch:
\r
317 return new FormatPatchCommand;
\r
318 case cmdImportPatch:
\r
319 return new ImportPatchCommand;
\r
321 return new BlameCommand;
\r
323 return new SettingsCommand;
\r
324 case cmdConflictEditor:
\r
325 return new ConflictEditorCommand;
\r
327 return new CleanupCommand;
\r
329 return new RebaseCommand;
\r
331 return new ResolveCommand;
\r
333 return new DropMoveCommand;
\r
334 // case cmdDropCopy:
\r
335 // return new DropCopyCommand;
\r
336 // case cmdDropCopyAdd:
\r
337 // return new DropCopyAddCommand;
\r
338 // case cmdDropExport:
\r
339 // return new DropExportCommand;
\r
341 return new HelpCommand;
\r
343 return new StashSaveCommand;
\r
344 case cmdStashApply:
\r
345 return new StashApplyCommand;
\r
347 return new SubmoduleAddCommand;
\r
349 return new SubmoduleUpdateCommand;
\r
351 return new RefLogCommand;
\r
353 return new SubmoduleSyncCommand;
\r
358 return new CatCommand;
\r
360 return new CheckoutCommand;
\r
365 return new CopyCommand;
\r
367 return new CrashCommand;
\r
368 case cmdCreatePatch:
\r
369 return new CreatePatchCommand;
\r
370 case cmdDelUnversioned:
\r
371 return new DelUnversionedCommand;
\r
376 return new ImportCommand;
\r
378 return new LockCommand;
\r
380 return new MergeAllCommand;
\r
382 return new PasteCopyCommand;
\r
384 return new PasteMoveCommand;
\r
386 return new PrevDiffCommand;
\r
387 case cmdProperties:
\r
388 return new PropertiesCommand;
\r
390 return new RTFMCommand;
\r
391 case cmdRebuildIconCache:
\r
392 return new RebuildIconCacheCommand;
\r
394 return new RelocateCommand;
\r
395 case cmdRepoBrowser:
\r
396 return new RepositoryBrowserCommand;
\r
397 case cmdRevisionGraph:
\r
398 return new RevisionGraphCommand;
\r
399 case cmdShowCompare:
\r
400 return new ShowCompareCommand;
\r
402 return new UnIgnoreCommand;
\r
404 return new UnLockCommand;
\r
406 return new UpdateCommand;
\r
407 case cmdUpdateCheck:
\r
408 return new UpdateCheckCommand;
\r
410 return new UrlDiffCommand;
\r
413 CMessageBox::Show(hWndExplorer, _T("Have not implemented"), _T("TortoiseGit"), MB_ICONERROR);
\r
414 return new AboutCommand;
\r