private bool CheckMergeTool()
{
DiffTool.Visible = true;
GitCommands.GitCommands gitCommands = new GitCommands.GitCommands();
if (string.IsNullOrEmpty(gitCommands.GetGlobalSetting("merge.tool")))
{
DiffTool.BackColor = Color.LightSalmon;
DiffTool.Text = "You need to configure merge tool in order to solve mergeconflicts (kdiff3 for example).";
return false;
}
if (Settings.RunningOnWindows())
{
if (gitCommands.GetGlobalSetting("merge.tool").Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase))
{
string p = gitCommands.GetGlobalSetting("mergetool.kdiff3.path");
if (string.IsNullOrEmpty(p) || !File.Exists(p))
{
DiffTool.BackColor = Color.LightSalmon;
DiffTool.Text = "KDiff3 is configured as mergetool, but the path to kdiff.exe is not configured.";
return false;
}
DiffTool.BackColor = Color.LightGreen;
DiffTool.Text = "KDiff3 is configured as mergetool.";
return true;
}
string mergetool = gitCommands.GetGlobalSetting("merge.tool");
if (mergetool.Equals("p4merge", StringComparison.CurrentCultureIgnoreCase) ||
mergetool.Equals("TortoiseMerge", StringComparison.CurrentCultureIgnoreCase))
{
string p = gitCommands.GetGlobalSetting("mergetool." + mergetool + ".cmd");
if (string.IsNullOrEmpty(p))
{
DiffTool.BackColor = Color.LightSalmon;
DiffTool.Text = mergetool + " is configured as mergetool, this is a custom mergetool and needs a custom cmd to be configured.";
return false;
}
DiffTool.BackColor = Color.LightGreen;
DiffTool.Text = "There is a custom mergetool configured: " + mergetool;
return true;
}
}
DiffTool.BackColor = Color.LightGreen;
DiffTool.Text = "There is a mergetool configured.";
return true;
}