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
63 #include "CatCommand.h"
\r
64 #include "CheckoutCommand.h"
\r
68 #include "CopyCommand.h"
\r
69 #include "CrashCommand.h"
\r
70 #include "CreatePatchCommand.h"
\r
72 #include "DelUnversionedCommand.h"
\r
79 #include "ImportCommand.h"
\r
80 #include "LockCommand.h"
\r
83 #include "MergeAllCommand.h"
\r
84 #include "PasteCopyCommand.h"
\r
85 #include "PasteMoveCommand.h"
\r
87 #include "PropertiesCommand.h"
\r
88 #include "RebuildIconCacheCommand.h"
\r
89 #include "RelocateCommand.h"
\r
90 #include "RemoveCommand.h"
\r
92 #include "RepositoryBrowserCommand.h"
\r
95 #include "RevertCommand.h"
\r
96 #include "RevisiongraphCommand.h"
\r
97 #include "RTFMCommand.h"
\r
99 #include "ShowCompareCommand.h"
\r
101 #include "UnIgnoreCommand.h"
\r
102 #include "UnLockCommand.h"
\r
103 #include "UpdateCheckCommand.h"
\r
104 #include "UpdateCommand.h"
\r
105 #include "UrlDiffCommand.h"
\r
146 cmdRebuildIconCache,
\r
174 static const struct CommandInfo
\r
176 TGitCommand command;
\r
177 LPCTSTR pCommandName;
\r
180 { cmdAbout, _T("about") },
\r
181 { cmdAdd, _T("add") },
\r
182 { cmdBlame, _T("blame") },
\r
183 { cmdBranch, _T("branch") },
\r
184 { cmdCat, _T("cat") },
\r
185 { cmdCheckout, _T("checkout") },
\r
186 { cmdCleanup, _T("cleanup") },
\r
187 { cmdClone, _T("clone") },
\r
188 { cmdCommit, _T("commit") },
\r
189 { cmdConflictEditor, _T("conflicteditor") },
\r
190 { cmdCopy, _T("copy") },
\r
191 { cmdCrash, _T("crash") },
\r
192 { cmdCreatePatch, _T("createpatch") },
\r
193 { cmdDelUnversioned, _T("delunversioned") },
\r
194 { cmdDiff, _T("diff") },
\r
195 { cmdDropCopy, _T("dropcopy") },
\r
196 { cmdDropCopyAdd, _T("dropcopyadd") },
\r
197 { cmdDropExport, _T("dropexport") },
\r
198 { cmdDropMove, _T("dropmove") },
\r
199 { cmdFetch, _T("fetch") },
\r
200 { cmdFormatPatch, _T("formatpatch") },
\r
201 { cmdExport, _T("export") },
\r
202 { cmdHelp, _T("help") },
\r
203 { cmdIgnore, _T("ignore") },
\r
204 { cmdImport, _T("import") },
\r
205 { cmdImportPatch, _T("importpatch") },
\r
206 { cmdLock, _T("lock") },
\r
207 { cmdLog, _T("log") },
\r
208 { cmdMerge, _T("merge") },
\r
209 { cmdMergeAll, _T("mergeall") },
\r
210 { cmdPasteCopy, _T("pastecopy") },
\r
211 { cmdPasteMove, _T("pastemove") },
\r
212 { cmdPrevDiff, _T("prevdiff") },
\r
213 { cmdProperties, _T("properties") },
\r
214 { cmdPull, _T("pull") },
\r
215 { cmdPush, _T("push") },
\r
216 { cmdRTFM, _T("rtfm") },
\r
217 { cmdRebuildIconCache,_T("rebuildiconcache") },
\r
218 { cmdRelocate, _T("relocate") },
\r
219 { cmdRemove, _T("remove") },
\r
220 { cmdRebase, _T("rebase") },
\r
221 { cmdRename, _T("rename") },
\r
222 { cmdRepoBrowser, _T("repobrowser") },
\r
223 { cmdRepoCreate, _T("repocreate") },
\r
224 { cmdRepoStatus, _T("repostatus") },
\r
225 { cmdResolve, _T("resolve") },
\r
226 { cmdRevert, _T("revert") },
\r
227 { cmdRevisionGraph, _T("revisiongraph") },
\r
228 { cmdSettings, _T("settings") },
\r
229 { cmdShowCompare, _T("showcompare") },
\r
230 { cmdSwitch, _T("switch") },
\r
231 { cmdTag, _T("tag") },
\r
232 { cmdUnIgnore, _T("unignore") },
\r
233 { cmdUnlock, _T("unlock") },
\r
234 { cmdUpdate, _T("update") },
\r
235 { cmdUpdateCheck, _T("updatecheck") },
\r
236 { cmdUrlDiff, _T("urldiff") },
\r
237 { cmdStashSave, _T("stashsave") },
\r
238 { cmdStashApply, _T("stashapply") },
\r
239 { cmdStashList, _T("stashlist") },
\r
240 { cmdSubAdd, _T("subadd") },
\r
241 { cmdSubUpdate, _T("subupdate") },
\r
247 Command * CommandServer::GetCommand(const CString& sCmd)
\r
249 // Look up the command
\r
250 TGitCommand command = cmdAbout; // Something harmless as a default
\r
251 for (int nCommand = 0; nCommand < (sizeof(commandInfo)/sizeof(commandInfo[0])); nCommand++)
\r
253 if (sCmd.Compare(commandInfo[nCommand].pCommandName) == 0)
\r
255 // We've found the command
\r
256 command = commandInfo[nCommand].command;
\r
257 // If this fires, you've let the enum get out of sync with the commandInfo array
\r
258 ASSERT((int)command == nCommand);
\r
268 return new AboutCommand;
\r
270 return new CommitCommand;
\r
272 return new LogCommand;
\r
273 case cmdRepoCreate:
\r
274 return new CreateRepositoryCommand;
\r
276 return new CloneCommand;
\r
278 return new PrevDiffCommand;
\r
280 return new DiffCommand;
\r
282 return new RenameCommand;
\r
283 case cmdRepoStatus:
\r
284 return new RepoStatusCommand;
\r
286 return new RemoveCommand;
\r
288 return new RevertCommand;
\r
290 return new PullCommand;
\r
292 return new FetchCommand;
\r
294 return new PushCommand;
\r
296 return new BranchCommand;
\r
298 return new TagCommand;
\r
300 return new MergeCommand;
\r
302 return new SwitchCommand;
\r
304 return new ExportCommand;
\r
306 return new AddCommand;
\r
308 return new IgnoreCommand;
\r
309 case cmdFormatPatch:
\r
310 return new FormatPatchCommand;
\r
311 case cmdImportPatch:
\r
312 return new ImportPatchCommand;
\r
314 return new BlameCommand;
\r
316 return new SettingsCommand;
\r
317 case cmdConflictEditor:
\r
318 return new ConflictEditorCommand;
\r
320 return new CleanupCommand;
\r
322 return new RebaseCommand;
\r
324 return new ResolveCommand;
\r
326 return new DropMoveCommand;
\r
327 // case cmdDropCopy:
\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 HelpCommand;
\r
338 return new CatCommand;
\r
340 return new CheckoutCommand;
\r
345 return new CopyCommand;
\r
347 return new CrashCommand;
\r
348 case cmdCreatePatch:
\r
349 return new CreatePatchCommand;
\r
350 case cmdDelUnversioned:
\r
351 return new DelUnversionedCommand;
\r
356 return new ImportCommand;
\r
358 return new LockCommand;
\r
360 return new MergeAllCommand;
\r
362 return new PasteCopyCommand;
\r
364 return new PasteMoveCommand;
\r
366 return new PrevDiffCommand;
\r
367 case cmdProperties:
\r
368 return new PropertiesCommand;
\r
370 return new RTFMCommand;
\r
371 case cmdRebuildIconCache:
\r
372 return new RebuildIconCacheCommand;
\r
374 return new RelocateCommand;
\r
375 case cmdRepoBrowser:
\r
376 return new RepositoryBrowserCommand;
\r
377 case cmdRevisionGraph:
\r
378 return new RevisionGraphCommand;
\r
379 case cmdShowCompare:
\r
380 return new ShowCompareCommand;
\r
382 return new UnIgnoreCommand;
\r
384 return new UnLockCommand;
\r
386 return new UpdateCommand;
\r
387 case cmdUpdateCheck:
\r
388 return new UpdateCheckCommand;
\r
390 return new UrlDiffCommand;
\r
393 CMessageBox::Show(hWndExplorer, _T("Have not implemented"), _T("TortoiseGit"), MB_ICONERROR);
\r
394 return new AboutCommand;
\r