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
62 #include "SendMailCommand.h"
\r
63 #include "CatCommand.h"
\r
64 #include "RefBrowseCommand.h"
\r
65 #include "SVNDCommitCommand.h"
\r
66 #include "SVNRebaseCommand.h"
\r
67 #include "SyncCommand.h"
\r
68 #include "UpdateCheckCommand.h"
\r
74 #include "CheckoutCommand.h"
\r
78 #include "CopyCommand.h"
\r
79 #include "CrashCommand.h"
\r
80 #include "CreatePatchCommand.h"
\r
82 #include "DelUnversionedCommand.h"
\r
89 #include "ImportCommand.h"
\r
90 #include "LockCommand.h"
\r
93 #include "MergeAllCommand.h"
\r
94 #include "PasteCopyCommand.h"
\r
95 #include "PasteMoveCommand.h"
\r
97 #include "PropertiesCommand.h"
\r
98 #include "RebuildIconCacheCommand.h"
\r
99 #include "RelocateCommand.h"
\r
100 #include "RemoveCommand.h"
\r
102 #include "RepositoryBrowserCommand.h"
\r
105 #include "RevertCommand.h"
\r
106 #include "RevisiongraphCommand.h"
\r
107 #include "RTFMCommand.h"
\r
109 #include "ShowCompareCommand.h"
\r
111 #include "UnIgnoreCommand.h"
\r
112 #include "UnLockCommand.h"
\r
114 #include "UpdateCommand.h"
\r
115 #include "UrlDiffCommand.h"
\r
156 cmdRebuildIconCache,
\r
192 static const struct CommandInfo
\r
194 TGitCommand command;
\r
195 LPCTSTR pCommandName;
\r
198 { cmdAbout, _T("about") },
\r
199 { cmdAdd, _T("add") },
\r
200 { cmdBlame, _T("blame") },
\r
201 { cmdBranch, _T("branch") },
\r
202 { cmdCat, _T("cat") },
\r
203 { cmdCheckout, _T("checkout") },
\r
204 { cmdCleanup, _T("cleanup") },
\r
205 { cmdClone, _T("clone") },
\r
206 { cmdCommit, _T("commit") },
\r
207 { cmdConflictEditor, _T("conflicteditor") },
\r
208 { cmdCopy, _T("copy") },
\r
209 { cmdCrash, _T("crash") },
\r
210 { cmdCreatePatch, _T("createpatch") },
\r
211 { cmdDelUnversioned, _T("delunversioned") },
\r
212 { cmdDiff, _T("diff") },
\r
213 { cmdDropCopy, _T("dropcopy") },
\r
214 { cmdDropCopyAdd, _T("dropcopyadd") },
\r
215 { cmdDropExport, _T("dropexport") },
\r
216 { cmdDropMove, _T("dropmove") },
\r
217 { cmdFetch, _T("fetch") },
\r
218 { cmdFormatPatch, _T("formatpatch") },
\r
219 { cmdExport, _T("export") },
\r
220 { cmdHelp, _T("help") },
\r
221 { cmdIgnore, _T("ignore") },
\r
222 { cmdImport, _T("import") },
\r
223 { cmdImportPatch, _T("importpatch") },
\r
224 { cmdLock, _T("lock") },
\r
225 { cmdLog, _T("log") },
\r
226 { cmdMerge, _T("merge") },
\r
227 { cmdMergeAll, _T("mergeall") },
\r
228 { cmdPasteCopy, _T("pastecopy") },
\r
229 { cmdPasteMove, _T("pastemove") },
\r
230 { cmdPrevDiff, _T("prevdiff") },
\r
231 { cmdProperties, _T("properties") },
\r
232 { cmdPull, _T("pull") },
\r
233 { cmdPush, _T("push") },
\r
234 { cmdRTFM, _T("rtfm") },
\r
235 { cmdRebuildIconCache,_T("rebuildiconcache") },
\r
236 { cmdRelocate, _T("relocate") },
\r
237 { cmdRemove, _T("remove") },
\r
238 { cmdRebase, _T("rebase") },
\r
239 { cmdRename, _T("rename") },
\r
240 { cmdRepoBrowser, _T("repobrowser") },
\r
241 { cmdRepoCreate, _T("repocreate") },
\r
242 { cmdRepoStatus, _T("repostatus") },
\r
243 { cmdResolve, _T("resolve") },
\r
244 { cmdRevert, _T("revert") },
\r
245 { cmdRevisionGraph, _T("revisiongraph") },
\r
246 { cmdSendMail, _T("sendmail") },
\r
247 { cmdSettings, _T("settings") },
\r
248 { cmdShowCompare, _T("showcompare") },
\r
249 { cmdSwitch, _T("switch") },
\r
250 { cmdTag, _T("tag") },
\r
251 { cmdUnIgnore, _T("unignore") },
\r
252 { cmdUnlock, _T("unlock") },
\r
253 { cmdUpdate, _T("update") },
\r
254 { cmdUpdateCheck, _T("updatecheck") },
\r
255 { cmdUrlDiff, _T("urldiff") },
\r
256 { cmdStashSave, _T("stashsave") },
\r
257 { cmdStashApply, _T("stashapply") },
\r
258 { cmdStashPop, _T("stashpop") },
\r
259 { cmdStashList, _T("stashlist") },
\r
260 { cmdSubAdd, _T("subadd") },
\r
261 { cmdSubUpdate, _T("subupdate") },
\r
262 { cmdSubSync, _T("subsync") },
\r
263 { cmdRefLog, _T("reflog") },
\r
264 { cmdRefBrowse, _T("refbrowse") },
\r
265 { cmdSVNDCommit, _T("svndcommit") },
\r
266 { cmdSVNRebase, _T("svnrebase") },
\r
267 { cmdSync, _T("sync") },
\r
271 Command * CommandServer::GetCommand(const CString& sCmd)
\r
273 // Look up the command
\r
274 TGitCommand command = cmdAbout; // Something harmless as a default
\r
275 for (int nCommand = 0; nCommand < (sizeof(commandInfo)/sizeof(commandInfo[0])); nCommand++)
\r
277 if (sCmd.Compare(commandInfo[nCommand].pCommandName) == 0)
\r
279 // We've found the command
\r
280 command = commandInfo[nCommand].command;
\r
281 // If this fires, you've let the enum get out of sync with the commandInfo array
\r
282 ASSERT((int)command == nCommand);
\r
288 // CBrowseRefsDlg dialog
\r
294 return new AboutCommand;
\r
296 return new CommitCommand;
\r
298 return new LogCommand;
\r
299 case cmdRepoCreate:
\r
300 return new CreateRepositoryCommand;
\r
302 return new CloneCommand;
\r
304 return new PrevDiffCommand;
\r
306 return new DiffCommand;
\r
308 return new RenameCommand;
\r
309 case cmdRepoStatus:
\r
310 return new RepoStatusCommand;
\r
312 return new RemoveCommand;
\r
314 return new RevertCommand;
\r
316 return new PullCommand;
\r
318 return new FetchCommand;
\r
320 return new PushCommand;
\r
322 return new BranchCommand;
\r
324 return new TagCommand;
\r
326 return new MergeCommand;
\r
328 return new SwitchCommand;
\r
330 return new ExportCommand;
\r
332 return new AddCommand;
\r
334 return new IgnoreCommand;
\r
335 case cmdFormatPatch:
\r
336 return new FormatPatchCommand;
\r
337 case cmdImportPatch:
\r
338 return new ImportPatchCommand;
\r
340 return new BlameCommand;
\r
342 return new SettingsCommand;
\r
343 case cmdConflictEditor:
\r
344 return new ConflictEditorCommand;
\r
346 return new CleanupCommand;
\r
348 return new RebaseCommand;
\r
350 return new ResolveCommand;
\r
352 return new DropMoveCommand;
\r
353 // case cmdDropCopy:
\r
354 // return new DropCopyCommand;
\r
355 // case cmdDropCopyAdd:
\r
356 // return new DropCopyAddCommand;
\r
357 // case cmdDropExport:
\r
358 // return new DropExportCommand;
\r
360 return new HelpCommand;
\r
362 return new StashSaveCommand;
\r
363 case cmdStashApply:
\r
364 return new StashApplyCommand;
\r
366 return new StashPopCommand;
\r
368 return new SubmoduleAddCommand;
\r
370 return new SubmoduleUpdateCommand;
\r
372 return new RefLogCommand;
\r
374 return new SubmoduleSyncCommand;
\r
376 return new SendMailCommand;
\r
378 return new CatCommand;
\r
380 return new RefBrowseCommand;
\r
381 case cmdSVNDCommit:
\r
382 return new SVNDCommitCommand;
\r
384 return new SVNRebaseCommand;
\r
386 return new SyncCommand;
\r
387 case cmdUpdateCheck:
\r
388 return new UpdateCheckCommand;
\r
394 return new CheckoutCommand;
\r
399 return new CopyCommand;
\r
401 return new CrashCommand;
\r
402 case cmdCreatePatch:
\r
403 return new CreatePatchCommand;
\r
404 case cmdDelUnversioned:
\r
405 return new DelUnversionedCommand;
\r
410 return new ImportCommand;
\r
412 return new LockCommand;
\r
414 return new MergeAllCommand;
\r
416 return new PasteCopyCommand;
\r
418 return new PasteMoveCommand;
\r
420 return new PrevDiffCommand;
\r
421 case cmdProperties:
\r
422 return new PropertiesCommand;
\r
424 return new RTFMCommand;
\r
425 case cmdRebuildIconCache:
\r
426 return new RebuildIconCacheCommand;
\r
428 return new RelocateCommand;
\r
429 case cmdRepoBrowser:
\r
430 return new RepositoryBrowserCommand;
\r
431 case cmdRevisionGraph:
\r
432 return new RevisionGraphCommand;
\r
433 case cmdShowCompare:
\r
434 return new ShowCompareCommand;
\r
436 return new UnIgnoreCommand;
\r
438 return new UnLockCommand;
\r
440 return new UpdateCommand;
\r
442 return new UrlDiffCommand;
\r
445 CMessageBox::Show(hWndExplorer, _T("Have not implemented"), _T("TortoiseGit"), MB_ICONERROR);
\r
446 return new AboutCommand;
\r