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