1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2012 - 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 "AssumeValidCommand.h"
81 #include "CopyCommand.h"
82 #include "CrashCommand.h"
88 #include "PropertiesCommand.h"
89 #include "RebuildIconCacheCommand.h"
90 #include "RemoveCommand.h"
94 #include "RevertCommand.h"
95 #include "RTFMCommand.h"
97 #include "ShowCompareCommand.h"
99 #include "UnIgnoreCommand.h"
169 static const struct CommandInfo
172 LPCTSTR pCommandName
;
175 { cmdAbout
, _T("about") },
176 { cmdAdd
, _T("add") },
177 { cmdBlame
, _T("blame") },
178 { cmdBranch
, _T("branch") },
179 { cmdCat
, _T("cat") },
180 { cmdCleanup
, _T("cleanup") },
181 { cmdClone
, _T("clone") },
182 { cmdCommit
, _T("commit") },
183 { cmdConflictEditor
, _T("conflicteditor") },
184 { cmdCopy
, _T("copy") },
185 { cmdCrash
, _T("crash") },
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 { cmdRemove
, _T("remove") },
207 { cmdRebase
, _T("rebase") },
208 { cmdRename
, _T("rename") },
209 { cmdRepoCreate
, _T("repocreate") },
210 { cmdRepoStatus
, _T("repostatus") },
211 { cmdResolve
, _T("resolve") },
212 { cmdRevert
, _T("revert") },
213 { cmdSendMail
, _T("sendmail") },
214 { cmdSettings
, _T("settings") },
215 { cmdShowCompare
, _T("showcompare") },
216 { cmdSwitch
, _T("switch") },
217 { cmdTag
, _T("tag") },
218 { cmdUnIgnore
, _T("unignore") },
219 { cmdUpdateCheck
, _T("updatecheck") },
220 { cmdStashSave
, _T("stashsave") },
221 { cmdStashApply
, _T("stashapply") },
222 { cmdStashPop
, _T("stashpop") },
223 { cmdStashList
, _T("stashlist") },
224 { cmdSubAdd
, _T("subadd") },
225 { cmdSubUpdate
, _T("subupdate") },
226 { cmdSubSync
, _T("subsync") },
227 { cmdRefLog
, _T("reflog") },
228 { cmdRefBrowse
, _T("refbrowse") },
229 { cmdSVNDCommit
, _T("svndcommit") },
230 { cmdSVNRebase
, _T("svnrebase") },
231 { cmdSVNFetch
, _T("svnfetch") },
232 { cmdSVNIgnore
, _T("svnignore") },
233 { cmdSync
, _T("sync") },
234 { cmdRequestPull
, _T("requestpull") },
235 { cmdBisect
, _T("bisect") },
236 { cmdRepoBrowser
, _T("repobrowser") },
237 { cmdAssumeValid
, _T("assumevalid") },
241 Command
* CommandServer::GetCommand(const CString
& sCmd
)
243 // Look up the command
244 TGitCommand command
= cmdAbout
; // Something harmless as a default
245 for (int nCommand
= 0; nCommand
< _countof(commandInfo
); nCommand
++)
247 if (sCmd
.Compare(commandInfo
[nCommand
].pCommandName
) == 0)
249 // We've found the command
250 command
= commandInfo
[nCommand
].command
;
251 // If this fires, you've let the enum get out of sync with the commandInfo array
252 ASSERT((int)command
== nCommand
);
257 // CBrowseRefsDlg dialog
261 return new AboutCommand
;
263 return new CommitCommand
;
265 return new LogCommand
;
267 return new CreateRepositoryCommand
;
269 return new CloneCommand
;
271 return new PrevDiffCommand
;
273 return new DiffCommand
;
275 return new RenameCommand
;
277 return new RepoStatusCommand
;
279 return new RemoveCommand
;
281 return new RevertCommand
;
283 return new PullCommand
;
285 return new FetchCommand
;
287 return new PushCommand
;
289 return new BranchCommand
;
291 return new TagCommand
;
293 return new MergeCommand
;
295 return new SwitchCommand
;
297 return new ExportCommand
;
299 return new AddCommand
;
301 return new IgnoreCommand
;
303 return new FormatPatchCommand
;
305 return new ImportPatchCommand
;
307 return new BlameCommand
;
309 return new SettingsCommand
;
310 case cmdConflictEditor
:
311 return new ConflictEditorCommand
;
313 return new CleanupCommand
;
315 return new RebaseCommand
;
317 return new ResolveCommand
;
319 return new DropMoveCommand
;
321 return new DropCopyCommand
;
323 return new DropCopyAddCommand
;
325 return new HelpCommand
;
327 return new StashSaveCommand
;
329 return new StashApplyCommand
;
331 return new StashPopCommand
;
333 return new SubmoduleAddCommand
;
335 return new SubmoduleUpdateCommand
;
337 return new RefLogCommand
;
339 return new SubmoduleSyncCommand
;
341 return new SendMailCommand
;
343 return new CatCommand
;
345 return new RefBrowseCommand
;
347 return new SVNDCommitCommand
;
349 return new SVNRebaseCommand
;
351 return new SVNFetchCommand
;
353 return new SyncCommand
;
355 return new RequestPullCommand
;
357 return new UpdateCheckCommand
;
359 return new PasteCopyCommand
;
361 return new PasteMoveCommand
;
363 return new SVNIgnoreCommand
;
365 return new BisectCommand
;
367 return new RepositoryBrowserCommand
;
369 return new AssumeValidCommand
;
376 return new CopyCommand
;
378 return new CrashCommand
;
383 return new PrevDiffCommand
;
385 return new PropertiesCommand
;
387 return new RTFMCommand
;
388 case cmdRebuildIconCache
:
389 return new RebuildIconCacheCommand
;
391 return new ShowCompareCommand
;
393 return new UnIgnoreCommand
;
396 CMessageBox::Show(hWndExplorer
, _T("Command not implemented"), _T("TortoiseGit"), MB_ICONERROR
);
397 return new AboutCommand
;