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.
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"
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"
170 static const struct CommandInfo
173 LPCTSTR pCommandName
;
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
);
259 // CBrowseRefsDlg dialog
263 return new AboutCommand
;
265 return new CommitCommand
;
267 return new LogCommand
;
269 return new CreateRepositoryCommand
;
271 return new CloneCommand
;
273 return new PrevDiffCommand
;
275 return new DiffCommand
;
277 return new RenameCommand
;
279 return new RepoStatusCommand
;
281 return new RemoveCommand
;
283 return new RevertCommand
;
285 return new PullCommand
;
287 return new FetchCommand
;
289 return new PushCommand
;
291 return new BranchCommand
;
293 return new TagCommand
;
295 return new MergeCommand
;
297 return new SwitchCommand
;
299 return new ExportCommand
;
301 return new AddCommand
;
303 return new IgnoreCommand
;
305 return new FormatPatchCommand
;
307 return new ImportPatchCommand
;
309 return new BlameCommand
;
311 return new SettingsCommand
;
312 case cmdConflictEditor
:
313 return new ConflictEditorCommand
;
315 return new CleanupCommand
;
317 return new RebaseCommand
;
319 return new ResolveCommand
;
321 return new DropMoveCommand
;
323 return new DropCopyCommand
;
325 return new DropCopyAddCommand
;
327 return new HelpCommand
;
329 return new StashSaveCommand
;
331 return new StashApplyCommand
;
333 return new StashPopCommand
;
335 return new SubmoduleAddCommand
;
337 return new SubmoduleUpdateCommand
;
339 return new RefLogCommand
;
341 return new SubmoduleSyncCommand
;
343 return new SendMailCommand
;
345 return new CatCommand
;
347 return new RefBrowseCommand
;
349 return new SVNDCommitCommand
;
351 return new SVNRebaseCommand
;
353 return new SVNFetchCommand
;
355 return new SyncCommand
;
357 return new RequestPullCommand
;
359 return new UpdateCheckCommand
;
361 return new PasteCopyCommand
;
363 return new PasteMoveCommand
;
365 return new SVNIgnoreCommand
;
367 return new BisectCommand
;
369 return new RepositoryBrowserCommand
;
370 case cmdRevisionGraph
:
371 return new RevisionGraphCommand
;
373 return new ShowCompareCommand
;
375 return new DaemonCommand
;
382 return new CopyCommand
;
384 return new CrashCommand
;
389 return new PrevDiffCommand
;
391 return new PropertiesCommand
;
393 return new RTFMCommand
;
394 case cmdRebuildIconCache
:
395 return new RebuildIconCacheCommand
;
397 return new UnIgnoreCommand
;
400 CMessageBox::Show(hWndExplorer
, _T("Command not implemented"), _T("TortoiseGit"), MB_ICONERROR
);
401 return new AboutCommand
;