mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
feature<MergeTool>: supports to use WinMerge as git.mergetool
This commit is contained in:
parent
e5ac504134
commit
11420ee5b4
3 changed files with 20 additions and 1 deletions
|
@ -42,6 +42,11 @@ namespace SourceGit.Commands {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Args { get; set; } = "";
|
public string Args { get; set; } = "";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否忽略错误
|
||||||
|
/// </summary>
|
||||||
|
public bool DontRaiseError { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 使用标准错误输出
|
/// 使用标准错误输出
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -115,7 +120,7 @@ namespace SourceGit.Commands {
|
||||||
proc.Close();
|
proc.Close();
|
||||||
|
|
||||||
if (!isCancelled && exitCode != 0 && errs.Count > 0) {
|
if (!isCancelled && exitCode != 0 && errs.Count > 0) {
|
||||||
Models.Exception.Raise(string.Join("\n", errs));
|
if (!DontRaiseError) Models.Exception.Raise(string.Join("\n", errs));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace SourceGit.Models {
|
||||||
new MergeTool(3, "Tortoise Merge", "TortoiseMerge.exe", "-base:\"$BASE\" -theirs:\"$REMOTE\" -mine:\"$LOCAL\" -merged:\"$MERGED\"", FindTortoiseMerge),
|
new MergeTool(3, "Tortoise Merge", "TortoiseMerge.exe", "-base:\"$BASE\" -theirs:\"$REMOTE\" -mine:\"$LOCAL\" -merged:\"$MERGED\"", FindTortoiseMerge),
|
||||||
new MergeTool(4, "KDiff3", "kdiff3.exe", "\"$REMOTE\" -b \"$BASE\" \"$LOCAL\" -o \"$MERGED\"", FindKDiff3),
|
new MergeTool(4, "KDiff3", "kdiff3.exe", "\"$REMOTE\" -b \"$BASE\" \"$LOCAL\" -o \"$MERGED\"", FindKDiff3),
|
||||||
new MergeTool(5, "Beyond Compare 4", "BComp.exe", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"", FindBCompare),
|
new MergeTool(5, "Beyond Compare 4", "BComp.exe", "\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"", FindBCompare),
|
||||||
|
new MergeTool(6, "WinMerge", "WinMergeU.exe", "-u -e \"$REMOTE\" \"$LOCAL\" \"$MERGED\"", FindWinMerge),
|
||||||
};
|
};
|
||||||
|
|
||||||
public MergeTool(int type, string name, string exec, string cmd, Func<string> finder) {
|
public MergeTool(int type, string name, string exec, string cmd, Func<string> finder) {
|
||||||
|
@ -115,5 +116,17 @@ namespace SourceGit.Models {
|
||||||
var dir = Path.GetDirectoryName(exec);
|
var dir = Path.GetDirectoryName(exec);
|
||||||
return $"{dir}\\BComp.exe";
|
return $"{dir}\\BComp.exe";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string FindWinMerge() {
|
||||||
|
var root = RegistryKey.OpenBaseKey(
|
||||||
|
RegistryHive.CurrentUser,
|
||||||
|
Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32);
|
||||||
|
|
||||||
|
var merge = root.OpenSubKey(@"SOFTWARE\Thingamahoochie\WinMerge");
|
||||||
|
if (merge == null) return "";
|
||||||
|
|
||||||
|
var exec = merge.GetValue("Executable") as string;
|
||||||
|
return exec;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,6 +200,7 @@ namespace SourceGit.Views.Widgets {
|
||||||
|
|
||||||
var cmd = new Commands.Command();
|
var cmd = new Commands.Command();
|
||||||
cmd.Cwd = repo.Path;
|
cmd.Cwd = repo.Path;
|
||||||
|
cmd.DontRaiseError = true;
|
||||||
cmd.Args = $"-c mergetool.sourcegit.cmd=\"\\\"{mergeExe}\\\" {merger.Cmd}\" ";
|
cmd.Args = $"-c mergetool.sourcegit.cmd=\"\\\"{mergeExe}\\\" {merger.Cmd}\" ";
|
||||||
cmd.Args += "-c mergetool.writeToTemp=true -c mergetool.keepBackup=false -c mergetool.trustExitCode=true ";
|
cmd.Args += "-c mergetool.writeToTemp=true -c mergetool.keepBackup=false -c mergetool.trustExitCode=true ";
|
||||||
cmd.Args += $"mergetool --tool=sourcegit {change.Path}";
|
cmd.Args += $"mergetool --tool=sourcegit {change.Path}";
|
||||||
|
|
Loading…
Reference in a new issue