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
32 #include "AddCommand.h"
\r
33 #include "BlameCommand.h"
\r
34 #include "CatCommand.h"
\r
35 #include "CheckoutCommand.h"
\r
36 #include "CleanupCommand.h"
\r
38 #include "ConflictEditorCommand.h"
\r
39 #include "CopyCommand.h"
\r
40 #include "CrashCommand.h"
\r
41 #include "CreatePatchCommand.h"
\r
43 #include "DelUnversionedCommand.h"
\r
45 #include "DropCopyAddCommand.h"
\r
46 #include "DropCopyCommand.h"
\r
47 #include "DropExportCommand.h"
\r
48 #include "DropMoveCommand.h"
\r
49 #include "ExportCommand.h"
\r
50 #include "HelpCommand.h"
\r
51 #include "IgnoreCommand.h"
\r
52 #include "ImportCommand.h"
\r
53 #include "LockCommand.h"
\r
55 #include "MergeCommand.h"
\r
56 #include "MergeAllCommand.h"
\r
57 #include "PasteCopyCommand.h"
\r
58 #include "PasteMoveCommand.h"
\r
60 #include "PropertiesCommand.h"
\r
61 #include "RebuildIconCacheCommand.h"
\r
62 #include "RelocateCommand.h"
\r
63 #include "RemoveCommand.h"
\r
64 #include "RenameCommand.h"
\r
65 #include "RepositoryBrowserCommand.h"
\r
66 #include "RepoStatusCommand.h"
\r
67 #include "ResolveCommand.h"
\r
68 #include "RevertCommand.h"
\r
69 #include "RevisiongraphCommand.h"
\r
70 #include "RTFMCommand.h"
\r
71 #include "SettingsCommand.h"
\r
72 #include "ShowCompareCommand.h"
\r
73 #include "SwitchCommand.h"
\r
74 #include "UnIgnoreCommand.h"
\r
75 #include "UnLockCommand.h"
\r
76 #include "UpdateCheckCommand.h"
\r
77 #include "UpdateCommand.h"
\r
78 #include "UrlDiffCommand.h"
\r
113 cmdRebuildIconCache,
\r
134 static const struct CommandInfo
\r
136 TGitCommand command;
\r
137 LPCTSTR pCommandName;
\r
140 { cmdAbout, _T("about") },
\r
141 { cmdAdd, _T("add") },
\r
142 { cmdBlame, _T("blame") },
\r
143 { cmdCat, _T("cat") },
\r
144 { cmdCheckout, _T("checkout") },
\r
145 { cmdCleanup, _T("cleanup") },
\r
146 { cmdClone, _T("clone") },
\r
147 { cmdCommit, _T("commit") },
\r
148 { cmdConflictEditor, _T("conflicteditor") },
\r
149 { cmdCopy, _T("copy") },
\r
150 { cmdCrash, _T("crash") },
\r
151 { cmdCreatePatch, _T("createpatch") },
\r
152 { cmdDelUnversioned, _T("delunversioned") },
\r
153 { cmdDiff, _T("diff") },
\r
154 { cmdDropCopy, _T("dropcopy") },
\r
155 { cmdDropCopyAdd, _T("dropcopyadd") },
\r
156 { cmdDropExport, _T("dropexport") },
\r
157 { cmdDropMove, _T("dropmove") },
\r
158 { cmdExport, _T("export") },
\r
159 { cmdHelp, _T("help") },
\r
160 { cmdIgnore, _T("ignore") },
\r
161 { cmdImport, _T("import") },
\r
162 { cmdLock, _T("lock") },
\r
163 { cmdLog, _T("log") },
\r
164 { cmdMerge, _T("merge") },
\r
165 { cmdMergeAll, _T("mergeall") },
\r
166 { cmdPasteCopy, _T("pastecopy") },
\r
167 { cmdPasteMove, _T("pastemove") },
\r
168 { cmdPrevDiff, _T("prevdiff") },
\r
169 { cmdProperties, _T("properties") },
\r
170 { cmdRTFM, _T("rtfm") },
\r
171 { cmdRebuildIconCache,_T("rebuildiconcache") },
\r
172 { cmdRelocate, _T("relocate") },
\r
173 { cmdRemove, _T("remove") },
\r
174 { cmdRename, _T("rename") },
\r
175 { cmdRepoBrowser, _T("repobrowser") },
\r
176 { cmdRepoCreate, _T("repocreate") },
\r
177 { cmdRepoStatus, _T("repostatus") },
\r
178 { cmdResolve, _T("resolve") },
\r
179 { cmdRevert, _T("revert") },
\r
180 { cmdRevisionGraph, _T("revisiongraph") },
\r
181 { cmdSettings, _T("settings") },
\r
182 { cmdShowCompare, _T("showcompare") },
\r
183 { cmdSwitch, _T("switch") },
\r
184 { cmdUnIgnore, _T("unignore") },
\r
185 { cmdUnlock, _T("unlock") },
\r
186 { cmdUpdate, _T("update") },
\r
187 { cmdUpdateCheck, _T("updatecheck") },
\r
188 { cmdUrlDiff, _T("urldiff") },
\r
194 Command * CommandServer::GetCommand(const CString& sCmd)
\r
196 // Look up the command
\r
197 TGitCommand command = cmdAbout; // Something harmless as a default
\r
198 for (int nCommand = 0; nCommand < (sizeof(commandInfo)/sizeof(commandInfo[0])); nCommand++)
\r
200 if (sCmd.Compare(commandInfo[nCommand].pCommandName) == 0)
\r
202 // We've found the command
\r
203 command = commandInfo[nCommand].command;
\r
204 // If this fires, you've let the enum get out of sync with the commandInfo array
\r
205 ASSERT((int)command == nCommand);
\r
215 return new AboutCommand;
\r
217 return new CommitCommand;
\r
219 return new LogCommand;
\r
220 case cmdRepoCreate:
\r
221 return new CreateRepositoryCommand;
\r
223 return new CloneCommand;
\r
225 return new PrevDiffCommand;
\r
227 return new DiffCommand;
\r
230 return new AddCommand;
\r
232 return new BlameCommand;
\r
234 return new CatCommand;
\r
236 return new CheckoutCommand;
\r
238 return new CleanupCommand;
\r
240 case cmdConflictEditor:
\r
241 return new ConflictEditorCommand;
\r
243 return new CopyCommand;
\r
245 return new CrashCommand;
\r
246 case cmdCreatePatch:
\r
247 return new CreatePatchCommand;
\r
248 case cmdDelUnversioned:
\r
249 return new DelUnversionedCommand;
\r
252 return new DropCopyCommand;
\r
253 case cmdDropCopyAdd:
\r
254 return new DropCopyAddCommand;
\r
255 case cmdDropExport:
\r
256 return new DropExportCommand;
\r
258 return new DropMoveCommand;
\r
260 return new ExportCommand;
\r
262 return new HelpCommand;
\r
264 return new IgnoreCommand;
\r
266 return new ImportCommand;
\r
268 return new LockCommand;
\r
271 return new MergeCommand;
\r
273 return new MergeAllCommand;
\r
275 return new PasteCopyCommand;
\r
277 return new PasteMoveCommand;
\r
279 return new PrevDiffCommand;
\r
280 case cmdProperties:
\r
281 return new PropertiesCommand;
\r
283 return new RTFMCommand;
\r
284 case cmdRebuildIconCache:
\r
285 return new RebuildIconCacheCommand;
\r
287 return new RelocateCommand;
\r
289 return new RemoveCommand;
\r
291 return new RenameCommand;
\r
292 case cmdRepoBrowser:
\r
293 return new RepositoryBrowserCommand;
\r
295 case cmdRepoStatus:
\r
296 return new RepoStatusCommand;
\r
298 return new ResolveCommand;
\r
300 return new RevertCommand;
\r
301 case cmdRevisionGraph:
\r
302 return new RevisionGraphCommand;
\r
304 return new SettingsCommand;
\r
305 case cmdShowCompare:
\r
306 return new ShowCompareCommand;
\r
308 return new SwitchCommand;
\r
310 return new UnIgnoreCommand;
\r
312 return new UnLockCommand;
\r
314 return new UpdateCommand;
\r
315 case cmdUpdateCheck:
\r
316 return new UpdateCheckCommand;
\r
318 return new UrlDiffCommand;
\r
321 CMessageBox::Show(hWndExplorer, _T("Have not implemented"), _T("TortoiseGit"), MB_ICONERROR);
\r
322 return new AboutCommand;
\r