Exemplo n.º 1
0
        private static void LoadMergeDiffTool()
        {
            if (PlatformInfo.platform == Platforms.Windows)
            {
                string programFilesx86, programFilesx64;
                PlatformInfo.GetWindowsProgramFilesPath(out programFilesx86, out programFilesx64);
                switch (settings.mergeDiffTool)
                {
                case MergeDiffTools.None: mergeToolPath = null; break;

                case MergeDiffTools.Meld: mergeToolPath = programFilesx86 + "\\Meld\\Meld.exe"; break;

                case MergeDiffTools.kDiff3: mergeToolPath = programFilesx64 + "\\KDiff3\\kdiff3.exe"; break;

                case MergeDiffTools.P4Merge: mergeToolPath = programFilesx64 + "\\Perforce\\p4merge.exe"; break;

                case MergeDiffTools.DiffMerge: mergeToolPath = programFilesx64 + "\\SourceGear\\Common\\\\DiffMerge\\sgdm.exe"; break;
                }
            }
            else if (PlatformInfo.platform == Platforms.Mac)
            {
                mergeToolPath = null;
            }
            else if (PlatformInfo.platform == Platforms.Linux)
            {
                mergeToolPath = null;
            }
            else
            {
                throw new Exception("Unsported platform: " + PlatformInfo.platform);
            }

            if (mergeToolPath != null)
            {
                isMergeToolInstalled = File.Exists(mergeToolPath);
                if (!isMergeToolInstalled)
                {
                    DebugLog.LogWarning("Diff/Merge tool not installed: " + mergeToolPath);
                }
            }
            else
            {
                isMergeToolInstalled = false;
                DebugLog.LogWarning("Diff/Merge tool set to none. Some app functions will fail.");
            }
        }
Exemplo n.º 2
0
        public void OpenGitk(string filename = null)
        {
            lock (this)
            {
                try
                {
                    // open gitk
                    using (var process = new Process())
                    {
                        if (PlatformInfo.platform == Platforms.Windows)
                        {
                            string programFilesx86, programFilesx64;
                            PlatformInfo.GetWindowsProgramFilesPath(out programFilesx86, out programFilesx64);
                            process.StartInfo.FileName = Path.Combine(programFilesx64, "Git", "cmd", "gitk.exe");
                        }
                        else
                        {
                            throw new Exception("Unsported platform: " + PlatformInfo.platform);
                        }

                        process.StartInfo.WorkingDirectory = repository.repoPath;
                        if (filename != null)
                        {
                            process.StartInfo.Arguments = string.Format("\"{0}\"", filename);
                        }
                        process.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
                        if (!process.Start())
                        {
                            DebugLog.LogError("Failed to start history tool (is it installed?)");
                            return;
                        }

                        process.WaitForExit();
                    }
                }
                catch (Exception e)
                {
                    DebugLog.LogError("Failed to start history tool: " + e.Message);
                    return;
                }

                Refresh();
            }
        }