1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2017 - TortoiseGit
4 // Copyright (C) 2007-2009 - 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.
22 #include "MessageBox.h"
23 #include "AboutCommand.h"
24 #include "AutoTextTestCommand.h"
25 #include "CommitCommand.h"
26 #include "LogCommand.h"
28 #include "CreateRepositoryCommand.h"
29 #include "CloneCommand.h"
30 #include "PrevDiffCommand.h"
31 #include "DiffCommand.h"
33 #include "RenameCommand.h"
34 #include "RepoStatusCommand.h"
36 #include "RevertCommand.h"
37 #include "RemoveCommand.h"
38 #include "PullCommand.h"
39 #include "FetchCommand.h"
40 #include "PushCommand.h"
41 #include "BranchCommand.h"
42 #include "TagCommand.h"
43 #include "MergeCommand.h"
44 #include "SwitchCommand.h"
45 #include "ExportCommand.h"
46 #include "AddCommand.h"
47 #include "IgnoreCommand.h"
48 #include "FormatPatchCommand.h"
49 #include "ImportPatchCommand.h"
50 #include "BlameCommand.h"
51 #include "SettingsCommand.h"
52 #include "ConflictEditorCommand.h"
53 #include "CleanupCommand.h"
54 #include "RebaseCommand.h"
55 #include "ResolveCommand.h"
56 #include "DropMoveCommand.h"
57 #include "DropCopyAddCommand.h"
58 #include "DropCopyCommand.h"
59 #include "HelpCommand.h"
60 #include "StashCommand.h"
61 #include "SubmoduleCommand.h"
62 #include "ReflogCommand.h"
63 #include "SendMailCommand.h"
64 #include "CatCommand.h"
65 #include "RefBrowseCommand.h"
66 #include "SVNDCommitCommand.h"
67 #include "SVNRebaseCommand.h"
68 #include "SVNFetchCommand.h"
69 #include "SyncCommand.h"
70 #include "RequestPullCommand.h"
71 #include "UpdateCheckCommand.h"
72 #include "PasteCopyCommand.h"
73 #include "PasteMoveCommand.h"
74 #include "SVNIgnoreCommand.h"
75 #include "BisectCommand.h"
76 #include "RepositoryBrowserCommand.h"
77 #include "RevisiongraphCommand.h"
78 #include "ShowCompareCommand.h"
79 #include "DaemonCommand.h"
80 #include "CommitIsOnRefsCommand.h"
83 #include "CrashCommand.h"
84 #include "RebuildIconCacheCommand.h"
85 #include "RemoveCommand.h"
86 #include "RTFMCommand.h"
87 #include "UnIgnoreCommand.h"
159 static const struct CommandInfo
162 LPCTSTR pCommandName
;
165 { cmdAbout
, L
"about" },
167 { cmdAutoTextTest
, L
"autotexttest" },
168 { cmdBlame
, L
"blame" },
169 { cmdBranch
, L
"branch" },
171 { cmdCleanup
, L
"cleanup" },
172 { cmdClone
, L
"clone" },
173 { cmdCommit
, L
"commit" },
174 { cmdConflictEditor
, L
"conflicteditor" },
175 { cmdCrash
, L
"crash" },
176 { cmdDiff
, L
"diff" },
177 { cmdDropCopy
, L
"dropcopy" },
178 { cmdDropCopyAdd
, L
"dropcopyadd" },
179 { cmdDropMove
, L
"dropmove" },
180 { cmdFetch
, L
"fetch" },
181 { cmdFormatPatch
, L
"formatpatch" },
182 { cmdExport
, L
"export" },
183 { cmdHelp
, L
"help" },
184 { cmdIgnore
, L
"ignore" },
185 { cmdImportPatch
, L
"importpatch" },
187 { cmdMerge
, L
"merge" },
188 { cmdPasteCopy
, L
"pastecopy" },
189 { cmdPasteMove
, L
"pastemove" },
190 { cmdPrevDiff
, L
"prevdiff" },
191 { cmdPull
, L
"pull" },
192 { cmdPush
, L
"push" },
193 { cmdRTFM
, L
"rtfm" },
194 { cmdRebuildIconCache
,L
"rebuildiconcache" },
195 { cmdRemove
, L
"remove" },
196 { cmdRebase
, L
"rebase" },
197 { cmdRename
, L
"rename" },
198 { cmdRepoCreate
, L
"repocreate" },
199 { cmdRepoStatus
, L
"repostatus" },
200 { cmdResolve
, L
"resolve" },
201 { cmdRevert
, L
"revert" },
202 { cmdSendMail
, L
"sendmail" },
203 { cmdSettings
, L
"settings" },
204 { cmdShowCompare
, L
"showcompare" },
205 { cmdSwitch
, L
"switch" },
207 { cmdUnIgnore
, L
"unignore" },
208 { cmdUpdateCheck
, L
"updatecheck" },
209 { cmdStashSave
, L
"stashsave" },
210 { cmdStashApply
, L
"stashapply" },
211 { cmdStashPop
, L
"stashpop" },
212 { cmdStashList
, L
"stashlist" },
213 { cmdSubAdd
, L
"subadd" },
214 { cmdSubUpdate
, L
"subupdate" },
215 { cmdSubSync
, L
"subsync" },
216 { cmdRefLog
, L
"reflog" },
217 { cmdRefBrowse
, L
"refbrowse" },
218 { cmdSVNDCommit
, L
"svndcommit" },
219 { cmdSVNRebase
, L
"svnrebase" },
220 { cmdSVNFetch
, L
"svnfetch" },
221 { cmdSVNIgnore
, L
"svnignore" },
222 { cmdSync
, L
"sync" },
223 { cmdRequestPull
, L
"requestpull" },
224 { cmdBisect
, L
"bisect" },
225 { cmdRepoBrowser
, L
"repobrowser" },
226 { cmdRevisionGraph
, L
"revisiongraph" },
227 { cmdDaemon
, L
"daemon" },
228 { cmdPGPFP
, L
"pgpfp" },
229 { cmdCommitIsOnRefs
, L
"commitisonrefs" },
233 Command
* CommandServer::GetCommand(const CString
& sCmd
)
235 // Look up the command
236 TGitCommand command
= cmdAbout
; // Something harmless as a default
237 for (int nCommand
= 0; nCommand
< _countof(commandInfo
); ++nCommand
)
239 if (sCmd
.Compare(commandInfo
[nCommand
].pCommandName
) == 0)
241 // We've found the command
242 command
= commandInfo
[nCommand
].command
;
243 // If this fires, you've let the enum get out of sync with the commandInfo array
244 ASSERT((int)command
== nCommand
);
249 // CBrowseRefsDlg dialog
253 return new AboutCommand
;
254 case cmdAutoTextTest
:
255 return new AutoTextTestCommand
;
257 return new CommitCommand
;
259 return new LogCommand
;
261 return new CreateRepositoryCommand
;
263 return new CloneCommand
;
265 return new PrevDiffCommand
;
267 return new DiffCommand
;
269 return new RenameCommand
;
271 return new RepoStatusCommand
;
273 return new RemoveCommand
;
275 return new RevertCommand
;
277 return new PullCommand
;
279 return new FetchCommand
;
281 return new PushCommand
;
283 return new BranchCommand
;
285 return new TagCommand
;
287 return new MergeCommand
;
289 return new SwitchCommand
;
291 return new ExportCommand
;
293 return new AddCommand
;
295 return new IgnoreCommand
;
297 return new FormatPatchCommand
;
299 return new ImportPatchCommand
;
301 return new BlameCommand
;
303 return new SettingsCommand
;
304 case cmdConflictEditor
:
305 return new ConflictEditorCommand
;
307 return new CleanupCommand
;
309 return new RebaseCommand
;
311 return new ResolveCommand
;
313 return new DropMoveCommand
;
316 return new DropCopyCommand
;
319 return new DropCopyAddCommand
;
321 return new HelpCommand
;
323 return new StashSaveCommand
;
325 return new StashApplyCommand
;
327 return new StashPopCommand
;
329 return new SubmoduleAddCommand
;
331 return new SubmoduleUpdateCommand
;
333 return new RefLogCommand
;
335 return new SubmoduleSyncCommand
;
337 return new SendMailCommand
;
339 return new CatCommand
;
341 return new RefBrowseCommand
;
343 return new SVNDCommitCommand
;
345 return new SVNRebaseCommand
;
347 return new SVNFetchCommand
;
349 return new SyncCommand
;
351 return new RequestPullCommand
;
353 return new UpdateCheckCommand
;
356 return new PasteCopyCommand
;
358 return new PasteMoveCommand
;
361 return new SVNIgnoreCommand
;
363 return new BisectCommand
;
365 return new RepositoryBrowserCommand
;
366 case cmdRevisionGraph
:
367 return new RevisionGraphCommand
;
369 return new ShowCompareCommand
;
371 return new DaemonCommand
;
372 case cmdCommitIsOnRefs
:
373 return new CommitIsOnRefsCommand
;
377 return new CrashCommand
;
379 return new RTFMCommand
;
380 case cmdRebuildIconCache
:
381 return new RebuildIconCacheCommand
;
383 return new UnIgnoreCommand
;
387 CMessageBox::Show(hWndExplorer
, L
"This is the fingerprint of the TortoiseGit Release Signing Key.\nIt can be used to establish a trust path from this release to another one.\n\nTortoiseGit Release Signing Key, 4096-bit RSA:\n74A2 1AE3 01B3 CA5B D807 2F5E F7F1 7B3F 9DD9 539E", L
"TortoiseGit", MB_OK
);
391 CMessageBox::Show(hWndExplorer
, L
"Command not implemented", L
"TortoiseGit", MB_ICONERROR
);
392 return new AboutCommand
;