drop urldiff
[TortoiseGit.git] / src / TortoiseProc / Commands / Command.cpp
blob658a294836274d46f006835e365b85b99e81b53e
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2007-2008 - TortoiseSVN
4 // Copyright (C) 2008-2011 - TortoiseGit
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "StdAfx.h"
21 #include "Command.h"
23 #include "AboutCommand.h"
24 #include "CommitCommand.h"
25 #include "LogCommand.h"
27 #include "CreateRepositoryCommand.h"
28 #include "CloneCommand.h"
29 #include "PrevDiffCommand.h"
30 #include "DiffCommand.h"
32 #include "RenameCommand.h"
33 #include "RepoStatusCommand.h"
35 #include "RevertCommand.h"
36 #include "RemoveCommand.h"
37 #include "PullCommand.h"
38 #include "FetchCommand.h"
39 #include "PushCommand.h"
40 #include "BranchCommand.h"
41 #include "TagCommand.h"
42 #include "MergeCommand.h"
43 #include "SwitchCommand.h"
44 #include "ExportCommand.h"
45 #include "AddCommand.h"
46 #include "IgnoreCommand.h"
47 #include "FormatPatchCommand.h"
48 #include "ImportPatchCommand.h"
49 #include "BlameCommand.h"
50 #include "SettingsCommand.h"
51 #include "ConflictEditorCommand.h"
52 #include "CleanupCommand.h"
53 #include "RebaseCommand.h"
54 #include "ResolveCommand.h"
55 #include "DropMoveCommand.h"
56 #include "DropCopyAddCommand.h"
57 #include "DropCopyCommand.h"
58 #include "HelpCommand.h"
59 #include "StashCommand.h"
60 #include "SubmoduleCommand.h"
61 #include "ReflogCommand.h"
62 #include "SendMailCommand.h"
63 #include "CatCommand.h"
64 #include "RefBrowseCommand.h"
65 #include "SVNDCommitCommand.h"
66 #include "SVNRebaseCommand.h"
67 #include "SyncCommand.h"
68 #include "RequestPullCommand.h"
69 #include "UpdateCheckCommand.h"
70 #include "PasteCopyCommand.h"
71 #include "PasteMoveCommand.h"
72 #include "SVNIgnoreCommand.h"
74 #if 0
77 #include "CopyCommand.h"
78 #include "CrashCommand.h"
80 #include "DelUnversionedCommand.h"
87 #include "PropertiesCommand.h"
88 #include "RebuildIconCacheCommand.h"
89 #include "RelocateCommand.h"
90 #include "RemoveCommand.h"
92 #include "RepositoryBrowserCommand.h"
95 #include "RevertCommand.h"
96 #include "RTFMCommand.h"
98 #include "ShowCompareCommand.h"
100 #include "UnIgnoreCommand.h"
102 #endif
103 typedef enum
105 cmdAbout,
106 cmdAdd,
107 cmdBlame,
108 cmdBranch,
109 cmdCat,
110 cmdCleanup,
111 cmdClone,
112 cmdCommit,
113 cmdConflictEditor,
114 cmdCopy,
115 cmdCrash,
116 cmdDelUnversioned,
117 cmdDiff,
118 cmdDropCopy,
119 cmdDropCopyAdd,
120 cmdDropMove,
121 cmdFetch,
122 cmdFormatPatch,
123 cmdExport,
124 cmdHelp,
125 cmdIgnore,
126 cmdImportPatch,
127 cmdLog,
128 cmdMerge,
129 cmdPasteCopy,
130 cmdPasteMove,
131 cmdPrevDiff,
132 cmdProperties,
133 cmdPull,
134 cmdPush,
135 cmdRTFM,
136 cmdRebuildIconCache,
137 cmdRelocate,
138 cmdRemove,
139 cmdRebase,
140 cmdRename,
141 cmdRepoCreate,
142 cmdRepoStatus,
143 cmdResolve,
144 cmdRevert,
145 cmdSendMail,
146 cmdSettings,
147 cmdShowCompare,
148 cmdSwitch,
149 cmdTag,
150 cmdUnIgnore,
151 cmdUpdateCheck,
152 cmdStashSave,
153 cmdStashApply,
154 cmdStashPop,
155 cmdStashList,
156 cmdSubAdd,
157 cmdSubUpdate,
158 cmdSubSync,
159 cmdRefLog,
160 cmdRefBrowse,
161 cmdSVNDCommit,
162 cmdSVNRebase,
163 cmdSVNIgnore,
164 cmdSync,
165 cmdRequestPull,
166 } TGitCommand;
168 static const struct CommandInfo
170 TGitCommand command;
171 LPCTSTR pCommandName;
172 } commandInfo[] =
174 { cmdAbout, _T("about") },
175 { cmdAdd, _T("add") },
176 { cmdBlame, _T("blame") },
177 { cmdBranch, _T("branch") },
178 { cmdCat, _T("cat") },
179 { cmdCleanup, _T("cleanup") },
180 { cmdClone, _T("clone") },
181 { cmdCommit, _T("commit") },
182 { cmdConflictEditor, _T("conflicteditor") },
183 { cmdCopy, _T("copy") },
184 { cmdCrash, _T("crash") },
185 { cmdDelUnversioned, _T("delunversioned") },
186 { cmdDiff, _T("diff") },
187 { cmdDropCopy, _T("dropcopy") },
188 { cmdDropCopyAdd, _T("dropcopyadd") },
189 { cmdDropMove, _T("dropmove") },
190 { cmdFetch, _T("fetch") },
191 { cmdFormatPatch, _T("formatpatch") },
192 { cmdExport, _T("export") },
193 { cmdHelp, _T("help") },
194 { cmdIgnore, _T("ignore") },
195 { cmdImportPatch, _T("importpatch") },
196 { cmdLog, _T("log") },
197 { cmdMerge, _T("merge") },
198 { cmdPasteCopy, _T("pastecopy") },
199 { cmdPasteMove, _T("pastemove") },
200 { cmdPrevDiff, _T("prevdiff") },
201 { cmdProperties, _T("properties") },
202 { cmdPull, _T("pull") },
203 { cmdPush, _T("push") },
204 { cmdRTFM, _T("rtfm") },
205 { cmdRebuildIconCache,_T("rebuildiconcache") },
206 { cmdRelocate, _T("relocate") },
207 { cmdRemove, _T("remove") },
208 { cmdRebase, _T("rebase") },
209 { cmdRename, _T("rename") },
210 { cmdRepoCreate, _T("repocreate") },
211 { cmdRepoStatus, _T("repostatus") },
212 { cmdResolve, _T("resolve") },
213 { cmdRevert, _T("revert") },
214 { cmdSendMail, _T("sendmail") },
215 { cmdSettings, _T("settings") },
216 { cmdShowCompare, _T("showcompare") },
217 { cmdSwitch, _T("switch") },
218 { cmdTag, _T("tag") },
219 { cmdUnIgnore, _T("unignore") },
220 { cmdUpdateCheck, _T("updatecheck") },
221 { cmdStashSave, _T("stashsave") },
222 { cmdStashApply, _T("stashapply") },
223 { cmdStashPop, _T("stashpop") },
224 { cmdStashList, _T("stashlist") },
225 { cmdSubAdd, _T("subadd") },
226 { cmdSubUpdate, _T("subupdate") },
227 { cmdSubSync, _T("subsync") },
228 { cmdRefLog, _T("reflog") },
229 { cmdRefBrowse, _T("refbrowse") },
230 { cmdSVNDCommit, _T("svndcommit") },
231 { cmdSVNRebase, _T("svnrebase") },
232 { cmdSVNIgnore, _T("svnignore") },
233 { cmdSync, _T("sync") },
234 { cmdRequestPull, _T("requestpull") },
238 Command * CommandServer::GetCommand(const CString& sCmd)
240 // Look up the command
241 TGitCommand command = cmdAbout; // Something harmless as a default
242 for (int nCommand = 0; nCommand < _countof(commandInfo); nCommand++)
244 if (sCmd.Compare(commandInfo[nCommand].pCommandName) == 0)
246 // We've found the command
247 command = commandInfo[nCommand].command;
248 // If this fires, you've let the enum get out of sync with the commandInfo array
249 ASSERT((int)command == nCommand);
250 break;
254 // CBrowseRefsDlg dialog
255 switch (command)
257 case cmdAbout:
258 return new AboutCommand;
259 case cmdCommit:
260 return new CommitCommand;
261 case cmdLog:
262 return new LogCommand;
263 case cmdRepoCreate:
264 return new CreateRepositoryCommand;
265 case cmdClone:
266 return new CloneCommand;
267 case cmdPrevDiff:
268 return new PrevDiffCommand;
269 case cmdDiff:
270 return new DiffCommand;
271 case cmdRename:
272 return new RenameCommand;
273 case cmdRepoStatus:
274 return new RepoStatusCommand;
275 case cmdRemove:
276 return new RemoveCommand;
277 case cmdRevert:
278 return new RevertCommand;
279 case cmdPull:
280 return new PullCommand;
281 case cmdFetch:
282 return new FetchCommand;
283 case cmdPush:
284 return new PushCommand;
285 case cmdBranch:
286 return new BranchCommand;
287 case cmdTag:
288 return new TagCommand;
289 case cmdMerge:
290 return new MergeCommand;
291 case cmdSwitch:
292 return new SwitchCommand;
293 case cmdExport:
294 return new ExportCommand;
295 case cmdAdd:
296 return new AddCommand;
297 case cmdIgnore:
298 return new IgnoreCommand;
299 case cmdFormatPatch:
300 return new FormatPatchCommand;
301 case cmdImportPatch:
302 return new ImportPatchCommand;
303 case cmdBlame:
304 return new BlameCommand;
305 case cmdSettings:
306 return new SettingsCommand;
307 case cmdConflictEditor:
308 return new ConflictEditorCommand;
309 case cmdCleanup:
310 return new CleanupCommand;
311 case cmdRebase:
312 return new RebaseCommand;
313 case cmdResolve:
314 return new ResolveCommand;
315 case cmdDropMove:
316 return new DropMoveCommand;
317 case cmdDropCopy:
318 return new DropCopyCommand;
319 case cmdDropCopyAdd:
320 return new DropCopyAddCommand;
321 case cmdHelp:
322 return new HelpCommand;
323 case cmdStashSave:
324 return new StashSaveCommand;
325 case cmdStashApply:
326 return new StashApplyCommand;
327 case cmdStashPop:
328 return new StashPopCommand;
329 case cmdSubAdd:
330 return new SubmoduleAddCommand;
331 case cmdSubUpdate:
332 return new SubmoduleUpdateCommand;
333 case cmdRefLog:
334 return new RefLogCommand;
335 case cmdSubSync:
336 return new SubmoduleSyncCommand;
337 case cmdSendMail:
338 return new SendMailCommand;
339 case cmdCat:
340 return new CatCommand;
341 case cmdRefBrowse:
342 return new RefBrowseCommand;
343 case cmdSVNDCommit:
344 return new SVNDCommitCommand;
345 case cmdSVNRebase:
346 return new SVNRebaseCommand;
347 case cmdSync:
348 return new SyncCommand;
349 case cmdRequestPull:
350 return new RequestPullCommand;
351 case cmdUpdateCheck:
352 return new UpdateCheckCommand;
353 case cmdPasteCopy:
354 return new PasteCopyCommand;
355 case cmdPasteMove:
356 return new PasteMoveCommand;
357 case cmdSVNIgnore:
358 return new SVNIgnoreCommand;
360 #if 0
364 case cmdCopy:
365 return new CopyCommand;
366 case cmdCrash:
367 return new CrashCommand;
368 case cmdDelUnversioned:
369 return new DelUnversionedCommand;
373 case cmdPrevDiff:
374 return new PrevDiffCommand;
375 case cmdProperties:
376 return new PropertiesCommand;
377 case cmdRTFM:
378 return new RTFMCommand;
379 case cmdRebuildIconCache:
380 return new RebuildIconCacheCommand;
381 case cmdRelocate:
382 return new RelocateCommand;
383 case cmdShowCompare:
384 return new ShowCompareCommand;
385 case cmdUnIgnore:
386 return new UnIgnoreCommand;
387 #endif
388 default:
389 CMessageBox::Show(hWndExplorer, _T("Command not implemented"), _T("TortoiseGit"), MB_ICONERROR);
390 return new AboutCommand;