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
65 #include "BrowseRefsDlg.h"
\r
71 #include "CheckoutCommand.h"
\r
75 #include "CopyCommand.h"
\r
76 #include "CrashCommand.h"
\r
77 #include "CreatePatchCommand.h"
\r
79 #include "DelUnversionedCommand.h"
\r
86 #include "ImportCommand.h"
\r
87 #include "LockCommand.h"
\r
90 #include "MergeAllCommand.h"
\r
91 #include "PasteCopyCommand.h"
\r
92 #include "PasteMoveCommand.h"
\r
94 #include "PropertiesCommand.h"
\r
95 #include "RebuildIconCacheCommand.h"
\r
96 #include "RelocateCommand.h"
\r
97 #include "RemoveCommand.h"
\r
99 #include "RepositoryBrowserCommand.h"
\r
102 #include "RevertCommand.h"
\r
103 #include "RevisiongraphCommand.h"
\r
104 #include "RTFMCommand.h"
\r
106 #include "ShowCompareCommand.h"
\r
108 #include "UnIgnoreCommand.h"
\r
109 #include "UnLockCommand.h"
\r
110 #include "UpdateCheckCommand.h"
\r
111 #include "UpdateCommand.h"
\r
112 #include "UrlDiffCommand.h"
\r
153 cmdRebuildIconCache,
\r
185 static const struct CommandInfo
\r
187 TGitCommand command;
\r
188 LPCTSTR pCommandName;
\r
191 { cmdAbout, _T("about") },
\r
192 { cmdAdd, _T("add") },
\r
193 { cmdBlame, _T("blame") },
\r
194 { cmdBranch, _T("branch") },
\r
195 { cmdCat, _T("cat") },
\r
196 { cmdCheckout, _T("checkout") },
\r
197 { cmdCleanup, _T("cleanup") },
\r
198 { cmdClone, _T("clone") },
\r
199 { cmdCommit, _T("commit") },
\r
200 { cmdConflictEditor, _T("conflicteditor") },
\r
201 { cmdCopy, _T("copy") },
\r
202 { cmdCrash, _T("crash") },
\r
203 { cmdCreatePatch, _T("createpatch") },
\r
204 { cmdDelUnversioned, _T("delunversioned") },
\r
205 { cmdDiff, _T("diff") },
\r
206 { cmdDropCopy, _T("dropcopy") },
\r
207 { cmdDropCopyAdd, _T("dropcopyadd") },
\r
208 { cmdDropExport, _T("dropexport") },
\r
209 { cmdDropMove, _T("dropmove") },
\r
210 { cmdFetch, _T("fetch") },
\r
211 { cmdFormatPatch, _T("formatpatch") },
\r
212 { cmdExport, _T("export") },
\r
213 { cmdHelp, _T("help") },
\r
214 { cmdIgnore, _T("ignore") },
\r
215 { cmdImport, _T("import") },
\r
216 { cmdImportPatch, _T("importpatch") },
\r
217 { cmdLock, _T("lock") },
\r
218 { cmdLog, _T("log") },
\r
219 { cmdMerge, _T("merge") },
\r
220 { cmdMergeAll, _T("mergeall") },
\r
221 { cmdPasteCopy, _T("pastecopy") },
\r
222 { cmdPasteMove, _T("pastemove") },
\r
223 { cmdPrevDiff, _T("prevdiff") },
\r
224 { cmdProperties, _T("properties") },
\r
225 { cmdPull, _T("pull") },
\r
226 { cmdPush, _T("push") },
\r
227 { cmdRTFM, _T("rtfm") },
\r
228 { cmdRebuildIconCache,_T("rebuildiconcache") },
\r
229 { cmdRelocate, _T("relocate") },
\r
230 { cmdRemove, _T("remove") },
\r
231 { cmdRebase, _T("rebase") },
\r
232 { cmdRename, _T("rename") },
\r
233 { cmdRepoBrowser, _T("repobrowser") },
\r
234 { cmdRepoCreate, _T("repocreate") },
\r
235 { cmdRepoStatus, _T("repostatus") },
\r
236 { cmdResolve, _T("resolve") },
\r
237 { cmdRevert, _T("revert") },
\r
238 { cmdRevisionGraph, _T("revisiongraph") },
\r
239 { cmdSendMail, _T("sendmail") },
\r
240 { cmdSettings, _T("settings") },
\r
241 { cmdShowCompare, _T("showcompare") },
\r
242 { cmdSwitch, _T("switch") },
\r
243 { cmdTag, _T("tag") },
\r
244 { cmdUnIgnore, _T("unignore") },
\r
245 { cmdUnlock, _T("unlock") },
\r
246 { cmdUpdate, _T("update") },
\r
247 { cmdUpdateCheck, _T("updatecheck") },
\r
248 { cmdUrlDiff, _T("urldiff") },
\r
249 { cmdStashSave, _T("stashsave") },
\r
250 { cmdStashApply, _T("stashapply") },
\r
251 { cmdStashList, _T("stashlist") },
\r
252 { cmdSubAdd, _T("subadd") },
\r
253 { cmdSubUpdate, _T("subupdate") },
\r
254 { cmdSubSync, _T("subsync") },
\r
255 { cmdRefLog, _T("reflog") },
\r
256 { cmdTest, _T("test") },
\r
261 class TestCommand : public Command
\r
263 virtual bool Execute()
\r
265 CBrowseRefsDlg(orgCmdLinePath.GetWinPath()).DoModal();
\r
272 Command * CommandServer::GetCommand(const CString& sCmd)
\r
274 // Look up the command
\r
275 TGitCommand command = cmdAbout; // Something harmless as a default
\r
276 for (int nCommand = 0; nCommand < (sizeof(commandInfo)/sizeof(commandInfo[0])); nCommand++)
\r
278 if (sCmd.Compare(commandInfo[nCommand].pCommandName) == 0)
\r
280 // We've found the command
\r
281 command = commandInfo[nCommand].command;
\r
282 // If this fires, you've let the enum get out of sync with the commandInfo array
\r
283 ASSERT((int)command == nCommand);
\r
289 // CBrowseRefsDlg dialog
\r
295 return new AboutCommand;
\r
297 return new CommitCommand;
\r
299 return new LogCommand;
\r
300 case cmdRepoCreate:
\r
301 return new CreateRepositoryCommand;
\r
303 return new CloneCommand;
\r
305 return new PrevDiffCommand;
\r
307 return new DiffCommand;
\r
309 return new RenameCommand;
\r
310 case cmdRepoStatus:
\r
311 return new RepoStatusCommand;
\r
313 return new RemoveCommand;
\r
315 return new RevertCommand;
\r
317 return new PullCommand;
\r
319 return new FetchCommand;
\r
321 return new PushCommand;
\r
323 return new BranchCommand;
\r
325 return new TagCommand;
\r
327 return new MergeCommand;
\r
329 return new SwitchCommand;
\r
331 return new ExportCommand;
\r
333 return new AddCommand;
\r
335 return new IgnoreCommand;
\r
336 case cmdFormatPatch:
\r
337 return new FormatPatchCommand;
\r
338 case cmdImportPatch:
\r
339 return new ImportPatchCommand;
\r
341 return new BlameCommand;
\r
343 return new SettingsCommand;
\r
344 case cmdConflictEditor:
\r
345 return new ConflictEditorCommand;
\r
347 return new CleanupCommand;
\r
349 return new RebaseCommand;
\r
351 return new ResolveCommand;
\r
353 return new DropMoveCommand;
\r
354 // case cmdDropCopy:
\r
355 // return new DropCopyCommand;
\r
356 // case cmdDropCopyAdd:
\r
357 // return new DropCopyAddCommand;
\r
358 // case cmdDropExport:
\r
359 // return new DropExportCommand;
\r
361 return new HelpCommand;
\r
363 return new StashSaveCommand;
\r
364 case cmdStashApply:
\r
365 return new StashApplyCommand;
\r
367 return new SubmoduleAddCommand;
\r
369 return new SubmoduleUpdateCommand;
\r
371 return new RefLogCommand;
\r
373 return new SubmoduleSyncCommand;
\r
375 return new SendMailCommand;
\r
377 return new CatCommand;
\r
379 return new TestCommand;
\r
384 return new CheckoutCommand;
\r
389 return new CopyCommand;
\r
391 return new CrashCommand;
\r
392 case cmdCreatePatch:
\r
393 return new CreatePatchCommand;
\r
394 case cmdDelUnversioned:
\r
395 return new DelUnversionedCommand;
\r
400 return new ImportCommand;
\r
402 return new LockCommand;
\r
404 return new MergeAllCommand;
\r
406 return new PasteCopyCommand;
\r
408 return new PasteMoveCommand;
\r
410 return new PrevDiffCommand;
\r
411 case cmdProperties:
\r
412 return new PropertiesCommand;
\r
414 return new RTFMCommand;
\r
415 case cmdRebuildIconCache:
\r
416 return new RebuildIconCacheCommand;
\r
418 return new RelocateCommand;
\r
419 case cmdRepoBrowser:
\r
420 return new RepositoryBrowserCommand;
\r
421 case cmdRevisionGraph:
\r
422 return new RevisionGraphCommand;
\r
423 case cmdShowCompare:
\r
424 return new ShowCompareCommand;
\r
426 return new UnIgnoreCommand;
\r
428 return new UnLockCommand;
\r
430 return new UpdateCommand;
\r
431 case cmdUpdateCheck:
\r
432 return new UpdateCheckCommand;
\r
434 return new UrlDiffCommand;
\r
437 CMessageBox::Show(hWndExplorer, _T("Have not implemented"), _T("TortoiseGit"), MB_ICONERROR);
\r
438 return new AboutCommand;
\r