Add daemon command
[TortoiseGit.git] / src / TortoiseProc / Commands / Command.cpp
blob72fbe6e50334a62b1c284c000a1c30554210b53a
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2013 - TortoiseGit
4 // Copyright (C) 2007-2008 - TortoiseSVN
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 "SVNFetchCommand.h"
68 #include "SyncCommand.h"
69 #include "RequestPullCommand.h"
70 #include "UpdateCheckCommand.h"
71 #include "PasteCopyCommand.h"
72 #include "PasteMoveCommand.h"
73 #include "SVNIgnoreCommand.h"
74 #include "BisectCommand.h"
75 #include "RepositoryBrowserCommand.h"
76 #include "RevisiongraphCommand.h"
77 #include "ShowCompareCommand.h"
78 #include "DaemonCommand.h"
80 #if 0
83 #include "CopyCommand.h"
84 #include "CrashCommand.h"
90 #include "PropertiesCommand.h"
91 #include "RebuildIconCacheCommand.h"
92 #include "RemoveCommand.h"
96 #include "RevertCommand.h"
97 #include "RTFMCommand.h"
99 #include "UnIgnoreCommand.h"
101 #endif
102 typedef enum
104 cmdAbout,
105 cmdAdd,
106 cmdBlame,
107 cmdBranch,
108 cmdCat,
109 cmdCleanup,
110 cmdClone,
111 cmdCommit,
112 cmdConflictEditor,
113 cmdCopy,
114 cmdCrash,
115 cmdDiff,
116 cmdDropCopy,
117 cmdDropCopyAdd,
118 cmdDropMove,
119 cmdFetch,
120 cmdFormatPatch,
121 cmdExport,
122 cmdHelp,
123 cmdIgnore,
124 cmdImportPatch,
125 cmdLog,
126 cmdMerge,
127 cmdPasteCopy,
128 cmdPasteMove,
129 cmdPrevDiff,
130 cmdProperties,
131 cmdPull,
132 cmdPush,
133 cmdRTFM,
134 cmdRebuildIconCache,
135 cmdRemove,
136 cmdRebase,
137 cmdRename,
138 cmdRepoCreate,
139 cmdRepoStatus,
140 cmdResolve,
141 cmdRevert,
142 cmdSendMail,
143 cmdSettings,
144 cmdShowCompare,
145 cmdSwitch,
146 cmdTag,
147 cmdUnIgnore,
148 cmdUpdateCheck,
149 cmdStashSave,
150 cmdStashApply,
151 cmdStashPop,
152 cmdStashList,
153 cmdSubAdd,
154 cmdSubUpdate,
155 cmdSubSync,
156 cmdRefLog,
157 cmdRefBrowse,
158 cmdSVNDCommit,
159 cmdSVNRebase,
160 cmdSVNFetch,
161 cmdSVNIgnore,
162 cmdSync,
163 cmdRequestPull,
164 cmdBisect,
165 cmdRepoBrowser,
166 cmdRevisionGraph,
167 cmdDaemon,
168 } TGitCommand;
170 static const struct CommandInfo
172 TGitCommand command;
173 LPCTSTR pCommandName;
174 } commandInfo[] =
176 { cmdAbout, _T("about") },
177 { cmdAdd, _T("add") },
178 { cmdBlame, _T("blame") },
179 { cmdBranch, _T("branch") },
180 { cmdCat, _T("cat") },
181 { cmdCleanup, _T("cleanup") },
182 { cmdClone, _T("clone") },
183 { cmdCommit, _T("commit") },
184 { cmdConflictEditor, _T("conflicteditor") },
185 { cmdCopy, _T("copy") },
186 { cmdCrash, _T("crash") },
187 { cmdDiff, _T("diff") },
188 { cmdDropCopy, _T("dropcopy") },
189 { cmdDropCopyAdd, _T("dropcopyadd") },
190 { cmdDropMove, _T("dropmove") },
191 { cmdFetch, _T("fetch") },
192 { cmdFormatPatch, _T("formatpatch") },
193 { cmdExport, _T("export") },
194 { cmdHelp, _T("help") },
195 { cmdIgnore, _T("ignore") },
196 { cmdImportPatch, _T("importpatch") },
197 { cmdLog, _T("log") },
198 { cmdMerge, _T("merge") },
199 { cmdPasteCopy, _T("pastecopy") },
200 { cmdPasteMove, _T("pastemove") },
201 { cmdPrevDiff, _T("prevdiff") },
202 { cmdProperties, _T("properties") },
203 { cmdPull, _T("pull") },
204 { cmdPush, _T("push") },
205 { cmdRTFM, _T("rtfm") },
206 { cmdRebuildIconCache,_T("rebuildiconcache") },
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 { cmdSVNFetch, _T("svnfetch") },
233 { cmdSVNIgnore, _T("svnignore") },
234 { cmdSync, _T("sync") },
235 { cmdRequestPull, _T("requestpull") },
236 { cmdBisect, _T("bisect") },
237 { cmdRepoBrowser, _T("repobrowser") },
238 { cmdRevisionGraph, _T("revisiongraph") },
239 { cmdDaemon, _T("daemon") },
243 Command * CommandServer::GetCommand(const CString& sCmd)
245 // Look up the command
246 TGitCommand command = cmdAbout; // Something harmless as a default
247 for (int nCommand = 0; nCommand < _countof(commandInfo); ++nCommand)
249 if (sCmd.Compare(commandInfo[nCommand].pCommandName) == 0)
251 // We've found the command
252 command = commandInfo[nCommand].command;
253 // If this fires, you've let the enum get out of sync with the commandInfo array
254 ASSERT((int)command == nCommand);
255 break;
259 // CBrowseRefsDlg dialog
260 switch (command)
262 case cmdAbout:
263 return new AboutCommand;
264 case cmdCommit:
265 return new CommitCommand;
266 case cmdLog:
267 return new LogCommand;
268 case cmdRepoCreate:
269 return new CreateRepositoryCommand;
270 case cmdClone:
271 return new CloneCommand;
272 case cmdPrevDiff:
273 return new PrevDiffCommand;
274 case cmdDiff:
275 return new DiffCommand;
276 case cmdRename:
277 return new RenameCommand;
278 case cmdRepoStatus:
279 return new RepoStatusCommand;
280 case cmdRemove:
281 return new RemoveCommand;
282 case cmdRevert:
283 return new RevertCommand;
284 case cmdPull:
285 return new PullCommand;
286 case cmdFetch:
287 return new FetchCommand;
288 case cmdPush:
289 return new PushCommand;
290 case cmdBranch:
291 return new BranchCommand;
292 case cmdTag:
293 return new TagCommand;
294 case cmdMerge:
295 return new MergeCommand;
296 case cmdSwitch:
297 return new SwitchCommand;
298 case cmdExport:
299 return new ExportCommand;
300 case cmdAdd:
301 return new AddCommand;
302 case cmdIgnore:
303 return new IgnoreCommand;
304 case cmdFormatPatch:
305 return new FormatPatchCommand;
306 case cmdImportPatch:
307 return new ImportPatchCommand;
308 case cmdBlame:
309 return new BlameCommand;
310 case cmdSettings:
311 return new SettingsCommand;
312 case cmdConflictEditor:
313 return new ConflictEditorCommand;
314 case cmdCleanup:
315 return new CleanupCommand;
316 case cmdRebase:
317 return new RebaseCommand;
318 case cmdResolve:
319 return new ResolveCommand;
320 case cmdDropMove:
321 return new DropMoveCommand;
322 case cmdDropCopy:
323 return new DropCopyCommand;
324 case cmdDropCopyAdd:
325 return new DropCopyAddCommand;
326 case cmdHelp:
327 return new HelpCommand;
328 case cmdStashSave:
329 return new StashSaveCommand;
330 case cmdStashApply:
331 return new StashApplyCommand;
332 case cmdStashPop:
333 return new StashPopCommand;
334 case cmdSubAdd:
335 return new SubmoduleAddCommand;
336 case cmdSubUpdate:
337 return new SubmoduleUpdateCommand;
338 case cmdRefLog:
339 return new RefLogCommand;
340 case cmdSubSync:
341 return new SubmoduleSyncCommand;
342 case cmdSendMail:
343 return new SendMailCommand;
344 case cmdCat:
345 return new CatCommand;
346 case cmdRefBrowse:
347 return new RefBrowseCommand;
348 case cmdSVNDCommit:
349 return new SVNDCommitCommand;
350 case cmdSVNRebase:
351 return new SVNRebaseCommand;
352 case cmdSVNFetch:
353 return new SVNFetchCommand;
354 case cmdSync:
355 return new SyncCommand;
356 case cmdRequestPull:
357 return new RequestPullCommand;
358 case cmdUpdateCheck:
359 return new UpdateCheckCommand;
360 case cmdPasteCopy:
361 return new PasteCopyCommand;
362 case cmdPasteMove:
363 return new PasteMoveCommand;
364 case cmdSVNIgnore:
365 return new SVNIgnoreCommand;
366 case cmdBisect:
367 return new BisectCommand;
368 case cmdRepoBrowser:
369 return new RepositoryBrowserCommand;
370 case cmdRevisionGraph:
371 return new RevisionGraphCommand;
372 case cmdShowCompare:
373 return new ShowCompareCommand;
374 case cmdDaemon:
375 return new DaemonCommand;
377 #if 0
381 case cmdCopy:
382 return new CopyCommand;
383 case cmdCrash:
384 return new CrashCommand;
388 case cmdPrevDiff:
389 return new PrevDiffCommand;
390 case cmdProperties:
391 return new PropertiesCommand;
392 case cmdRTFM:
393 return new RTFMCommand;
394 case cmdRebuildIconCache:
395 return new RebuildIconCacheCommand;
396 case cmdUnIgnore:
397 return new UnIgnoreCommand;
398 #endif
399 default:
400 CMessageBox::Show(hWndExplorer, _T("Command not implemented"), _T("TortoiseGit"), MB_ICONERROR);
401 return new AboutCommand;