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