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
45 #include "AddCommand.h"
\r
46 #include "BlameCommand.h"
\r
47 #include "CatCommand.h"
\r
48 #include "CheckoutCommand.h"
\r
49 #include "CleanupCommand.h"
\r
51 #include "ConflictEditorCommand.h"
\r
52 #include "CopyCommand.h"
\r
53 #include "CrashCommand.h"
\r
54 #include "CreatePatchCommand.h"
\r
56 #include "DelUnversionedCommand.h"
\r
58 #include "DropCopyAddCommand.h"
\r
59 #include "DropCopyCommand.h"
\r
60 #include "DropExportCommand.h"
\r
61 #include "DropMoveCommand.h"
\r
62 #include "ExportCommand.h"
\r
63 #include "HelpCommand.h"
\r
64 #include "IgnoreCommand.h"
\r
65 #include "ImportCommand.h"
\r
66 #include "LockCommand.h"
\r
69 #include "MergeAllCommand.h"
\r
70 #include "PasteCopyCommand.h"
\r
71 #include "PasteMoveCommand.h"
\r
73 #include "PropertiesCommand.h"
\r
74 #include "RebuildIconCacheCommand.h"
\r
75 #include "RelocateCommand.h"
\r
76 #include "RemoveCommand.h"
\r
78 #include "RepositoryBrowserCommand.h"
\r
80 #include "ResolveCommand.h"
\r
81 #include "RevertCommand.h"
\r
82 #include "RevisiongraphCommand.h"
\r
83 #include "RTFMCommand.h"
\r
84 #include "SettingsCommand.h"
\r
85 #include "ShowCompareCommand.h"
\r
87 #include "UnIgnoreCommand.h"
\r
88 #include "UnLockCommand.h"
\r
89 #include "UpdateCheckCommand.h"
\r
90 #include "UpdateCommand.h"
\r
91 #include "UrlDiffCommand.h"
\r
130 cmdRebuildIconCache,
\r
152 static const struct CommandInfo
\r
154 TGitCommand command;
\r
155 LPCTSTR pCommandName;
\r
158 { cmdAbout, _T("about") },
\r
159 { cmdAdd, _T("add") },
\r
160 { cmdBlame, _T("blame") },
\r
161 { cmdBranch, _T("branch") },
\r
162 { cmdCat, _T("cat") },
\r
163 { cmdCheckout, _T("checkout") },
\r
164 { cmdCleanup, _T("cleanup") },
\r
165 { cmdClone, _T("clone") },
\r
166 { cmdCommit, _T("commit") },
\r
167 { cmdConflictEditor, _T("conflicteditor") },
\r
168 { cmdCopy, _T("copy") },
\r
169 { cmdCrash, _T("crash") },
\r
170 { cmdCreatePatch, _T("createpatch") },
\r
171 { cmdDelUnversioned, _T("delunversioned") },
\r
172 { cmdDiff, _T("diff") },
\r
173 { cmdDropCopy, _T("dropcopy") },
\r
174 { cmdDropCopyAdd, _T("dropcopyadd") },
\r
175 { cmdDropExport, _T("dropexport") },
\r
176 { cmdDropMove, _T("dropmove") },
\r
177 { cmdFetch, _T("fetch") },
\r
178 { cmdExport, _T("export") },
\r
179 { cmdHelp, _T("help") },
\r
180 { cmdIgnore, _T("ignore") },
\r
181 { cmdImport, _T("import") },
\r
182 { cmdLock, _T("lock") },
\r
183 { cmdLog, _T("log") },
\r
184 { cmdMerge, _T("merge") },
\r
185 { cmdMergeAll, _T("mergeall") },
\r
186 { cmdPasteCopy, _T("pastecopy") },
\r
187 { cmdPasteMove, _T("pastemove") },
\r
188 { cmdPrevDiff, _T("prevdiff") },
\r
189 { cmdProperties, _T("properties") },
\r
190 { cmdPull, _T("pull") },
\r
191 { cmdPush, _T("push") },
\r
192 { cmdRTFM, _T("rtfm") },
\r
193 { cmdRebuildIconCache,_T("rebuildiconcache") },
\r
194 { cmdRelocate, _T("relocate") },
\r
195 { cmdRemove, _T("remove") },
\r
196 { cmdRename, _T("rename") },
\r
197 { cmdRepoBrowser, _T("repobrowser") },
\r
198 { cmdRepoCreate, _T("repocreate") },
\r
199 { cmdRepoStatus, _T("repostatus") },
\r
200 { cmdResolve, _T("resolve") },
\r
201 { cmdRevert, _T("revert") },
\r
202 { cmdRevisionGraph, _T("revisiongraph") },
\r
203 { cmdSettings, _T("settings") },
\r
204 { cmdShowCompare, _T("showcompare") },
\r
205 { cmdSwitch, _T("switch") },
\r
206 { cmdTag, _T("tag") },
\r
207 { cmdUnIgnore, _T("unignore") },
\r
208 { cmdUnlock, _T("unlock") },
\r
209 { cmdUpdate, _T("update") },
\r
210 { cmdUpdateCheck, _T("updatecheck") },
\r
211 { cmdUrlDiff, _T("urldiff") },
\r
217 Command * CommandServer::GetCommand(const CString& sCmd)
\r
219 // Look up the command
\r
220 TGitCommand command = cmdAbout; // Something harmless as a default
\r
221 for (int nCommand = 0; nCommand < (sizeof(commandInfo)/sizeof(commandInfo[0])); nCommand++)
\r
223 if (sCmd.Compare(commandInfo[nCommand].pCommandName) == 0)
\r
225 // We've found the command
\r
226 command = commandInfo[nCommand].command;
\r
227 // If this fires, you've let the enum get out of sync with the commandInfo array
\r
228 ASSERT((int)command == nCommand);
\r
238 return new AboutCommand;
\r
240 return new CommitCommand;
\r
242 return new LogCommand;
\r
243 case cmdRepoCreate:
\r
244 return new CreateRepositoryCommand;
\r
246 return new CloneCommand;
\r
248 return new PrevDiffCommand;
\r
250 return new DiffCommand;
\r
252 return new RenameCommand;
\r
253 case cmdRepoStatus:
\r
254 return new RepoStatusCommand;
\r
256 return new RemoveCommand;
\r
258 return new RevertCommand;
\r
260 return new PullCommand;
\r
262 return new FetchCommand;
\r
264 return new PushCommand;
\r
266 return new BranchCommand;
\r
268 return new TagCommand;
\r
270 return new MergeCommand;
\r
272 return new SwitchCommand;
\r
275 return new AddCommand;
\r
277 return new BlameCommand;
\r
279 return new CatCommand;
\r
281 return new CheckoutCommand;
\r
283 return new CleanupCommand;
\r
285 case cmdConflictEditor:
\r
286 return new ConflictEditorCommand;
\r
288 return new CopyCommand;
\r
290 return new CrashCommand;
\r
291 case cmdCreatePatch:
\r
292 return new CreatePatchCommand;
\r
293 case cmdDelUnversioned:
\r
294 return new DelUnversionedCommand;
\r
297 return new DropCopyCommand;
\r
298 case cmdDropCopyAdd:
\r
299 return new DropCopyAddCommand;
\r
300 case cmdDropExport:
\r
301 return new DropExportCommand;
\r
303 return new DropMoveCommand;
\r
305 return new ExportCommand;
\r
307 return new HelpCommand;
\r
309 return new IgnoreCommand;
\r
311 return new ImportCommand;
\r
313 return new LockCommand;
\r
316 return new MergeCommand;
\r
318 return new MergeAllCommand;
\r
320 return new PasteCopyCommand;
\r
322 return new PasteMoveCommand;
\r
324 return new PrevDiffCommand;
\r
325 case cmdProperties:
\r
326 return new PropertiesCommand;
\r
328 return new RTFMCommand;
\r
329 case cmdRebuildIconCache:
\r
330 return new RebuildIconCacheCommand;
\r
332 return new RelocateCommand;
\r
334 return new RemoveCommand;
\r
336 case cmdRepoBrowser:
\r
337 return new RepositoryBrowserCommand;
\r
341 return new ResolveCommand;
\r
343 return new RevertCommand;
\r
344 case cmdRevisionGraph:
\r
345 return new RevisionGraphCommand;
\r
347 return new SettingsCommand;
\r
348 case cmdShowCompare:
\r
349 return new ShowCompareCommand;
\r
352 return new UnIgnoreCommand;
\r
354 return new UnLockCommand;
\r
356 return new UpdateCommand;
\r
357 case cmdUpdateCheck:
\r
358 return new UpdateCheckCommand;
\r
360 return new UrlDiffCommand;
\r
363 CMessageBox::Show(hWndExplorer, _T("Have not implemented"), _T("TortoiseGit"), MB_ICONERROR);
\r
364 return new AboutCommand;
\r