//TODO Do a command pattern so we can plugin any diff tool internal async Task RunDiffCommand(DiffFileInfo fileInfo) { if (GitSccOptions.Current.DiffTool == DiffTools.VisualStudio) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var diffService = (IVsDifferenceService)GetService(typeof(SVsDifferenceService)); if (diffService != null) { string rightLabel = fileInfo.ModifiedFilePath; string tempPrefix = Path.GetRandomFileName().Substring(0, 5); string caption = string.Format("{0}_{1} vs. {1}", tempPrefix, fileInfo.ActualFilename); var leftLabel = string.Format("{0}@{1}", fileInfo.ActualFilename, fileInfo.LastRevision); __VSDIFFSERVICEOPTIONS grfDiffOptions = __VSDIFFSERVICEOPTIONS.VSDIFFOPT_LeftFileIsTemporary; diffService.OpenComparisonWindow2(fileInfo.UnmodifiedFilePath, fileInfo.ModifiedFilePath, caption, null, leftLabel, rightLabel, null, null, (uint)grfDiffOptions); // Since the file is marked as temporary, we can delete it now File.Delete(fileInfo.UnmodifiedFilePath); } } else { var diffCmd = sccService.GetTracker(fileInfo.ModifiedFilePath).DefaultDiffCommand; if (string.IsNullOrWhiteSpace(diffCmd)) { MessageBox.Show( "Please setup default diff tool for git, or use change settings to use Visual Studio diff", "Configuration Error"); } var cmd = diffCmd.Replace("$LOCAL", fileInfo.UnmodifiedFilePath).Replace("$REMOTE", fileInfo.ModifiedFilePath); string fileName = Regex.Match(cmd, ParameterPattern).Value; string arguments = cmd.Substring(fileName.Length); ProcessStartInfo startInfo = new ProcessStartInfo(fileName, arguments); Process.Start(startInfo); //var difftoolPath = GitSccOptions.Current.DifftoolPath; //if (string.IsNullOrWhiteSpace(difftoolPath)) difftoolPath = "diffmerge.exe"; //try //{ // RunCommand(difftoolPath, "\"" + fileInfo.UnmodifiedFilePath + "\" \"" + fileInfo.ModifiedFilePath + "\""); //} //catch (FileNotFoundException ex) //{ // throw new FileNotFoundException(string.Format("Diff tool '{0}' is not available.", difftoolPath), difftoolPath, ex); //} } }