public void ExecuteTortoiseProc(ToolbarCommand command) { var solutionPath = PathConfiguration.GetSolutionPath(_solution); var openedFilePath = PathConfiguration.GetOpenedFilePath(_solution); // todo: make the bash/tortoise paths configurable // todo: detect if the solution is a git solution first if (command == ToolbarCommand.Bash && PathConfiguration.GetGitBashPath() == null) { MessageBox.Show( Resources.Resources.TortoiseGitLauncherService_ExecuteTortoiseProc_Could_not_find_Git_Bash_in_the_standard_install_path_, Resources.Resources.TortoiseGitLauncherService_ExecuteTortoiseProc_Git_Bash_not_found, MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); return; } if (command != ToolbarCommand.Bash && solutionPath == null) { MessageBox.Show( Resources.Resources.TortoiseGitLauncherService_SolutionPath_You_need_to_open_a_solution_first, Resources.Resources.TortoiseGitLauncherService_SolutionPath_No_solution_found, MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); return; } if (command != ToolbarCommand.Bash && PathConfiguration.GetTortoiseGitPath() == null) { MessageBox.Show( Resources.Resources.TortoiseGitLauncherService_ExecuteTortoiseProc_Could_not_find_TortoiseGit_in_the_standard_install_path_, Resources.Resources.TortoiseGitLauncherService_ExecuteTortoiseProc_TortoiseGit_not_found, MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); return; } ProcessStartInfo process; switch (command) { case ToolbarCommand.Bash: process = _processManagerService.GetProcess( PathConfiguration.GetGitBashPath(), "--login -i", solutionPath ); break; case ToolbarCommand.RebaseContinue: process = _processManagerService.GetProcess( PathConfiguration.GetGitBashPath(), @"--login -i -c 'echo; echo ""Running git rebase --continue""; echo; git rebase --continue; echo; echo ""Please review the output above and press enter to continue.""; read'", solutionPath ); break; case ToolbarCommand.FileLog: case ToolbarCommand.FileDiff: var commandParam = command.ToString().Replace("File", string.Empty).ToLower(); process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), string.Format(@"/command:{0} /path:""{1}""", commandParam, openedFilePath) ); break; case ToolbarCommand.FileBlame: var line = GetCurrentLine(_solution); process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), string.Format(@"/command:blame /path:""{0}"" /line:{1}", openedFilePath, line) ); break; default: process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), string.Format(@"/command:{0} /path:""{1}""", command.ToString().ToLower(), solutionPath) ); break; } if (process != null) Process.Start(process); }
public void ExecuteTortoiseProc(ToolbarCommand command) { var solutionPath = PathConfiguration.GetSolutionPath(_solution); var openedFilePath = PathConfiguration.GetOpenedFilePath(_solution); // todo: make the bash/tortoise paths configurable // todo: detect if the solution is a git solution first if (command == ToolbarCommand.Bash && PathConfiguration.GetGitBashPath() == null) { MessageBox.Show( Resources.Resources.TortoiseGitLauncherService_ExecuteTortoiseProc_Could_not_find_Git_Bash_in_the_standard_install_path_, Resources.Resources.TortoiseGitLauncherService_ExecuteTortoiseProc_Git_Bash_not_found, MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); return; } if (command != ToolbarCommand.Bash && solutionPath == null) { MessageBox.Show( Resources.Resources.TortoiseGitLauncherService_SolutionPath_You_need_to_open_a_solution_first, Resources.Resources.TortoiseGitLauncherService_SolutionPath_No_solution_found, MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); return; } if (command != ToolbarCommand.Bash && PathConfiguration.GetTortoiseGitPath() == null) { MessageBox.Show( Resources.Resources.TortoiseGitLauncherService_ExecuteTortoiseProc_Could_not_find_TortoiseGit_in_the_standard_install_path_, Resources.Resources.TortoiseGitLauncherService_ExecuteTortoiseProc_TortoiseGit_not_found, MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); return; } ProcessStartInfo process; switch (command) { case ToolbarCommand.Bash: process = _processManagerService.GetProcess( PathConfiguration.GetGitBashPath(), "--login -i", solutionPath ); break; case ToolbarCommand.RebaseContinue: process = _processManagerService.GetProcess( PathConfiguration.GetGitBashPath(), @"--login -i -c 'echo; echo ""Running git rebase --continue""; echo; git rebase --continue; echo; echo ""Please review the output above and press enter to continue.""; read'", solutionPath ); break; case ToolbarCommand.FileLog: case ToolbarCommand.FileDiff: var commandParam = command.ToString().Replace("File", string.Empty).ToLower(); process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), string.Format(@"/command:{0} /path:""{1}""", commandParam, openedFilePath) ); break; case ToolbarCommand.FileBlame: var line = GetCurrentLine(_solution); process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), string.Format(@"/command:blame /path:""{0}"" /line:{1}", openedFilePath, line) ); break; case ToolbarCommand.StashList: process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), string.Format(@"/command:reflog /path:""{0}"" /ref:""refs/stash""", solutionPath) ); break; case ToolbarCommand.BisectStart: process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), string.Format(@"/command:bisect /start /path:""{0}""", solutionPath) ); break; case ToolbarCommand.BisectGood: process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), string.Format(@"/command:bisect /good /path:""{0}""", solutionPath) ); break; case ToolbarCommand.BisectBad: process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), string.Format(@"/command:bisect /bad /path:""{0}""", solutionPath) ); break; case ToolbarCommand.BisectSkip: process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), string.Format(@"/command:bisect /skip /path:""{0}""", solutionPath) ); break; case ToolbarCommand.BisectReset: process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), string.Format(@"/command:bisect /reset /path:""{0}""", solutionPath) ); break; default: process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), string.Format(@"/command:{0} /path:""{1}""", command.ToString().ToLower(), solutionPath) ); break; } if (process != null) { Process.Start(process); } }
public void ExecuteTortoiseProc(ToolbarCommand command) { var solutionPath = PathConfiguration.GetSolutionPath(_solution); var openedFilePath = PathConfiguration.GetOpenedFilePath(_solution); // todo: make the bash/tortoise paths configurable // todo: detect if the solution is a git solution first if (command == ToolbarCommand.Bash && PathConfiguration.GetGitBashPath() == null) { MessageBox.Show( Resources.Resources.TortoiseGitLauncherService_ExecuteTortoiseProc_Could_not_find_Git_Bash_in_the_standard_install_path_, Resources.Resources.TortoiseGitLauncherService_ExecuteTortoiseProc_Git_Bash_not_found, MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); return; } if (command != ToolbarCommand.Bash && solutionPath == null) { MessageBox.Show( Resources.Resources.TortoiseGitLauncherService_SolutionPath_You_need_to_open_a_solution_first, Resources.Resources.TortoiseGitLauncherService_SolutionPath_No_solution_found, MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); return; } if (command != ToolbarCommand.Bash && PathConfiguration.GetTortoiseGitPath() == null) { MessageBox.Show( Resources.Resources.TortoiseGitLauncherService_ExecuteTortoiseProc_Could_not_find_TortoiseGit_in_the_standard_install_path_, Resources.Resources.TortoiseGitLauncherService_ExecuteTortoiseProc_TortoiseGit_not_found, MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); return; } ProcessStartInfo process; switch (command) { case ToolbarCommand.Bash: process = _processManagerService.GetProcess( PathConfiguration.GetGitBashPath(), "--login -i", solutionPath ); break; case ToolbarCommand.RebaseContinue: process = _processManagerService.GetProcess( PathConfiguration.GetGitBashPath(), @"--login -i -c 'echo; echo ""Running git rebase --continue""; echo; git rebase --continue; echo; echo ""Please review the output above and press enter to continue.""; read'", solutionPath ); break; case ToolbarCommand.FileLog: case ToolbarCommand.FileDiff: var commandParam = command.ToString().Replace("File", string.Empty).ToLower(); process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), $@"/command:{commandParam} /path:""{openedFilePath}""" ); break; case ToolbarCommand.FileBlame: var line = GetCurrentLine(_solution); process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), $@"/command:blame /path:""{openedFilePath}"" /line:{line}" ); break; case ToolbarCommand.StashList: process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), $@"/command:reflog /path:""{solutionPath}"" /ref:""refs/stash""" ); break; //todo:修改Pull操作 case ToolbarCommand.Pull: process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), $@"/command:pull --progress -v --no-rebase ""origin"" /path:""{solutionPath}""" ); break; case ToolbarCommand.SubModuleAdd: process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), $@"/command:subadd /path:""{solutionPath}""" ); break; case ToolbarCommand.SubModuleUpdate: process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), $@"/command:subupdate --recursive --remote /bkpath:""{solutionPath}"" /path:""{solutionPath}""" ); break; default: process = _processManagerService.GetProcess( PathConfiguration.GetTortoiseGitPath(), $@"/command:{command.ToString().ToLower()} /path:""{solutionPath}""" ); break; } if (process != null) { Process.Start(process); } }