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"
69 #include "CheckoutCommand.h"
73 #include "CopyCommand.h"
74 #include "CrashCommand.h"
75 #include "CreatePatchCommand.h"
77 #include "DelUnversionedCommand.h"
84 #include "ImportCommand.h"
85 #include "LockCommand.h"
88 #include "MergeAllCommand.h"
89 #include "PasteCopyCommand.h"
90 #include "PasteMoveCommand.h"
92 #include "PropertiesCommand.h"
93 #include "RebuildIconCacheCommand.h"
94 #include "RelocateCommand.h"
95 #include "RemoveCommand.h"
97 #include "RepositoryBrowserCommand.h"
100 #include "RevertCommand.h"
101 #include "RevisiongraphCommand.h"
102 #include "RTFMCommand.h"
104 #include "ShowCompareCommand.h"
106 #include "UnIgnoreCommand.h"
107 #include "UnLockCommand.h"
108 #include "UpdateCheckCommand.h"
109 #include "UpdateCommand.h"
110 #include "UrlDiffCommand.h"
182 static const struct CommandInfo
185 LPCTSTR pCommandName
;
188 { cmdAbout
, _T("about") },
189 { cmdAdd
, _T("add") },
190 { cmdBlame
, _T("blame") },
191 { cmdBranch
, _T("branch") },
192 { cmdCat
, _T("cat") },
193 { cmdCheckout
, _T("checkout") },
194 { cmdCleanup
, _T("cleanup") },
195 { cmdClone
, _T("clone") },
196 { cmdCommit
, _T("commit") },
197 { cmdConflictEditor
, _T("conflicteditor") },
198 { cmdCopy
, _T("copy") },
199 { cmdCrash
, _T("crash") },
200 { cmdCreatePatch
, _T("createpatch") },
201 { cmdDelUnversioned
, _T("delunversioned") },
202 { cmdDiff
, _T("diff") },
203 { cmdDropCopy
, _T("dropcopy") },
204 { cmdDropCopyAdd
, _T("dropcopyadd") },
205 { cmdDropExport
, _T("dropexport") },
206 { cmdDropMove
, _T("dropmove") },
207 { cmdFetch
, _T("fetch") },
208 { cmdFormatPatch
, _T("formatpatch") },
209 { cmdExport
, _T("export") },
210 { cmdHelp
, _T("help") },
211 { cmdIgnore
, _T("ignore") },
212 { cmdImport
, _T("import") },
213 { cmdImportPatch
, _T("importpatch") },
214 { cmdLock
, _T("lock") },
215 { cmdLog
, _T("log") },
216 { cmdMerge
, _T("merge") },
217 { cmdMergeAll
, _T("mergeall") },
218 { cmdPasteCopy
, _T("pastecopy") },
219 { cmdPasteMove
, _T("pastemove") },
220 { cmdPrevDiff
, _T("prevdiff") },
221 { cmdProperties
, _T("properties") },
222 { cmdPull
, _T("pull") },
223 { cmdPush
, _T("push") },
224 { cmdRTFM
, _T("rtfm") },
225 { cmdRebuildIconCache
,_T("rebuildiconcache") },
226 { cmdRelocate
, _T("relocate") },
227 { cmdRemove
, _T("remove") },
228 { cmdRebase
, _T("rebase") },
229 { cmdRename
, _T("rename") },
230 { cmdRepoBrowser
, _T("repobrowser") },
231 { cmdRepoCreate
, _T("repocreate") },
232 { cmdRepoStatus
, _T("repostatus") },
233 { cmdResolve
, _T("resolve") },
234 { cmdRevert
, _T("revert") },
235 { cmdRevisionGraph
, _T("revisiongraph") },
236 { cmdSendMail
, _T("sendmail") },
237 { cmdSettings
, _T("settings") },
238 { cmdShowCompare
, _T("showcompare") },
239 { cmdSwitch
, _T("switch") },
240 { cmdTag
, _T("tag") },
241 { cmdUnIgnore
, _T("unignore") },
242 { cmdUnlock
, _T("unlock") },
243 { cmdUpdate
, _T("update") },
244 { cmdUpdateCheck
, _T("updatecheck") },
245 { cmdUrlDiff
, _T("urldiff") },
246 { cmdStashSave
, _T("stashsave") },
247 { cmdStashApply
, _T("stashapply") },
248 { cmdStashList
, _T("stashlist") },
249 { cmdSubAdd
, _T("subadd") },
250 { cmdSubUpdate
, _T("subupdate") },
251 { cmdSubSync
, _T("subsync") },
252 { cmdRefLog
, _T("reflog") }
258 Command
* CommandServer::GetCommand(const CString
& sCmd
)
260 // Look up the command
261 TGitCommand command
= cmdAbout
; // Something harmless as a default
262 for (int nCommand
= 0; nCommand
< (sizeof(commandInfo
)/sizeof(commandInfo
[0])); nCommand
++)
264 if (sCmd
.Compare(commandInfo
[nCommand
].pCommandName
) == 0)
266 // We've found the command
267 command
= commandInfo
[nCommand
].command
;
268 // If this fires, you've let the enum get out of sync with the commandInfo array
269 ASSERT((int)command
== nCommand
);
279 return new AboutCommand
;
281 return new CommitCommand
;
283 return new LogCommand
;
285 return new CreateRepositoryCommand
;
287 return new CloneCommand
;
289 return new PrevDiffCommand
;
291 return new DiffCommand
;
293 return new RenameCommand
;
295 return new RepoStatusCommand
;
297 return new RemoveCommand
;
299 return new RevertCommand
;
301 return new PullCommand
;
303 return new FetchCommand
;
305 return new PushCommand
;
307 return new BranchCommand
;
309 return new TagCommand
;
311 return new MergeCommand
;
313 return new SwitchCommand
;
315 return new ExportCommand
;
317 return new AddCommand
;
319 return new IgnoreCommand
;
321 return new FormatPatchCommand
;
323 return new ImportPatchCommand
;
325 return new BlameCommand
;
327 return new SettingsCommand
;
328 case cmdConflictEditor
:
329 return new ConflictEditorCommand
;
331 return new CleanupCommand
;
333 return new RebaseCommand
;
335 return new ResolveCommand
;
337 return new DropMoveCommand
;
339 // return new DropCopyCommand;
340 // case cmdDropCopyAdd:
341 // return new DropCopyAddCommand;
342 // case cmdDropExport:
343 // return new DropExportCommand;
345 return new HelpCommand
;
347 return new StashSaveCommand
;
349 return new StashApplyCommand
;
351 return new SubmoduleAddCommand
;
353 return new SubmoduleUpdateCommand
;
355 return new RefLogCommand
;
357 return new SubmoduleSyncCommand
;
359 return new SendMailCommand
;
361 return new CatCommand
;
366 return new CheckoutCommand
;
371 return new CopyCommand
;
373 return new CrashCommand
;
375 return new CreatePatchCommand
;
376 case cmdDelUnversioned
:
377 return new DelUnversionedCommand
;
382 return new ImportCommand
;
384 return new LockCommand
;
386 return new MergeAllCommand
;
388 return new PasteCopyCommand
;
390 return new PasteMoveCommand
;
392 return new PrevDiffCommand
;
394 return new PropertiesCommand
;
396 return new RTFMCommand
;
397 case cmdRebuildIconCache
:
398 return new RebuildIconCacheCommand
;
400 return new RelocateCommand
;
402 return new RepositoryBrowserCommand
;
403 case cmdRevisionGraph
:
404 return new RevisionGraphCommand
;
406 return new ShowCompareCommand
;
408 return new UnIgnoreCommand
;
410 return new UnLockCommand
;
412 return new UpdateCommand
;
414 return new UpdateCheckCommand
;
416 return new UrlDiffCommand
;
419 CMessageBox::Show(hWndExplorer
, _T("Have not implemented"), _T("TortoiseGit"), MB_ICONERROR
);
420 return new AboutCommand
;