1 // TortoiseSVN - a Windows shell extension for easy version control
3 // Copyright (C) 2007-2008 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "AboutCommand.h"
23 #include "CommitCommand.h"
24 #include "LogCommand.h"
26 #include "CreateRepositoryCommand.h"
27 #include "CloneCommand.h"
28 #include "PrevDiffCommand.h"
29 #include "DiffCommand.h"
31 #include "RenameCommand.h"
32 #include "RepoStatusCommand.h"
34 #include "RevertCommand.h"
35 #include "RemoveCommand.h"
36 #include "PullCommand.h"
37 #include "FetchCommand.h"
38 #include "PushCommand.h"
39 #include "BranchCommand.h"
40 #include "TagCommand.h"
41 #include "MergeCommand.h"
42 #include "SwitchCommand.h"
43 #include "ExportCommand.h"
44 #include "AddCommand.h"
45 #include "IgnoreCommand.h"
46 #include "FormatPatchCommand.h"
47 #include "ImportPatchCommand.h"
48 #include "BlameCommand.h"
49 #include "SettingsCommand.h"
50 #include "ConflictEditorCommand.h"
51 #include "CleanupCommand.h"
52 #include "RebaseCommand.h"
53 #include "ResolveCommand.h"
54 #include "DropMoveCommand.h"
55 #include "DropCopyAddCommand.h"
56 #include "DropCopyCommand.h"
57 #include "DropExportCommand.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"
65 #include "BrowseRefsDlg.h"
71 #include "CheckoutCommand.h"
75 #include "CopyCommand.h"
76 #include "CrashCommand.h"
77 #include "CreatePatchCommand.h"
79 #include "DelUnversionedCommand.h"
86 #include "ImportCommand.h"
87 #include "LockCommand.h"
90 #include "MergeAllCommand.h"
91 #include "PasteCopyCommand.h"
92 #include "PasteMoveCommand.h"
94 #include "PropertiesCommand.h"
95 #include "RebuildIconCacheCommand.h"
96 #include "RelocateCommand.h"
97 #include "RemoveCommand.h"
99 #include "RepositoryBrowserCommand.h"
102 #include "RevertCommand.h"
103 #include "RevisiongraphCommand.h"
104 #include "RTFMCommand.h"
106 #include "ShowCompareCommand.h"
108 #include "UnIgnoreCommand.h"
109 #include "UnLockCommand.h"
110 #include "UpdateCheckCommand.h"
111 #include "UpdateCommand.h"
112 #include "UrlDiffCommand.h"
184 static const struct CommandInfo
187 LPCTSTR pCommandName
;
190 { cmdAbout
, _T("about") },
191 { cmdAdd
, _T("add") },
192 { cmdBlame
, _T("blame") },
193 { cmdBranch
, _T("branch") },
194 { cmdCat
, _T("cat") },
195 { cmdCheckout
, _T("checkout") },
196 { cmdCleanup
, _T("cleanup") },
197 { cmdClone
, _T("clone") },
198 { cmdCommit
, _T("commit") },
199 { cmdConflictEditor
, _T("conflicteditor") },
200 { cmdCopy
, _T("copy") },
201 { cmdCrash
, _T("crash") },
202 { cmdCreatePatch
, _T("createpatch") },
203 { cmdDelUnversioned
, _T("delunversioned") },
204 { cmdDiff
, _T("diff") },
205 { cmdDropCopy
, _T("dropcopy") },
206 { cmdDropCopyAdd
, _T("dropcopyadd") },
207 { cmdDropExport
, _T("dropexport") },
208 { cmdDropMove
, _T("dropmove") },
209 { cmdFetch
, _T("fetch") },
210 { cmdFormatPatch
, _T("formatpatch") },
211 { cmdExport
, _T("export") },
212 { cmdHelp
, _T("help") },
213 { cmdIgnore
, _T("ignore") },
214 { cmdImport
, _T("import") },
215 { cmdImportPatch
, _T("importpatch") },
216 { cmdLock
, _T("lock") },
217 { cmdLog
, _T("log") },
218 { cmdMerge
, _T("merge") },
219 { cmdMergeAll
, _T("mergeall") },
220 { cmdPasteCopy
, _T("pastecopy") },
221 { cmdPasteMove
, _T("pastemove") },
222 { cmdPrevDiff
, _T("prevdiff") },
223 { cmdProperties
, _T("properties") },
224 { cmdPull
, _T("pull") },
225 { cmdPush
, _T("push") },
226 { cmdRTFM
, _T("rtfm") },
227 { cmdRebuildIconCache
,_T("rebuildiconcache") },
228 { cmdRelocate
, _T("relocate") },
229 { cmdRemove
, _T("remove") },
230 { cmdRebase
, _T("rebase") },
231 { cmdRename
, _T("rename") },
232 { cmdRepoBrowser
, _T("repobrowser") },
233 { cmdRepoCreate
, _T("repocreate") },
234 { cmdRepoStatus
, _T("repostatus") },
235 { cmdResolve
, _T("resolve") },
236 { cmdRevert
, _T("revert") },
237 { cmdRevisionGraph
, _T("revisiongraph") },
238 { cmdSendMail
, _T("sendmail") },
239 { cmdSettings
, _T("settings") },
240 { cmdShowCompare
, _T("showcompare") },
241 { cmdSwitch
, _T("switch") },
242 { cmdTag
, _T("tag") },
243 { cmdUnIgnore
, _T("unignore") },
244 { cmdUnlock
, _T("unlock") },
245 { cmdUpdate
, _T("update") },
246 { cmdUpdateCheck
, _T("updatecheck") },
247 { cmdUrlDiff
, _T("urldiff") },
248 { cmdStashSave
, _T("stashsave") },
249 { cmdStashApply
, _T("stashapply") },
250 { cmdStashList
, _T("stashlist") },
251 { cmdSubAdd
, _T("subadd") },
252 { cmdSubUpdate
, _T("subupdate") },
253 { cmdSubSync
, _T("subsync") },
254 { cmdRefLog
, _T("reflog") }
260 Command
* CommandServer::GetCommand(const CString
& sCmd
)
262 // Look up the command
263 TGitCommand command
= cmdAbout
; // Something harmless as a default
264 for (int nCommand
= 0; nCommand
< (sizeof(commandInfo
)/sizeof(commandInfo
[0])); nCommand
++)
266 if (sCmd
.Compare(commandInfo
[nCommand
].pCommandName
) == 0)
268 // We've found the command
269 command
= commandInfo
[nCommand
].command
;
270 // If this fires, you've let the enum get out of sync with the commandInfo array
271 ASSERT((int)command
== nCommand
);
277 // CBrowseRefsDlg dialog
279 class TestCommand
: public Command
281 virtual bool Execute()
283 CBrowseRefsDlg().DoModal();
287 return new TestCommand
;
293 return new AboutCommand
;
295 return new CommitCommand
;
297 return new LogCommand
;
299 return new CreateRepositoryCommand
;
301 return new CloneCommand
;
303 return new PrevDiffCommand
;
305 return new DiffCommand
;
307 return new RenameCommand
;
309 return new RepoStatusCommand
;
311 return new RemoveCommand
;
313 return new RevertCommand
;
315 return new PullCommand
;
317 return new FetchCommand
;
319 return new PushCommand
;
321 return new BranchCommand
;
323 return new TagCommand
;
325 return new MergeCommand
;
327 return new SwitchCommand
;
329 return new ExportCommand
;
331 return new AddCommand
;
333 return new IgnoreCommand
;
335 return new FormatPatchCommand
;
337 return new ImportPatchCommand
;
339 return new BlameCommand
;
341 return new SettingsCommand
;
342 case cmdConflictEditor
:
343 return new ConflictEditorCommand
;
345 return new CleanupCommand
;
347 return new RebaseCommand
;
349 return new ResolveCommand
;
351 return new DropMoveCommand
;
353 // return new DropCopyCommand;
354 // case cmdDropCopyAdd:
355 // return new DropCopyAddCommand;
356 // case cmdDropExport:
357 // return new DropExportCommand;
359 return new HelpCommand
;
361 return new StashSaveCommand
;
363 return new StashApplyCommand
;
365 return new SubmoduleAddCommand
;
367 return new SubmoduleUpdateCommand
;
369 return new RefLogCommand
;
371 return new SubmoduleSyncCommand
;
373 return new SendMailCommand
;
375 return new CatCommand
;
380 return new CheckoutCommand
;
385 return new CopyCommand
;
387 return new CrashCommand
;
389 return new CreatePatchCommand
;
390 case cmdDelUnversioned
:
391 return new DelUnversionedCommand
;
396 return new ImportCommand
;
398 return new LockCommand
;
400 return new MergeAllCommand
;
402 return new PasteCopyCommand
;
404 return new PasteMoveCommand
;
406 return new PrevDiffCommand
;
408 return new PropertiesCommand
;
410 return new RTFMCommand
;
411 case cmdRebuildIconCache
:
412 return new RebuildIconCacheCommand
;
414 return new RelocateCommand
;
416 return new RepositoryBrowserCommand
;
417 case cmdRevisionGraph
:
418 return new RevisionGraphCommand
;
420 return new ShowCompareCommand
;
422 return new UnIgnoreCommand
;
424 return new UnLockCommand
;
426 return new UpdateCommand
;
428 return new UpdateCheckCommand
;
430 return new UrlDiffCommand
;
433 CMessageBox::Show(hWndExplorer
, _T("Have not implemented"), _T("TortoiseGit"), MB_ICONERROR
);
434 return new AboutCommand
;